Merge pull request #23604 from Chesars/fix/responses-prefix-tool-choice

fix(openai): resolve capability lookups for responses/ prefix models
This commit is contained in:
Cesar Garcia 2026-03-14 00:33:51 -03:00 committed by GitHub
commit d78adaf7d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -2538,6 +2538,12 @@ def _supports_factory(model: str, custom_llm_provider: Optional[str], key: str)
model=model, custom_llm_provider=custom_llm_provider
)
# Strip responses/ prefix so capability lookups resolve to the
# base model entry in the cost map (e.g. "gpt-5.4" not
# "responses/gpt-5.4"). See #23423.
if model.startswith("responses/"):
model = model[len("responses/"):]
model_info = _get_model_info_helper(
model=model, custom_llm_provider=custom_llm_provider
)

View file

@ -998,6 +998,10 @@ def test_supports_tool_choice_simple_tests():
assert litellm.utils.supports_tool_choice(model="perplexity/sonar") is False
# Responses API prefix must resolve to base model. See #23423.
assert litellm.utils.supports_tool_choice(model="openai/responses/gpt-5.4") is True
assert litellm.utils.supports_tool_choice(model="responses/gpt-5.4", custom_llm_provider="openai") is True
def test_check_provider_match():
"""