Skip to content

feat: Add support for Kimi For Coding model#1514

Closed
clawaizhang wants to merge 0 commit intosipeed:mainfrom
clawaizhang:main
Closed

feat: Add support for Kimi For Coding model#1514
clawaizhang wants to merge 0 commit intosipeed:mainfrom
clawaizhang:main

Conversation

@clawaizhang
Copy link
Copy Markdown

📝 Description

Add Claude Code User-Agent headers to bypass Coding Agent restriction for Kimi For Coding model. When using kimi-for-coding model or accessing kimi.com/coding endpoint, the provider now sends User-Agent: claude-cli/2.1.39 and x-app: cli headers to identify as a Coding Agent.

🗣️ Type of Change

  • ✨ New feature (non-breaking change which adds functionality)

🤖 AI Code Generation

  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)

🔗 Related Issue

Fixes #1293

📚 Technical Context (Skip for Docs)

  • Reference URL: https://www.kimi.com/coding/docs/more/third-party-agents.html
  • Reasoning: Kimi For Coding API restricts access to specific Coding Agents (Claude Code, Roo Code, Kilo Code, etc.). By adding the required User-Agent and x-app headers, PicoClaw can now use Kimi For Coding model through the OpenAI-compatible endpoint.

🧪 Test Environment

  • Hardware: PC
  • OS: Windows 11
  • Model/Provider: Kimi For Coding (api.kimi.com/coding)
  • Channels: N/A

📸 Evidence (Optional)

{AA647823-87F6-4720-A49B-F45F233FAF84}

Tested with configuration:

{
  "model_name": "kimi-coding",
  "model": "kimi-for-coding",
  "api_base": "https://api.kimi.com/coding/v1",
  "api_key": "sk-xxx"
}
```json

☑️ Checklist
 My code/docs follow the style of this project.
 I have performed a self-review of my own changes.
 I have updated the documentation accordingly.

@clawaizhang clawaizhang marked this pull request as draft March 13, 2026 16:08
@clawaizhang clawaizhang marked this pull request as ready for review March 13, 2026 16:09
@clawaizhang
Copy link
Copy Markdown
Author

clawaizhang commented Mar 13, 2026

👤 Reviewers

/cc @yinwm 麻烦帮忙 review 一下这个 PR,是关于添加 Kimi For Coding 支持的 Provider 修改。谢谢!

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 13, 2026

CLA assistant check
All committers have signed the CLA.

@clawaizhang clawaizhang marked this pull request as draft March 13, 2026 16:26
@clawaizhang clawaizhang force-pushed the main branch 2 times, most recently from 7266d91 to c022f8b Compare March 13, 2026 16:37
@sipeed-bot sipeed-bot Bot added type: enhancement New feature or request domain: provider go Pull requests that update go code labels Mar 13, 2026
@clawaizhang clawaizhang force-pushed the main branch 5 times, most recently from 6b59b81 to c022f8b Compare March 13, 2026 17:46
@clawaizhang clawaizhang marked this pull request as ready for review March 13, 2026 17:47
Copy link
Copy Markdown
Collaborator

@yinwm yinwm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Thanks for the contribution!

Issues

  • Major: Protocol routing issue - kimi-for-coding without prefix falls into default case. Fix: Add special handling in openai case before merging.
  • Medium: Hardcoded version 2.1.39 - Extract as constant
  • Medium: Imprecise string matching - Use more precise matching
  • Medium: Missing unit tests

Suggestion

Create kimi.go in anthropic_messages directory to centralize Kimi logic.

Copy link
Copy Markdown
Collaborator

@yinwm yinwm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Thanks for the contribution!

Issues

Severity Issue Suggestion
🔴 Major Protocol routing: kimi-for-coding without prefix falls into default case Add special handling at the beginning of openai case
🟡 Medium Hardcoded version 2.1.39 will become outdated Extract as a constant
🟡 Medium Contains may match unintended URLs Use more precise matching
🟡 Medium Missing unit tests Add test coverage

Suggestion

Create kimi.go in anthropic_messages directory:

pkg/providers/anthropic_messages/
├── provider.go
├── kimi.go          # Kimi-specific logic
└── provider_test.go

This keeps Kimi logic centralized, easier to maintain and test.

@clawaizhang
Copy link
Copy Markdown
Author

@yinwm thanks for your comments, I add kimi providers to keeps Kimi logic centralized, easier to maintain and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: provider go Pull requests that update go code type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add Kimi Coding Provider Support

3 participants