Skip to content

feat: add Kimi Code provider#7222

Closed
stebbins wants to merge 1 commit intoblock:mainfrom
stebbins:feat/kimicode
Closed

feat: add Kimi Code provider#7222
stebbins wants to merge 1 commit intoblock:mainfrom
stebbins:feat/kimicode

Conversation

@stebbins
Copy link
Contributor

@stebbins stebbins commented Feb 14, 2026

Summary

Add dedicated Kimi provider (kimi.rs) for Kimi Code subscription access via KIMI_API_KEY, with configurable KIMI_HOST.

Fix reasoning_content handling for thinking models (Kimi, DeepSeek, etc.):

  • Preserve reasoning content on split tool-call messages in agent.rs (Goose splits parallel tool calls into separate messages, which was dropping reasoning_content that providers like Kimi require)
  • Only include reasoning_content field when non-empty (Kimi rejects empty string "")
  • Accumulate reasoning_content during streaming tool call processing
  • Concatenate multiple reasoning blocks instead of overwriting
  • Wire request_params into create_request() for thinking mode activation

Update Kimi model context limits to 262K (131K for older k2-0711).

https://www.kimi.com/code/docs/en/more/third-party-agents.html

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit tests. I don't have a Kimi Code subscription so I'll ask someone for manual testing too.

Related Issues

Relates to #7150
Discussion: LINK (if any)

Screenshots/Demos (for UX changes)

Before:

After:

@stebbins stebbins force-pushed the feat/kimicode branch 3 times, most recently from ea42fc1 to 97ef15b Compare February 14, 2026 01:56
…odels

Add declarative Kimi Code provider (kimi.json) for Kimi Code subscription
access via KIMI_API_KEY.

Fix reasoning_content handling for thinking models (Kimi, DeepSeek, etc.):
- Preserve reasoning content on split tool-call messages in agent.rs
  (Goose splits parallel tool calls into separate messages, which was
  dropping reasoning_content that providers like Kimi require)
- Only include reasoning_content field when non-empty (Kimi rejects
  empty string "")
- Accumulate reasoning_content during streaming tool call processing
- Concatenate multiple reasoning blocks instead of overwriting
- Wire request_params into create_request() for thinking mode activation

Update Kimi model context limits to 262K.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Harrison <hcstebbins@gmail.com>
@stebbins stebbins mentioned this pull request Feb 14, 2026
1 task
@stebbins stebbins marked this pull request as ready for review February 14, 2026 02:39
@stebbins stebbins mentioned this pull request Feb 14, 2026
10 tasks
DOsinga pushed a commit that referenced this pull request Feb 18, 2026
Add support for Moonshot AI (Kimi) models:
- moonshot.json: kimi-latest, kimi-thinking-preview, kimi-k2-0711, kimi-k2, moonshot-v1-8k, moonshot-v1-32k
- kimi.json: kimi-for-coding, kimi-code (coding-optimized models)

Both providers use the Moonshot API (api.moonshot.cn) with MOONSHOT_API_KEY.

Combines work from PRs #6962 and #7222.
@DOsinga
Copy link
Collaborator

DOsinga commented Feb 18, 2026

ok, I merged the other one, I think we can close this now. let me know if not. and thanks for the contribution @stebbins

@DOsinga DOsinga closed this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments