Anthropic: current Claude models reject every request (temperature, prefill)
Found while testing LLM provider integrations in agent frameworks: an automated tool flags candidates and each one is reproduced before it is reported. Reproduced on 39e2411 against a local endpoint that returns the errors in Anthropic's docs, not against the real API.
claude-3-5-sonnet-20241022, the model in configs/examples/mirix_claude.yaml and the docs, was retired in October 2025, and Anthropic names claude-sonnet-5-5 as its replacement. Changing only the model in that config gives a request Anthropic refuses:
config = LLMConfig(model="claude-sonnet-5-5", model_endpoint_type="anthropic", context_window=200000)
data = await LLMClient.create(config).build_request_data(messages, config, tools)
print(data["temperature"], data["messages"][-1])
# 0.7 {'role': 'assistant', 'content': '<thinking>'}
What happens
Both values are 400s on this model. Anthropic's thinking page says "non-default temperature, top_p, or top_k values return a 400 error on every request, regardless of whether thinking is used" for Opus 4.7 and later, Sonnet 5 and 5.5 and Haiku 5.5. Claude 4.6 and later also reject a final assistant turn: This model does not support assistant message prefill. The conversation must end with a user message. temperature defaults to 0.7 and the prefill is added whenever put_inner_thoughts_in_kwargs is unset, so the default settings fail on every request.
The config options do not get around it on Sonnet 5.5. temperature: 1 leaves the prefill. put_inner_thoughts_in_kwargs: true drops the prefill but sends tool_choice: {"type": "any"}, which Sonnet 5.5 and Opus 5.5 reject, along with the {"type": "tool"} that force_tool_call sends. enable_reasoner: true sends thinking: {"type": "enabled"}, rejected on 4.7 and later.
I expected a current Claude model to work with the Anthropic setup from the docs. Older ids still pass for now, such as claude-opus-4-6, or claude-sonnet-4-5-20250929 until it retires on November 30.
Cause
AnthropicClient.build_request_data has no per-model handling: it always sets temperature and skips the prefill only for names containing "opus". The anthropic<1.0 pin keeps the SDK accepting temperature, but the API still refuses it.
Fix idea
Parse the version from the model id. On 4.7 and later omit temperature and send thinking: {"type": "adaptive"}, on 4.6 and later skip the prefill, and fall back to tool_choice auto on the models that reject forced tool use. Older and unknown ids keep today's body, so claude-stub in test_llm_sdk_compat.py is unaffected.
Thanks for the detailed reproduction. Fixed in https://github.com/Mirix-AI/MIRIX/pull/148, now merged into main.
The Anthropic request builder now handles Claude model versions: it skips assistant prefill on 4.6+, omits sampling parameters on 4.7+, uses adaptive thinking when reasoning is enabled on those newer models, and falls back to tool_choice: auto on models that reject forced tool use. For an explicit force_tool_call, the fallback offers only that tool; auto still lets the model choose whether to call it. Older and unknown model IDs retain their existing behavior. The Claude example now uses claude-sonnet-5-5.
Validation: 77 SDK compatibility tests passed, including 65 model/settings combinations sent through the installed Anthropic SDK to a local endpoint. These are offline checks, not calls to the live Anthropic API. Please pull the latest main and retry your configuration.