Repository navigation
Kimi for Coding (k2p5) fails with tool calls when thinking enabled: reasoning_content is missing in assistant tool call message #10996
Copy link
Copy link
Closed
Labels
Description
Description
Environment
- OpenCode: v1.1.39
- OS: Windows (running via WSL2 Ubuntu 22.04)
- Provider: kimi-for-coding (via opencode auth login)
- Model: k2p5 (Kimi K2.5)
- API endpoint (from logs): https://api.kimi.com/coding/v1/messages
Problem
When using Kimi for Coding with thinking enabled, any session that triggers tool calls (e.g. Grep/Read) fails with HTTP 400.
Actual
OpenCode errors:
error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 101
Sometimes the index changes as the conversation grows, e.g.:
... missing in assistant tool call message at index 104
Expected
Tool calls should work while thinking is enabled, or OpenCode should disable thinking / handle reasoning_content correctly for tool call messages (or provide a documented toggle/workaround).
Reproduction steps
- opencode auth login → choose Kimi for Coding
- Start a session using model k2p5 (Kimi K2.5)
- Ask the agent to do something that triggers tools, e.g. “grep X in file Y” / “read file”
- Observe error 400 above.
Logs (excerpt)
From ~/.local/share/opencode/log/.log:
- Request:
- url=https://api.kimi.com/coding/v1/messages
- model=k2p5
- thinking={"type":"enabled","budget_tokens":31999}
- Response:
- 400 thinking is enabled but reasoning_content is missing in assistant tool call message at index ...
Notes / workaround
Disabling thinking (thinking: disabled) avoids the crash, but removes visible “thinking”.
- 400 thinking is enabled but reasoning_content is missing in assistant tool call message at index ...
version'."},"query":{"type":"string","description":"The question or task you need help with. Be specific and include relevant details. Good: 'How to set up authentication with JWT in Express.js' or 'React useEffect cleanup function examples'. Bad: 'auth' or 'hooks'. IMPORTANT: Do not include any sensitive or confidential information such as API keys, passwords, credentials, or personal data in your query."}},"required":["libraryId","query"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}],"tool_choice":{"type":"auto"},"stream":true},"statusCode":400,"responseHeaders":{"cf-cache-status":"DYNAMIC","cf-ray":"9c503405bf4c1f6e-SIN","connection":"keep-alive","content-length":"200","content-type":"application/json; charset=utf-8","date":"Wed, 28 Jan 2026 11:38:23 GMT","server":"cloudflare","strict-transport-security":"max-age=31536000; includeSubDomains"},"responseBody":"{\"error\":{\"type\":\"invalid_request_error\",\"message\":\"error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 101\"},\"type\":\"error\"}","isRetryable":false,"data":{"type":"error","error":{"type":"invalid_request_error","message":"error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 101"}}}} stream error
ERROR 2026-01-28T11:38:22 +3ms service=session.processor error=error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 101 stack="AI_APICallError: error, status code: 400, message: thinking is enabled but reasoning_content is missing in assistant tool call message at index 101\n at <anonymous> (../../node_modules/.bun/@ai-sdk+provider-utils@3.0.20+d6123d32214422cb/node_modules/@ai-sdk/provider-utils/dist/index.mjs:936:18)\n at processTicksAndRejections (native:7:39)" process
INFO 2026-01-28T11:38:22 +0ms service=bus type=session.error publishing
INFO 2026-01-28T11:38:22 +2ms service=bus type=message.updated publishing
Plugins
dcp, auth antigravity
OpenCode version
v1.1.39
Steps to reproduce
- Run
opencode auth loginand select Kimi for Coding - Start a new session using model k2p5
- Ask the agent to perform an action that triggers tool calls, e.g.:
- “Grep
subject_anchorinwindows-app/story_presets.json”
- “Grep
- Observe the request fails with HTTP 400:
thinking is enabled but reasoning_content is missing in assistant tool call message at index ...
Workaround
If thinking is disabled, tool calls work.
Screenshot and/or share link
Operating System
windows 11 pro, but i use WSL full opencode
Terminal
wezterm
Reactions are currently unavailable
Activity
github-actions commentedon Jan 28, 2026
This issue might be a duplicate of existing issues. Please check:
reasoning_contentfield in assistant tool call messages - same root cause with different providerreasoning_content#4947: DeepSeek 3.2 missingreasoning_content- similar historical issueThis appears to be a regression affecting multiple providers (Kimi, DeepSeek, Claude) when thinking/reasoning is enabled and tool calls are attempted. Previous issues suggest this was fixed before but the solution may have been reverted.
Feel free to ignore if this is a distinct case from the above.
taxilian commentedon Jan 28, 2026
I'm seeing the same thing, seems likely to be a setting we need to tweak
rekram1-node commentedon Jan 29, 2026
Hm it should be using the anthropic messages endpoint, not openai, reasoning_content makes it seem like it's using the openai one?
willy-scr commentedon Jan 29, 2026
This issue was resolved because of the dcp plugin.
This issue was resolved because of the dcp plugin.
willy-scr commentedon Jan 29, 2026
im will close this issue, thnk u so much @rekram1-node
zero-zrc0 commentedon Feb 6, 2026
I ran into this problem too. Could you please tell me how was it resolved afterwards?I tried using anthropic messages endpoint but it didnt work.
Clausinho commentedon Feb 11, 2026
I am using https://github.com/Opencode-DCP/opencode-dynamic-context-pruning that @willy-scr recommended but I agree with @zero-zrc0
Using this DCP plugin seems more like a workaround instead of actually fixing the provider. Unless it means we need a LiteLLM Proxy to properly seperate thinking tags and tool calls.
jackjoliet commentedon Feb 11, 2026
Might be a different stack, but I was facing the same issue with ai-sdk. Here's what solved it for me
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…
fix: add KIMI_THINKING_DISABLED env var + revert reasoning_content pa…
fix: always include reasoning_content on assistant messages for proxy…