Title
custom Kimi-compatible endpoint with api_mode=anthropic_messages fails after tool call when thinking is enabled
Summary
When Hermes is configured with:
model:
default: kimi-2.6
provider: custom
base_url: http://<custom-endpoint>
api_mode: anthropic_messages
agent:
reasoning_effort: medium
the next request after a tool call can fail with:
HTTP 400: thinking is enabled but reasoning_content is missing in assistant tool call message at index 2
Reproduction
- Use a custom Kimi-compatible endpoint with
api_mode: anthropic_messages.
- Enable reasoning, for example
agent.reasoning_effort: medium.
- Trigger any tool call.
- Let Hermes continue to the next model request.
Observed behavior
Hermes sends Anthropic-style thinking, but prior assistant tool-call history does not include reasoning_content, so the upstream endpoint rejects the request.
Example request shape:
{
"messages": [
{ "role": "user", "content": "..." },
{
"role": "assistant",
"content": [
{ "type": "tool_use", "name": "skill_view", "id": "..." }
]
},
{
"role": "user",
"content": [
{ "type": "tool_result", "tool_use_id": "...", "content": "..." }
]
}
],
"thinking": { "type": "enabled", "budget_tokens": 8000 }
}
Relevant code
There is already a regression test for this failure mode on official Kimi endpoints:
tests/agent/test_kimi_coding_anthropic_thinking.py
And the current special-case appears to be URL-specific in:
agent/anthropic_adapter.py
Problem
The current guard seems to only match official Kimi URLs such as https://api.kimi.com/coding....
It does not cover custom or proxied Kimi-compatible endpoints, even when they have the same behavior and reject Anthropic thinking unless assistant tool-call history includes reasoning_content.
Expected behavior
Hermes should suppress Anthropic thinking for Kimi-compatible custom endpoints as well, not only for the official Kimi URL pattern.
Suggested fix
Broaden the current Kimi special-case beyond strict URL matching. For example:
- detect Kimi-compatible custom endpoints by model family plus
api_mode=anthropic_messages
- or use capability-based detection instead of hostname-only detection
Title
custom Kimi-compatible endpoint with api_mode=anthropic_messages fails after tool call when thinking is enabledSummary
When Hermes is configured with:
the next request after a tool call can fail with:
Reproduction
api_mode: anthropic_messages.agent.reasoning_effort: medium.Observed behavior
Hermes sends Anthropic-style
thinking, but prior assistant tool-call history does not includereasoning_content, so the upstream endpoint rejects the request.Example request shape:
{ "messages": [ { "role": "user", "content": "..." }, { "role": "assistant", "content": [ { "type": "tool_use", "name": "skill_view", "id": "..." } ] }, { "role": "user", "content": [ { "type": "tool_result", "tool_use_id": "...", "content": "..." } ] } ], "thinking": { "type": "enabled", "budget_tokens": 8000 } }Relevant code
There is already a regression test for this failure mode on official Kimi endpoints:
tests/agent/test_kimi_coding_anthropic_thinking.pyAnd the current special-case appears to be URL-specific in:
agent/anthropic_adapter.pyProblem
The current guard seems to only match official Kimi URLs such as
https://api.kimi.com/coding....It does not cover custom or proxied Kimi-compatible endpoints, even when they have the same behavior and reject Anthropic
thinkingunless assistant tool-call history includesreasoning_content.Expected behavior
Hermes should suppress Anthropic
thinkingfor Kimi-compatible custom endpoints as well, not only for the official Kimi URL pattern.Suggested fix
Broaden the current Kimi special-case beyond strict URL matching. For example:
api_mode=anthropic_messages