fix: add support for kimi-k2.5 and kimi-for-coding models#167
Open
tianling536 wants to merge 1 commit intodataelement:mainfrom
Open
fix: add support for kimi-k2.5 and kimi-for-coding models#167tianling536 wants to merge 1 commit intodataelement:mainfrom
tianling536 wants to merge 1 commit intodataelement:mainfrom
Conversation
This PR adds support for Kimi K2.5 and Kimi for Coding models: 1. **kimi-k2.5 temperature fix**: Force temperature=1 for kimi-k2.5 models as they only support this value (API error: "invalid temperature: only 1 is allowed") 2. **kimi-for-coding support**: Add new 'kimi-coding' provider using Anthropic protocol - Base URL: https://api.kimi.com/coding - Uses /v1/messages endpoint (Anthropic format) - Model ID: k2p5 - No anthropic-version header required 3. **Endpoint path fix**: Handle kimi.com/coding endpoint specially to use /v1/chat/completions instead of /chat/completions Changes: - Modified: backend/app/services/llm_client.py
76ceba9 to
2538782
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds support for Kimi K2.5 and Kimi for Coding models.
1. kimi-k2.5 temperature fix
Kimi k2.5 models only support temperature=1. When passing other values, the API returns:
Fix: Automatically sets temperature=1.0 when model name contains 'kimi-k2.5' or 'kimi-k2-5'.
2. kimi-for-coding support
Kimi for Coding uses Anthropic Messages API format instead of OpenAI format.
Added: New 'kimi-coding' provider with:
3. Endpoint path fix
Custom kimi endpoints (api.kimi.com/coding/) need /v1/chat/completions instead of /chat/completions.
Fix: Added _get_chat_endpoint() method to handle special cases.
Changes
Configuration
For kimi-k2.5
For kimi-for-coding