Summary
When using Kimi Code through an OpenAI-compatible provider in OpenClaw, a normal single-turn response can succeed, but enabling thinking for an agent turn that uses tools fails during tool-call replay.
The provider rejects the follow-up request with:
400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 2
This looks like the OpenAI-compatible replay path is not preserving or reconstructing the assistant reasoning_content required by Kimi Code when thinking is enabled and tool calls are replayed.
Environment
- OpenClaw version:
2026.6.1
- Gateway version:
2026.6.1
- Provider id:
moonshot-code
- Model id:
kimi-for-coding
- API style:
openai-completions
- Base URL:
https://api.kimi.com/coding/v1
- Current workaround: keep Kimi Code thinking disabled and use it as a late fallback.
Current working model config workaround:
{
"id": "kimi-for-coding",
"name": "Kimi Code (for coding)",
"api": "openai-completions",
"reasoning": false,
"compat": {
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}
}
Agent model params workaround:
{
"max_tokens": 65536,
"thinking": false
}
Reproduction
- Configure Kimi Code as an OpenAI-compatible provider with reasoning enabled:
{
"models": {
"providers": {
"moonshot-code": {
"baseUrl": "https://api.kimi.com/coding/v1",
"apiKey": "${KIMI_API_KEY}",
"api": "openai-completions",
"models": [
{
"id": "kimi-for-coding",
"name": "Kimi Code (for coding)",
"input": ["text", "image"],
"reasoning": true,
"contextWindow": 131072,
"maxTokens": 65536,
"compat": {
"supportsReasoningEffort": true,
"maxTokensField": "max_tokens"
},
"api": "openai-completions"
}
]
}
}
}
}
- Run a simple thinking-enabled turn:
openclaw agent \
--model moonshot-code/kimi-for-coding \
--thinking high \
--session-key agent:codex:kimi-thinking-simple \
--message 'Test Kimi Code thinking high. Reply only KIMI_THINK_SIMPLE_OK_9.' \
--json
This succeeds.
- Run a thinking-enabled tool turn:
openclaw agent \
--model moonshot-code/kimi-for-coding \
--thinking high \
--session-key agent:codex:kimi-thinking-tool \
--message 'You must call exec to run: printf KIMI_TOOL_OK. Then reply only FINAL_KIMI_TOOL_OK.' \
--json
Actual result
The run fails with:
GatewayClientRequestError: FailoverError: LLM request failed: provider rejected the request schema or tool payload.
Gateway logs show the provider error:
400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 2
Relevant diagnostic fields:
{
"provider": "moonshot-code",
"model": "kimi-for-coding",
"failoverReason": "format",
"providerRuntimeFailureKind": "schema",
"rawErrorPreview": "400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 2"
}
Expected result
OpenClaw should either:
- Preserve and replay Kimi Code
reasoning_content correctly for assistant messages that contain tool calls, or
- Automatically disable thinking for Kimi Code tool-using sessions when the provider requires
reasoning_content replay that OpenClaw cannot satisfy, or
- Expose a provider compat flag similar to existing reasoning replay controls so Kimi Code can be configured safely.
Workaround
Keep Kimi Code configured with thinking disabled and use it only as a fallback:
{
"reasoning": false,
"compat": {
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}
}
Agent params:
{
"max_tokens": 65536,
"thinking": false
}
This avoids the replay failure, but prevents thinking-enabled Kimi Code tool use.
Additional notes
I tested Qwen3.7 Plus with OpenClaw compat.thinkingFormat: "qwen" under the same style of tool-call replay test. Qwen completed the tool turn and a follow-up turn successfully. So this appears to be specific to Kimi Code / Moonshot-style reasoning_content replay behavior rather than all OpenAI-compatible thinking providers.
Summary
When using Kimi Code through an OpenAI-compatible provider in OpenClaw, a normal single-turn response can succeed, but enabling thinking for an agent turn that uses tools fails during tool-call replay.
The provider rejects the follow-up request with:
This looks like the OpenAI-compatible replay path is not preserving or reconstructing the assistant
reasoning_contentrequired by Kimi Code when thinking is enabled and tool calls are replayed.Environment
2026.6.12026.6.1moonshot-codekimi-for-codingopenai-completionshttps://api.kimi.com/coding/v1Current working model config workaround:
{ "id": "kimi-for-coding", "name": "Kimi Code (for coding)", "api": "openai-completions", "reasoning": false, "compat": { "supportsReasoningEffort": false, "maxTokensField": "max_tokens" } }Agent model params workaround:
{ "max_tokens": 65536, "thinking": false }Reproduction
{ "models": { "providers": { "moonshot-code": { "baseUrl": "https://api.kimi.com/coding/v1", "apiKey": "${KIMI_API_KEY}", "api": "openai-completions", "models": [ { "id": "kimi-for-coding", "name": "Kimi Code (for coding)", "input": ["text", "image"], "reasoning": true, "contextWindow": 131072, "maxTokens": 65536, "compat": { "supportsReasoningEffort": true, "maxTokensField": "max_tokens" }, "api": "openai-completions" } ] } } } }openclaw agent \ --model moonshot-code/kimi-for-coding \ --thinking high \ --session-key agent:codex:kimi-thinking-simple \ --message 'Test Kimi Code thinking high. Reply only KIMI_THINK_SIMPLE_OK_9.' \ --jsonThis succeeds.
openclaw agent \ --model moonshot-code/kimi-for-coding \ --thinking high \ --session-key agent:codex:kimi-thinking-tool \ --message 'You must call exec to run: printf KIMI_TOOL_OK. Then reply only FINAL_KIMI_TOOL_OK.' \ --jsonActual result
The run fails with:
Gateway logs show the provider error:
Relevant diagnostic fields:
{ "provider": "moonshot-code", "model": "kimi-for-coding", "failoverReason": "format", "providerRuntimeFailureKind": "schema", "rawErrorPreview": "400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 2" }Expected result
OpenClaw should either:
reasoning_contentcorrectly for assistant messages that contain tool calls, orreasoning_contentreplay that OpenClaw cannot satisfy, orWorkaround
Keep Kimi Code configured with thinking disabled and use it only as a fallback:
{ "reasoning": false, "compat": { "supportsReasoningEffort": false, "maxTokensField": "max_tokens" } }Agent params:
{ "max_tokens": 65536, "thinking": false }This avoids the replay failure, but prevents thinking-enabled Kimi Code tool use.
Additional notes
I tested Qwen3.7 Plus with OpenClaw
compat.thinkingFormat: "qwen"under the same style of tool-call replay test. Qwen completed the tool turn and a follow-up turn successfully. So this appears to be specific to Kimi Code / Moonshot-stylereasoning_contentreplay behavior rather than all OpenAI-compatible thinking providers.