Skip to content

Comments

Feature/kimi reasoning support#5597

Closed
Saksham-245 wants to merge 6 commits intoKilo-Org:mainfrom
Saksham-245:feature/kimi-reasoning-support
Closed

Feature/kimi reasoning support#5597
Saksham-245 wants to merge 6 commits intoKilo-Org:mainfrom
Saksham-245:feature/kimi-reasoning-support

Conversation

@Saksham-245
Copy link

@Saksham-245 Saksham-245 commented Feb 2, 2026

Context

Fixes #5454 - Kimi (Moonshot) reasoning parameter not working correctly with tool calls. The reasoning content was not being properly preserved and associated with tool calls in the conversation history.

Implementation

  • Added support for Kimi's native thinking: { type: "enabled" } parameter format when reasoning budget is enabled
  • Preserved reasoning_content for Kimi/DeepSeek interleaved thinking in message transformations
  • Fixed reasoning content tracking and association with tool calls in stream processing (src/core/task/Task.ts)
  • Preserved reasoning_content in conversation history for Moonshot provider
  • Fixed TypeScript type annotation to include reasoning_details property

Files Changed

  • src/api/providers/moonshot.ts - Kimi thinking parameter support
  • src/api/transform/openai-format.ts - Preserve reasoning_content in transformations
  • src/api/providers/openai.ts - Handle reasoning in OpenAI-compatible format
  • src/core/task/Task.ts - Track reasoning with tool calls, fix types

How to Test

  1. Set API provider to Moonshot (Kimi)
  2. Enable reasoning/thinking in settings
  3. Start a task that involves tool calls (e.g., file reading, browser actions)
  4. Verify that reasoning content is displayed and preserved throughout the conversation
  5. Check that reasoning content is properly associated with tool call responses

Checklist

  • TypeScript type checking passes
  • Linting passes
  • Tested with Moonshot provider

Get in Touch

I'd love to have a way to chat about these changes if necessary. If you're in the Kilo Code Discord, my handle is saksham25_.

Saksham-245 and others added 6 commits February 2, 2026 23:47
…roved editor reuse

Add debouncing to rapid open calls, reuse existing diff editors to prevent
visual flicker, and eliminate pre-opening files before diff commands. Changes
include: 100ms debounce on open(), tracking current open path to dedupe
concurrent calls, reordering close/show operations to avoid flash, and
skipping unnecessary file pre-open that caused content flash before diff
view appears. Also modernizes code with replaceAll and optional chaining.
Add support for Kimi-specific thinking parameter format by setting `thinking: { type: "enabled" }` when reasoning budget is enabled. Also preserve `reasoning_content` for Kimi/DeepSeek interleaved thinking in the message transformation.
…alls

Fixes reasoning parameter format and content preservation for Kimi (Moonshot)
models when tool calls are present. Changes include:
- Use Kimi's native `thinking` parameter instead of OpenAI-style `reasoning`
- Track and associate reasoning content with tool calls in stream processing
- Preserve `reasoning_content` in conversation history for Moonshot provider
@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

⚠️ No Changeset found

Latest commit: 3c095b3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kevinvandijk
Copy link
Collaborator

Hi @Saksham-245. Thanks for this PR! To maintain upstream compatibility (for now) we went with pulling in some changes from Roo upstream that are incompatible with this change since the moonshot provider is now using the the Vercel AI SDK. (see #5662 and RooCodeInc/Roo-Code#11063). This should fix reasoning properly as well so I'm closing this PR for now.

I did make sure to top up your Kilo account with some credits to thank you for the effort though! It's highly appreciated!
If you think we can still get some value out of this PR and I'm mistaken feel free to re-open it as well of course!

@Saksham-245
Copy link
Author

Thanks for the credits, @kevinvandijk That is very generous and I really appreciate the gesture.

No worries about closing the PR. I only opened it because I was running into the issue myself, so I’m actually glad to hear that the upstream changes (and the Vercel AI SDK integration) will fix it properly. Thanks for the transparency!

@Saksham-245
Copy link
Author

Hi @kevinvandijk this issue still exist in the latest update of the kilo code because now everything I say anything to Kimi it just says no tool call for just simple hi message and getting error again and again

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.

kimi k2.5 powerful only when u allow him to work with COT

2 participants