Skip to content

fix(kimi-coding): never send thinking{type:disabled} on the api.kimi.com/coding endpoint - #55488

Closed
Yackadaisical wants to merge 1 commit into
NousResearch:mainfrom
Yackadaisical:fix/kimi-coding-thinking-enabled
Closed

fix(kimi-coding): never send thinking{type:disabled} on the api.kimi.com/coding endpoint#55488
Yackadaisical wants to merge 1 commit into
NousResearch:mainfrom
Yackadaisical:fix/kimi-coding-thinking-enabled

Conversation

@Yackadaisical

Copy link
Copy Markdown

Problem

The Anthropic-Messages-shaped Kimi coding endpoint (api.kimi.com/coding) rejects thinking: {"type": "disabled"} with:

HTTP 400: invalid thinking: only type=enabled is allowed for this model

KimiProfile.build_api_kwargs_extras emits {"type": "disabled"} whenever a turn requests reasoning-off (reasoning_config={"enabled": False}). Any cron/agent run that disables reasoning mid-session therefore 400s intermittently — the default reasoning_effort path sends a top-level reasoning_effort instead and is unaffected, so it only fails on the disable-reasoning turns.

Observed in production on a daily cron using provider: kimi-coding + base_url: https://api.kimi.com/coding: most days errored, days that never disabled reasoning succeeded.

Fix

Detect the /coding endpoint from the resolved base_url and degrade a disable request to the only value that endpoint accepts, {"type": "enabled"} (thinking cannot be turned off there anyway). The OpenAI-compat /v1 endpoint keeps emitting disabled unchanged, so no behavior changes for Moonshot /v1 users.

Tests

Adds test_coding_endpoint_never_disables_thinking; all existing kimi-profile assertions still pass.

…com/coding endpoint

The Anthropic-Messages-shaped coding endpoint (api.kimi.com/coding) rejects
thinking {"type": "disabled"} with HTTP 400 "invalid thinking: only
type=enabled is allowed for this model". KimiProfile.build_api_kwargs_extras
emitted disabled whenever a turn requested reasoning-off, so any cron/agent
run that disabled reasoning mid-session 400'd intermittently (the default
reasoning_effort path sends reasoning_effort instead and was unaffected).

Detect the /coding endpoint via the resolved base_url and degrade a disable
request to the only legal toggle there, {"type": "enabled"}; thinking cannot
be turned off on that endpoint anyway. The OpenAI-compat /v1 endpoint keeps
emitting disabled unchanged. Adds a regression test.
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins provider/kimi Kimi / Moonshot labels Jun 30, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression report and test.

Automated hermes-sweeper review found that this behavior is already implemented on current main:

  • hermes_cli/runtime_provider.py:137-138 routes api.kimi.com/coding to anthropic_messages, rather than the Chat Completions profile path changed here.
  • agent/anthropic_adapter.py:2641-2643 suppresses the Anthropic thinking parameter for Kimi endpoints, including an explicit disabled-reasoning request.
  • tests/agent/test_kimi_coding_anthropic_thinking.py:56-67 already covers reasoning_config={"enabled": false} for https://api.kimi.com/coding and asserts that thinking is absent.
  • The behavior was shipped by 410f33a728bbe97b4853e6f411c8a1d835d7de9c (fix(kimi): don't send Anthropic thinking to api.kimi.com/coding, fix(kimi): don't send Anthropic thinking to api.kimi.com/coding #13826).

Closing as already implemented on main.

@teknium1 teknium1 closed this Jul 15, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/kimi Kimi / Moonshot sweeper:implemented-on-main Sweeper: behavior already present on current main type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants