fix(openai): resolve capability lookups for responses/ prefix models

Strip the `responses/` prefix in `_supports_factory()` before looking
up model capabilities in the cost map, so that
`supports_tool_choice("openai/responses/gpt-5.4")` correctly resolves
to the base `gpt-5.4` entry instead of returning False.

Fixes #23423
This commit is contained in:
Chesars 2026-03-13 23:48:07 -03:00
parent c0da671f16
commit aa7a6f57fc
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():
"""