Skip to content

fix(chatgpt): map gpt-5.4-mini to responses - #32291

Open
itsreverence wants to merge 1 commit into
BerriAI:mainfrom
itsreverence:litellm_chatgpt_gpt54_mini_model_map
Open

itsreverence wants to merge 1 commit into
BerriAI:mainfrom
itsreverence:litellm_chatgpt_gpt54_mini_model_map

Conversation

@itsreverence

@itsreverence itsreverence commented Jul 6, 2026 •

Copy link
Copy Markdown

Relevant issues

Partially addresses #25954

Related but separate: #28044 covers DB-registered ChatGPT response-mode models skipping the ChatGPT Responses config path

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks run locally
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review)

Screenshots / Proof of Fix

Reproduction before this model map entry, using current LiteLLM with ChatGPT OAuth:

python - <<'PY'
import litellm
litellm.completion(
    model="chatgpt/gpt-5.4-mini",
    messages=[{"role":"user","content":"Reply exactly: ok"}],
    stream=True,
    max_tokens=20,
)
PY

LiteLLM routes the unmapped model through /backend-api/codex/chat/completions, which returns a Cloudflare HTML challenge instead of the Codex Responses API SSE stream

The same account and token succeeds when calling the Codex Responses API directly with model: gpt-5.4-mini; the model catalog endpoint lists gpt-5.4-mini with supported_in_api: true, context_window: 272000, and max_context_window: 272000

Local verification from this branch:

LITELLM_LOCAL_MODEL_COST_MAP=True uv run --extra proxy python - <<'PY'
import litellm
print(litellm.model_cost["chatgpt/gpt-5.4-mini"]["mode"])
r = litellm.completion(
    model="chatgpt/gpt-5.4-mini",
    messages=[{"role":"user","content":"Reply exactly: ok"}],
    stream=True,
    max_tokens=20,
)
print("".join(chunk.choices[0].delta.content or "" for chunk in r))
PY

Output:

responses
ok

Also validated JSON syntax, added cost-map and bridge regression coverage for root and bundled backup maps, ran uv run --with pytest python -m pytest tests/test_litellm/test_chatgpt_model_config.py -q, and ran make pre-commit

Type

Bug Fix
Test

Changes

Adds the missing chatgpt/gpt-5.4-mini model-cost entry and marks it as a Responses API model for the ChatGPT provider, matching the existing ChatGPT provider routing pattern while using the Codex model catalog's 272k input context value

Adds the same entry to the bundled backup map so local fallback mode resolves the model consistently

Adds focused regression coverage that checks the root and bundled backup entries stay in sync for provider, mode, limits, endpoints, and capabilities, plus a bridge-path assertion that chat completions for the model are treated as Responses API calls

@CLAassistant

CLAassistant commented Jul 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the missing chatgpt/gpt-5.4-mini entry to both the root and bundled backup cost maps, with mode: "responses" to route through the Codex Responses API instead of the broken /backend-api/codex/chat/completions path. The 272k max_input_tokens matches the model's catalog spec.

  • Model entry added to both model_prices_and_context_window.json and the backup, with endpoints, capability flags, and context limits matching the Codex model catalog.
  • New test file verifies both maps stay in sync on all fields, and that responses_api_bridge_check correctly identifies the model as a Responses-mode model, with no real network calls.

Confidence Score: 5/5

Safe to merge — the change is confined to two JSON data files and one new test file with no production code modifications.

The JSON entries are well-formed, structurally consistent with every adjacent chatgpt/* model, and cross-verified between root and backup files. The 272k input-token limit correctly differs from gpt-5.4's 1,050k limit and aligns with the model catalog cited in the PR. The new test file exercises both data files and the bridge function using monkeypatching only — no network calls — and the TypeAlias import is valid under the project's >=3.10 Python requirement. No routing logic, handler code, or existing tests were modified.

No files require special attention.

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds chatgpt/gpt-5.4-mini entry with 272k input tokens, 128k output, mode responses, and both /v1/chat/completions and /v1/responses endpoints, matching the established pattern of chatgpt/gpt-5.4.
litellm/model_prices_and_context_window_backup.json Identical chatgpt/gpt-5.4-mini entry added to the bundled backup map, keeping local fallback mode consistent with the root map.
tests/test_litellm/test_chatgpt_model_config.py New test file with two test functions: a parametrized sync test asserting both root and backup maps have the correct entry, and a monkeypatched bridge test verifying responses_api_bridge_check returns mode responses for this model. No real network calls.

Reviews (3): Last reviewed commit: "fix(chatgpt): map gpt-5.4-mini to respon..." | Re-trigger Greptile

Comment thread model_prices_and_context_window.json Resolved
@itsreverence
itsreverence marked this pull request as draft July 6, 2026 23:02
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@itsreverence
itsreverence force-pushed the litellm_chatgpt_gpt54_mini_model_map branch from de100f2 to e766f7a Compare July 6, 2026 23:08
@itsreverence
itsreverence force-pushed the litellm_chatgpt_gpt54_mini_model_map branch from e766f7a to 97ae9ad Compare July 6, 2026 23:16
@itsreverence

Copy link
Copy Markdown
Author

Addressed the Greptile token-limit note in the latest commit.

The initial entry copied the full chatgpt/gpt-5.4 limits, but the live Codex model catalog for gpt-5.4-mini reports context_window: 272000 and max_context_window: 272000, so the model-map entry now uses max_input_tokens: 272000 while retaining the existing GPT-5.x ChatGPT output limit pattern (max_output_tokens / max_tokens: 128000).

Also moved the entry into the existing ChatGPT model block, added the same metadata to the bundled backup model map, and added regression coverage for both map consistency and the Responses bridge path.

Local verification:

uv run --with pytest python -m pytest tests/test_litellm/test_chatgpt_model_config.py -q
# 3 passed

make pre-commit
# passed

@greptileai please re-review the latest commit.

@itsreverence

Copy link
Copy Markdown
Author

Thanks for picking this back up and requesting review. Before you spend more time on it, I rechecked gpt-5.4-mini through ChatGPT-authenticated Codex. It’s absent from the account’s live model catalog, and an explicitly selected request fails with HTTP 400: “The 'gpt-5.4-mini' model is not supported when using Codex with a ChatGPT account.”

That matches OpenAI’s retirement notice for this access path. API-key access is unaffected, but this PR specifically adds the chatgpt/ registration needed for Responses routing. #31884 added the recommended replacement, GPT-5.6 Luna, without including this fix.

Given that result, I think we can close this unless there’s a remaining compatibility reason to keep the registration. Would you prefer that?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants