Fix Claude models routing to Responses API causing not_found_error (fixes #1369)

resolve_api_type() was checking LiteLLM catalog for /v1/responses support
but falling through to 'responses' for unknown/new models. Models routed
through LiteLLM (non-OpenAI providers like anthropic/*) must always use
chat_completions since /v1/responses is OpenAI-specific. Add an explicit
routes_through_litellm() check before the catalog lookup.
This commit is contained in:
dajiaohuang 2026-10-07 14:48:20 +08:00
parent f1386cad37
commit 2bddfcbd93

View file

@ -668,10 +668,13 @@ def resolve_api_type(model_name: str, settings: Settings) -> ApiType:
An explicit ``STRIX_API_TYPE`` wins. Otherwise the model decides: Responses
when LiteLLM's catalog lists ``/v1/responses`` for it, chat completions for
everything else.
everything else. Models routed through LiteLLM (non-OpenAI providers) always
use chat completions because the Responses endpoint is OpenAI-specific.
"""
if settings.llm.api_type is not None:
return settings.llm.api_type
if routes_through_litellm(model_name):
return "chat_completions"
if _RESPONSES_ENDPOINT in _catalog_supported_endpoints(model_name):
return "responses"
return "chat_completions"