Repository navigation
fix(provider): add kimi-for-coding custom handler and fix model detection for k2p6 (Kimi K2.6) - #28080
fix(provider): add kimi-for-coding custom handler and fix model detection for k2p6 (Kimi K2.6)#28080herjarsa wants to merge 2 commits into
Conversation
…detection The kimi-for-coding provider registers Kimi K2.6 with model ID k2p6, but several code paths fail to properly handle this provider/model combination. Fixes: 1. Add custom kimi-for-coding handler in provider.ts with anthropic-beta headers 2. Fix Kimi system prompt detection in system.ts to check providerID 3. Fix temperature/topP transforms in transform.ts for k2p6 model ID 4. Fix schema sanitization condition in transform.ts for kimi-for-coding
|
The following comment was made by an LLM, it may be inaccurate: One potentially related PR found: PR #27903: "fix(opencode): set KimiCLI/1.5 User-Agent for kimi-for-coding provider" This PR also addresses the |
|
Regarding the related PR #27903 (User-Agent header fix): these two PRs address complementary aspects of the kimi-for-coding integration with no overlap.
Both PRs improve kimi-for-coding support independently and can be merged in any order. |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Issue for this PR
Closes #23933
Type of change
What does this PR do?
The
kimi-for-codingprovider registers Kimi K2.6 with model IDk2p6, but several code paths fail to properly handle this provider/model combination, causing the model to not be detected or function correctly with theplanagent and other subagents.Four issues fixed:
Missing custom provider handler (
provider.ts): Unlikeanthropic, thekimi-for-codingprovider had no custom handler in thecustom()function. This meant noanthropic-betaheaders were sent for thinking streaming and tool-streaming features. Added a handler identical toanthropics that sets the requiredanthropic-betaheaders.System prompt not matched (
system.ts): The Kimi system prompt detection checksmodel.api.id.toLowerCase().includes("kimi"), but the model ID isk2p6(not containing "kimi"). Addedmodel.providerID === "kimi-for-coding"fallback so the Kimi-specific system prompt is used.Temperature/topP transforms not applied (
transform.ts): The temperature function checksid.includes("kimi-k2")which doesnt match thek2p6model ID. Addedid.includes("k2p")fallback. Similarly addedk2p6to the topP model list.Schema sanitization not applied (
transform.ts): The schema sanitization condition checksmodel.providerID === "moonshotai" || model.api.id.toLowerCase().includes("kimi"). Addedmodel.providerID === "kimi-for-coding"so the same Moonshot schema fixes apply to Kimi-for-Coding.The
kimi-for-codingprovider uses the@ai-sdk/anthropicSDK and routes tohttps://api.kimi.com/coding/v1. Its modelk2p6(display name "Kimi K2.6") was already registered in the models.dev catalog and bundled snapshot but lacked proper integration in the OpenCode provider layer.How did you verify your code works?
kimi-for-codinghandler mirrors theanthropichandler pattern (lines 151-159)model.providerIDcheck pattern used elsewherek2p6model IDk2pin model IDs so no change needed thereScreenshots / recordings
N/A - no UI change.
Checklist