Claus Ibsen created CAMEL-26962:
-----------------------------------
Summary: camel-jbang - The AI clients send temperature to Claude,
which the current Claude models reject
Key: CAMEL-26962
URL: https://issues.apache.org/jira/browse/CAMEL-26962
Project: Camel
Issue Type: Bug
Components: camel-jbang
Reporter: Claus Ibsen
Assignee: Claus Ibsen
Fix For: 4.24.0
The AI clients of the Camel CLI (camel ask, the AI panel, camel explain and the
AI overview) call the Anthropic API through {{LlmClient}}. Every request it
sends has {{temperature}}: {{chatAnthropicFormat}} puts it in the body, and the
AI panel and camel ask set 0.3. The Claude API rejects that for the current
models:
* Claude Opus 5.5 ({{claude-opus-5-5}}) rejects {{temperature}}, {{top_p}} and
{{top_k}} with a 400.
* Claude Sonnet 5.5 ({{claude-sonnet-5-5}}) rejects a non-default value with a
400.
* From API version {{2026-10-21}}, a request with {{temperature}} is a 400 on
every model, even at the default value. {{LlmClient}} sends
{{anthropic-version: 2023-06-01}} today.
So a user who picks a current Claude model, with {{camel.tui.ai.model}} or in
camel ask, gets an error. The default model of {{LlmClient}} is
{{claude-sonnet-4-6}}, which still accepts it.
Found while planning a benchmark that asks the same questions of a local model
and of Claude in the AI panel. Not tested against the API (there is no key on
the test machine): the rules above are from the Claude API documentation.
*Proposal*
* Do not send {{temperature}}, {{top_p}} or {{top_k}} to Anthropic. Keep them
for the other providers.
* Use a current model as the default for Anthropic, for example
{{claude-opus-5-5}}.
* Turn on prompt caching with a top-level {{"cache_control": {"type":
"ephemeral"}}} on the request. The AI panel already keeps its prompt prefix the
same from question to question (for the cache of a local server), so the tools,
the system prompt and the history would come from the cache. Today every
request pays the full input price for all of it. {{LlmClient}} already reads
{{cache_read_input_tokens}}, so the effect shows in the usage.
*To check while doing this*
* The current models think by default (Claude Opus 5.5 always does). The tool
loop rebuilds each assistant message from its text and tool calls, so the
thinking blocks are not sent back. The documentation says to send them back
unchanged, and that leaving them out can give a 400 in a tool loop.
* If the thinking blocks are sent back, compacting the history becomes an edit.
For accounts created on or after Aug 31 2026, the API checks that everything
before a thinking block is unchanged, and rejects an edited history with a 400.
The AI panel compacts the history of a hosted model a little every turn.
* A move to API version 2026-10-21 needs the {{temperature}} change first:
https://platform.claude.com/docs/en/api/migration-2026-10-21
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)