You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: LiteLLM proxy models send both temperature and top_p to Anthropic (regression in v1.15.0) #2686
After PR #2277 ("Refine temperature/top_p handling for reasoning models"), models accessed via LiteLLM proxy incorrectly send both temperature and top_p to Anthropic, causing API errors.
AnthropicException - {"type":"error","error":{"type":"invalid_request_error",
"message":"`temperature` and `top_p` cannot both be specified for this model."}}
Root Cause
PR #2277 changed the logic to preserve temperature/top_p for Gemini models:
However, supports_reasoning_effort relies on LiteLLM's get_supported_openai_params() which doesn't recognize proxy-prefixed models like prod/claude-opus-4-5-20251101 (after stripping litellm_proxy/).
Since supports_reasoning_effort returns False, the removal logic never triggers, and both parameters get sent.
Version Bisection
SDK Version
Result
v1.14.0
✅ Neither temperature nor top_p sent
v1.15.0
❌ Both sent (regression)
v1.16.1
❌ Both sent
Suggested Fix
The model pattern matching should be more robust. Options:
Check for model name patterns (e.g., claude-opus) regardless of prefix
Strip additional path components beyond litellm_proxy/ before querying LiteLLM
Always remove one of temperature/top_p if both are set for Anthropic models
replace our hardcoded recognition of reasoning models with LiteLLM’s recognition.
Though I don’t remember if both were as recent as 1.13 to 1.14
Strange thing is, we run integration tests on litellm proxy. So I don’t think the agent is right on the assumed reason… but maybe I’m wrong.
Just a thought: It might be worth verifying if the user has both temperature and top_p saved in agent_settings.json… 🤔 After the removal of default values, I’m guessing we don’t save them anymore
I've thoroughly investigated this issue and have findings that clarify both the agent's and @enyst's observations.
TL;DR
The agent identified the wrong PR. The regression was caused by PR #1990 (refactor(llm): use litellm params for reasoning support), not PR #2277.
PR #2277 only adds a Gemini exception inside the if supports_reasoning_effort: block. Since supports_reasoning_effort is False for this model, PR #2277's changes never execute.
Evidence
1. v1.14.0 vs v1.15.0+ Model Recognition
# Testing model: litellm_proxy/prod/claude-opus-4-5-20251101# v1.14.0 (substring matching against hardcoded REASONING_EFFORT_MODELS list):# "claude-opus-4-5" is a substring of the model namesupports_reasoning_effort=True# ✅# v1.15.0+ (LiteLLM function call):# After stripping "litellm_proxy/", model is "prod/claude-opus-4-5-20251101"# LiteLLM doesn't recognize "prod/..." as a valid model pathget_supported_openai_params("prod/claude-opus-4-5-20251101") → 0paramssupports_reasoning_effort=False# ❌
Since supports_reasoning_effort is False for litellm_proxy/prod/claude-opus-4-5-20251101, this entire block is skipped. PR #2277's changes are irrelevant.
@enyst correctly identified that the user has temperature=0.0 and top_p=1.0 in agent_settings.json. However, this is not the root cause — in v1.14.0, these values would still have been removed for reasoning models because the model was correctly identified via substring matching.
Investigation: How temperature: 0.0 and top_p: 1.0 Ended Up in agent_settings.json
Root Cause
The values in the user's ~/.openhands/agent_settings.json came from SDK default values that were serialized when the CLI saved the agent configuration during an older SDK version.
Timeline
Prior to SDK v1.12.0, the LLM class had these defaults:
temperature defaulted to 0.0 (set by get_default_temperature() function)
The user's stale settings file still contains temperature: 0.0 and top_p: 1.0. When loaded, these values are passed to the LLM API. For reasoning models (like Claude Opus 4.5):
Testing select_chat_options() with temperature=0.0 and top_p=1.0:
Model: litellm_proxy/prod/claude-opus-4-5-20251101
supports_reasoning_effort: False
❌ BOTH temperature and top_p present: {'top_p': 1.0, 'temperature': 0.0, 'max_completion_tokens': 4096}
--> Anthropic will reject: 'temperature and top_p cannot both be specified'
Model: anthropic/claude-opus-4-5-20251101
supports_reasoning_effort: True
✅ Neither temperature nor top_p present: {'max_completion_tokens': 4096}
Verified Fix Strategy
Stripping deployment prefixes (prod/, dev/, staging/, etc.) in addition to litellm_proxy/ fixes the issue:
After litellm_proxy/ removal: prod/claude-opus-4-5-20251101
→ 0 params, reasoning_effort=False
After deployment prefix removal: claude-opus-4-5-20251101
→ 15 params, reasoning_effort=True ✅
Summary
Both identified causes are valid:
agent_settings.json - Contains stale temperature: 0.0 and top_p: 1.0 from old SDK defaults
LiteLLM model recognition - Fails to recognize proxy-prefixed models like prod/claude-opus-4-5-20251101
A proper fix should address the model normalization in _normalized_supported_openai_params() to strip common deployment path prefixes.
This comment was created by an AI assistant (OpenHands) on behalf of the user.
a. Address the model normalization in _normalized_supported_openai_params() to strip common deployment path prefixes
b. Have the CLI detect bad matches for thinking models on startup and clean up agent_settings.json
c. Both a. and b.?
The fix is in _normalized_supported_openai_params() in model_features.py. After stripping litellm_proxy/, it needs to also strip common deployment path prefixes like prod/, dev/, staging/, etc.
Note: The issue description incorrectly blames PR #2277. The actual regression was PR #1990 which switched from substring matching to LiteLLM's get_supported_openai_params().
This comment was created by an AI assistant (OpenHands) on behalf of the user.
a. Address the model normalization in _normalized_supported_openai_params() to strip common deployment path prefixes
b. Have the CLI detect bad matches for thinking models on startup and clean up agent_settings.json
c. Both a. and b.?
Trying to understand the cause here, so it seems that (a.) implies:
litellm SDK's model recognition fails for litellm_proxy/prod/claude-opus-4-5-20251101
that is, get_supported_openai_params() returns 0 params for that
but get_supported_openai_params() returns 15 params for claude-opus-4-5-20251101
So litellm's get_supported_openai_params() works for regular models out there, 100x, 200x LLMs and providers, BUT not so well for a liteLLM Proxy installation, because then it doesn't recognize the names set by the user in the proxy
Which is obvious but also funny.
Is it possible to use canonical / canonical_model model name attribute from LLM class?
I believe we have added a "canonical" extra precisely so that users that connect to Proxies with unusual names or changed model names, can tell us (and we tell litellm) the "canonical" model used in reality.
Thanks for the suggestion @enyst! Using model_canonical_name is definitely the right approach architecturally.
Immediate fix for this PR: We should update the PR to check model_canonical_name first and use it if set, before falling back to the prefix-stripping heuristics. Currently chat_options.py uses llm.model directly instead of llm._model_name_for_capabilities() which already handles this.
For auto-discovery, we could move the heuristics into the LLM class so they're centralized. A few options:
Lazy computation in _model_name_for_capabilities() - Keep the field optional, apply heuristics in this method when model_canonical_name isn't set. Least invasive change.
Auto-set during LLM init - If model_canonical_name isn't provided, compute it from model using heuristics and store it. Makes canonical name always available.
All three keep the heuristics in the LLM class (where model configuration lives) rather than scattered in feature detection code. Users who need to override can still set model_canonical_name explicitly.
Forcing users to manually supply the canonical name is a non-starter since that would mean changes to web UI and unnecessary manual steps for the user, but I don't think you were proposing that as part of the scope for addressing this issue.
What's your preference? We can update the PR accordingly.
This comment was created by an AI assistant (OpenHands) on behalf of @jpshackelford.
I'd love to know another thing, I didn't fully understand, sorry: why "prod", where did it come from?
Workaround: Delete ~/.openhands/agent_settings.json and re-run openhands login to regenerate with current SDK defaults.
So it came from openhands login ?
I ask because a while ago, Xingyao has removed prod from proxies, I thought. Or maybe I'm wrong? Why are we setting "prod/"? If it's an openhands/ prefixed LLM, shouldn't we set
model name openhands/modelname, for which the SDK will send litellm_proxy/ I think
base url will be set by the SDK to app proxy
So there's no prod ? Could it be that the CLI still sets some 'prod/' somehow, or?
Activity
enyst commentedon Apr 2, 2026
We did two relevant things, I think:
Though I don’t remember if both were as recent as 1.13 to 1.14
Strange thing is, we run integration tests on litellm proxy. So I don’t think the agent is right on the assumed reason… but maybe I’m wrong.
Just a thought: It might be worth verifying if the user has both temperature and top_p saved in
agent_settings.json… 🤔 After the removal of default values, I’m guessing we don’t save them anymoreenyst commentedon Apr 2, 2026
To note, 2277 is extremely unlikely to have caused this. It only keeps them for Gemini 🤔
Curious what your investigation will uncover, thank you for taking at look at this!
jpshackelford commentedon Apr 3, 2026
Good catch @enyst.
Yes! The ~/.openhands/agent_settings.json file does have both temperature and top_p settings:
• "temperature": 0.0
• "top_p": 1.0
Condenser LLM settings (nested under condenser.llm):
• "temperature": 0.0
• "top_p": 1.0
Both are explicitly set in the configuration. But probably not explicitly set by the user. The user setup LLM via cli login.
jpshackelford commentedon Apr 3, 2026
Investigation Results
I've thoroughly investigated this issue and have findings that clarify both the agent's and @enyst's observations.
TL;DR
The agent identified the wrong PR. The regression was caused by PR #1990 (
refactor(llm): use litellm params for reasoning support), not PR #2277.PR #2277 only adds a Gemini exception inside the
if supports_reasoning_effort:block. Sincesupports_reasoning_effortisFalsefor this model, PR #2277's changes never execute.Evidence
1. v1.14.0 vs v1.15.0+ Model Recognition
2. LiteLLM Recognition Issue
The SDK strips
litellm_proxy/but leavesprod/, and LiteLLM doesn't recognize that as a valid model path.3. Why PR #2277 Is Not the Cause
PR #2277 changed:
Since
supports_reasoning_effortisFalseforlitellm_proxy/prod/claude-opus-4-5-20251101, this entire block is skipped. PR #2277's changes are irrelevant.@enyst's Hypothesis
@enyst correctly identified that the user has
temperature=0.0andtop_p=1.0inagent_settings.json. However, this is not the root cause — in v1.14.0, these values would still have been removed for reasoning models because the model was correctly identified via substring matching.Summary
Suggested Fix
The model normalization in
_normalized_supported_openai_params()should be smarter about stripping proxy deployment path prefixes. Options:litellm_proxy/(e.g.,prod/)This investigation was conducted by an AI assistant (OpenHands) on behalf of the user.
jpshackelford commentedon Apr 3, 2026
Investigation: How
temperature: 0.0andtop_p: 1.0Ended Up inagent_settings.jsonRoot Cause
The values in the user's
~/.openhands/agent_settings.jsoncame from SDK default values that were serialized when the CLI saved the agent configuration during an older SDK version.Timeline
Prior to SDK v1.12.0, the
LLMclass had these defaults:temperaturedefaulted to0.0(set byget_default_temperature()function)top_pdefaulted to1.0(hardcoded)PR Set default temperature to None instead of 0.0 #1989 ("Set default temperature to None instead of 0.0") changed these to
None:temperatureandtop_pnow default toNoneWhen the user ran
openhands login(or any CLI operation that callsAgentStore.save()) while using SDK v1.11.x or earlier:LLMinstance without explicitly setting temperature/top_pLLMclass applies its defaults (temperature=0.0,top_p=1.0)Agent(including LLM with defaults) viamodel_dump_json()~/.openhands/agent_settings.jsonEvidence
Verified by installing SDK 1.11.0:
Why This Causes the Bug
The user's stale settings file still contains
temperature: 0.0andtop_p: 1.0. When loaded, these values are passed to the LLM API. For reasoning models (like Claude Opus 4.5):supports_reasoning_effort=Truelitellm_proxy/prod/claude-opus-4-5-20251101, LiteLLM can't recognize themsupports_reasoning_effort=False, and the old saved values get sentSolution Options
~/.openhands/agent_settings.jsonand re-runopenhands loginto regenerate withNonedefaultssupports_reasoning_effort()checkNone-equivalent defaults from serializationThis comment was created by an AI assistant (OpenHands) on behalf of the user.
jpshackelford commentedon Apr 3, 2026
Reproduction Confirmed: LiteLLM Model Recognition Issue
I've reproduced the issue identified in the investigation comments. The root cause is confirmed:
The Problem
When using a proxy model like
litellm_proxy/prod/claude-opus-4-5-20251101:litellm_proxy/prefix →prod/claude-opus-4-5-20251101get_supported_openai_params()doesn't recognizeprod/...as a valid model pathsupports_reasoning_effort = FalseReproduction Evidence
Verified Fix Strategy
Stripping deployment prefixes (
prod/,dev/,staging/, etc.) in addition tolitellm_proxy/fixes the issue:Summary
Both identified causes are valid:
agent_settings.json- Contains staletemperature: 0.0andtop_p: 1.0from old SDK defaultsprod/claude-opus-4-5-20251101A proper fix should address the model normalization in
_normalized_supported_openai_params()to strip common deployment path prefixes.This comment was created by an AI assistant (OpenHands) on behalf of the user.
jpshackelford commentedon Apr 3, 2026
I have also confirmed that when the old agent_settings.json file is removed, and we use openhands login, the temperature and top_p values are null.
@enyst Given this analysis do we want to:
a. Address the model normalization in _normalized_supported_openai_params() to strip common deployment path prefixes
b. Have the CLI detect bad matches for thinking models on startup and clean up agent_settings.json
c. Both a. and b.?
jpshackelford commentedon Apr 3, 2026
SDK Fix Summary
The fix is in
_normalized_supported_openai_params()inmodel_features.py. After strippinglitellm_proxy/, it needs to also strip common deployment path prefixes likeprod/,dev/,staging/, etc.Current behavior:
After fix:
Implementation: Strip deployment prefixes (
prod/,dev/,staging/,test/) after strippinglitellm_proxy/.Note: The issue description incorrectly blames PR #2277. The actual regression was PR #1990 which switched from substring matching to LiteLLM's
get_supported_openai_params().This comment was created by an AI assistant (OpenHands) on behalf of the user.
fix: strip deployment prefixes from LiteLLM proxy model names
enyst commentedon Apr 3, 2026
Wow ugh thank you for the investigation. 😓
Trying to understand the cause here, so it seems that (a.) implies:
litellm_proxy/prod/claude-opus-4-5-20251101get_supported_openai_params()returns 0 params for thatget_supported_openai_params()returns 15 params forclaude-opus-4-5-20251101So litellm's
get_supported_openai_params()works for regular models out there, 100x, 200x LLMs and providers, BUT not so well for a liteLLM Proxy installation, because then it doesn't recognize the names set by the user in the proxyWhich is obvious but also funny.
Is it possible to use
canonical / canonical_modelmodel name attribute from LLM class?I believe we have added a "canonical" extra precisely so that users that connect to Proxies with unusual names or changed model names, can tell us (and we tell litellm) the "canonical" model used in reality.
jpshackelford commentedon Apr 3, 2026
Thanks for the suggestion @enyst! Using
model_canonical_nameis definitely the right approach architecturally.Immediate fix for this PR: We should update the PR to check
model_canonical_namefirst and use it if set, before falling back to the prefix-stripping heuristics. Currentlychat_options.pyusesllm.modeldirectly instead ofllm._model_name_for_capabilities()which already handles this.For auto-discovery, we could move the heuristics into the LLM class so they're centralized. A few options:
Lazy computation in
_model_name_for_capabilities()- Keep the field optional, apply heuristics in this method whenmodel_canonical_nameisn't set. Least invasive change.Auto-set during LLM init - If
model_canonical_nameisn't provided, compute it frommodelusing heuristics and store it. Makes canonical name always available.Computed property - Make
model_canonical_namea property that returns the explicit value if set, otherwise computes it. Similar to Setup Makefile, Pre-commit, and initial Tool and Schema definition #1 but different API surface.All three keep the heuristics in the LLM class (where model configuration lives) rather than scattered in feature detection code. Users who need to override can still set
model_canonical_nameexplicitly.Forcing users to manually supply the canonical name is a non-starter since that would mean changes to web UI and unnecessary manual steps for the user, but I don't think you were proposing that as part of the scope for addressing this issue.
What's your preference? We can update the PR accordingly.
This comment was created by an AI assistant (OpenHands) on behalf of @jpshackelford.
enyst commentedon Apr 3, 2026
I'd love to know another thing, I didn't fully understand, sorry: why "prod", where did it come from?
So it came from
openhands login?I ask because a while ago, Xingyao has removed
prodfrom proxies, I thought. Or maybe I'm wrong? Why are we setting "prod/"? If it's anopenhands/prefixed LLM, shouldn't we setopenhands/modelname, for which the SDK will sendlitellm_proxy/I thinkappproxySo there's no
prod? Could it be that the CLI still sets some 'prod/' somehow, or?