File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,6 +558,17 @@ def __init__(
558558 "LiteLLM is not installed. Please install it with: uv pip install litellm"
559559 )
560560
561+ # The Codex ChatGPT backend is a Responses API endpoint at
562+ # chatgpt.com/backend-api/codex/responses. LiteLLM's model registry
563+ # marks legacy codex models (gpt-5.3-codex) with mode="responses",
564+ # but newer models like gpt-5.4 default to mode="chat". Force
565+ # mode="responses" so litellm routes through the responses_api_bridge.
566+ if self ._codex_backend and litellm is not None :
567+ _strip = self .model .removeprefix ("openai/" )
568+ _entry = litellm .model_cost .get (_strip , {})
569+ if _entry .get ("mode" ) != "responses" :
570+ litellm .model_cost .setdefault (_strip , {})
571+ litellm .model_cost [_strip ]["mode" ] = "responses"
561572 @staticmethod
562573 def _default_api_base_for_model (model : str ) -> str | None :
563574 """Return provider-specific default API base when required."""
You can’t perform that action at this time.
0 commit comments