OpenAI API 404 model_not_found: Retired Models, Allowlists & Endpoint Fixes
Key Takeaways
- Exact error payload:
404 {"error":{"message":"The model 'gpt-5' does not exist or you do not have access to it.","type":"invalid_request_error","param":null,"code":"model_not_found"}}.- Top 3 root causes: (1) Calling a retired OpenAI snapshot (
gpt-5,o3,o3-pro,gpt-5-mini,gpt-5-nanoshutting down 2026-12-11, orgpt-5-codexretired July 2026); (2) Mixing up docs slugs (gpt-6-2) with exact API IDs (gpt-6.2-sol) or hitting project/group allowlists; (3) Calling/v1/chat/completionswhen a workflow requires/v1/responses(or/v1/messages).- 1-minute fix: Query
GET /v1/modelswith your active key, update retired IDs togpt-6.2-solorgpt-6-luna, and rename legacymax_tokenstomax_completion_tokens(ormax_output_tokenson/v1/responses).
OpenAI intentionally returns the same HTTP 404 error whether a model string is misspelled, retired from the catalog, or blocked by your API key's permissions:
{
"error": {
"message": "The model 'gpt-5' does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}Use the three checks below in order to isolate the exact cause in under two minutes.
Cause 1: Retired OpenAI Model Snapshots (Urgent 2026-12-11 Wave)
The #1 trigger of sudden production model_not_found spikes in December 2026 is pinned legacy model IDs hitting scheduled OpenAI shutdown dates:
- Already retired (2026-07-23):
gpt-5-codex,gpt-5.1-codex,gpt-5.1-codex-max,gpt-5.2-codex,gpt-5-chat-latest. - Shutting down 2026-12-11:
gpt-5,gpt-5-mini,gpt-5-nano,gpt-5-pro,o3,o3-pro, and all their dated snapshots (plus fine-tunes trained on those bases). - Shutting down 2027-01-14:
gpt-4o(2024-08-06/2024-11-20),gpt-4o-mini,gpt-4.1, andgpt-4.1-mini(see GPT-4o / GPT-4.1 2027 Shutdown Calendar).
Official Replacement Matrix
| Retired / Retiring Model ID | Shutdown Date | Official Replacement ID | Required Endpoint & Parameter Adjustments |
|---|---|---|---|
gpt-5, gpt-5-2025-08-07 | 2026-12-11 | gpt-6.2-sol | /v1/responses or /v1/chat/completions; replace max_tokens |
o3, o3-2025-04-16 | 2026-12-11 | gpt-6.2-sol | Remove temperature; set reasoning.effort (low..xhigh) |
gpt-5-pro, o3-pro | 2026-12-11 | gpt-6.2-sol | Use /v1/responses with "reasoning": {"mode": "pro"} |
gpt-5-mini, gpt-5-mini-2025-08-07 | 2026-12-11 | gpt-6.1-terra | Mid-tier replacement (or gpt-6-luna / gpt-6.2-sol on gateways) |
gpt-5-nano, gpt-5-nano-2025-08-07 | 2026-12-11 | gpt-6-luna | High-throughput low-latency tier; supports effort: "none" |
gpt-5-codex / gpt-5.2-codex | 2026-07-23 (ended) | gpt-6.2-sol / gpt-6.2-astra | Use /v1/responses (wire_api = "responses" in Codex CLI) |
gpt-4o, gpt-4o-mini, gpt-4.1 | 2027-01-14 | gpt-6-luna | Audit pinned 2024-* / 2025-04-14 snapshot strings early |
Changing the Model ID Alone Can Trigger HTTP 400
When replacing gpt-5 or o3 with gpt-6.2-sol, also rename max_tokens to max_completion_tokens (or max_output_tokens on /v1/responses) and remove temperature / reasoning.effort: "none". Follow the complete 2026-12-11 GPT-5 & o3 Emergency Migration Guide and max_tokens Error Fix Guide.
Check shutdown_date Automatically via GET /v1/models
List every model your key can access — and inspect OpenAI's shutdown_date field so future deprecations fail CI instead of production:
# List active model IDs on your gateway or OpenAI key
curl -fsSL https://byesu.com/v1/models \
-H "Authorization: Bearer sk-YOUR_TOKEN" \
| jq -r '.data[].id' | sort
# Against api.openai.com: surface scheduled shutdown_date values
curl -fsSL https://api.openai.com/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY" \
| jq -r '.data[] | select(.shutdown_date != null) | "\(.shutdown_date)\t\(.id)"' | sortCause 2: Model ID Typos, Project Allowlists & Token Groups
If the model is active, model_not_found almost always comes from one of three naming or permission mismatches:
1. Documentation Slug vs. Exact API Model String (Dots vs. Hyphens)
OpenAI's GPT-6 family uses dots for minor versions plus a tier codename, whereas Anthropic's Claude 5.x family uses all hyphens:
Wrong string (returns 404) | Exact API model string | Why it failed |
|---|---|---|
gpt-6-2 or gpt-6.2 | gpt-6.2-sol or gpt-6.2-astra | gpt-6-2 is a URL slug; GPT-6.2 requires -sol or -astra tier suffix |
gpt-6.1 or gpt-6 | gpt-6.1-sol or gpt-6-luna | Bare family prefix is not a callable endpoint ID |
claude-sonnet-5.5 | claude-sonnet-5-5 | Anthropic uses hyphens (5-5), not dots (Claude 404 guide) |
" gpt-6.2-sol\n" | "gpt-6.2-sol" | Trailing newline or space from .env / Kubernetes Secret base64 encoding |
2. OpenAI sk-proj- Allowlists & Organization Usage Tiers
On direct OpenAI keys (sk-proj-...):
- Open OpenAI Dashboard → Project Settings → Limits → Model usage. If an administrator configured an explicit model allowlist for that project, newly released IDs (
gpt-6.2-sol) stay blocked with404 model_not_founduntil added to the allowlist. - Unfunded Tier-0 accounts or unverified organizations cannot access certain
proor high-compute reasoning tiers until meeting the required usage tier.
3. Custom Gateway Token Groups & base_url Shadowing
- Leftover
OPENAI_API_KEYor missingbase_url: If you passmodel="claude-sonnet-5-5"ormodel="deepseek-v4-pro"in the OpenAI SDK without settingbase_url="https://byesu.com/v1", the SDK sends your request tohttps://api.openai.com/v1, which naturally replies"The model 'claude-sonnet-5-5' does not exist". - Gateway token groups: On byesu, a default
autogroup token covers GPT, Claude (claude-sonnet-5-5), Gemini, Grok, and DeepSeek. Specialized catalogs such asglm-5.3,kimi-k3, orgpt-image-2require a token in the matching group — see Choosing a Group and No Available Channel Fixes.
Cause 3: Endpoint Path Mismatch (/v1/responses vs. /v1/chat/completions vs. /v1/messages)
Modern frontier models split features across three distinct wire protocols. Sending a model or mode to the wrong path produces either 404 Not Found (path error) or 404 model_not_found / 400:
| Wire Protocol & Path | Base URL in SDK / Tool | When Required |
|---|---|---|
OpenAI Responses API (POST /v1/responses) | https://byesu.com/v1 | Required for gpt-6.2-sol with reasoning: {"mode": "pro"} (replacing o3-pro / gpt-5-pro), stateful/stateless agent items, and Codex CLI (wire_api = "responses") |
OpenAI Chat Completions (POST /v1/chat/completions) | https://byesu.com/v1 | Standard multi-provider chat & tool calling in Cursor, LangChain, and OpenAI SDKs |
Anthropic Messages API (POST /v1/messages) | https://byesu.com (no /v1) | Native Claude extended/adaptive thinking and Claude Code CLI (claude-* models only) |
Safe Python Verification Against /v1/responses
from openai import OpenAI
client = OpenAI(
api_key="sk-YOUR_TOKEN",
base_url="https://byesu.com/v1",
)
resp = client.responses.create(
model="gpt-6.2-sol",
reasoning={"effort": "medium"},
max_output_tokens=2048,
input="Confirm active model routing in one sentence.",
)
print(resp.output_text)5-Second Gateway Diagnostic Test
Run the one-line smoke test to verify gateway reachability, token validity, and both /v1/chat/completions + /v1/messages endpoints in 5 seconds:
curl -fsSL https://docs.byesu.com/setup/test.sh | sh
# Or pass your token directly:
curl -fsSL https://docs.byesu.com/setup/test.sh | bash -s -- sk-YOUR_TOKENNeed exact client config blocks with verified model IDs? Open the AI Client & SDK Config Generator.
FAQ
Why am I getting The model 'gpt-5' or 'o3' does not exist or you do not have access to it?
OpenAI retires gpt-5 (gpt-5-2025-08-07), gpt-5-mini, gpt-5-nano, gpt-5-pro, o3 (o3-2025-04-16), and o3-pro on December 11, 2026 (following the July 23, 2026 retirement of gpt-5-codex snapshots). Replace gpt-5 and o3 with gpt-6.2-sol, gpt-5-mini with gpt-6.1-terra, and gpt-5-nano with gpt-6-luna.
What is the exact API model ID for GPT-6.2?
Use gpt-6.2-sol or gpt-6.2-astra (with a dot in 6.2 and a hyphen before the tier codename). Do not pass documentation URL slugs like gpt-6-2 or bare family names like gpt-6.2, which are not valid API model identifiers.
Why does a valid OpenAI model still return model_not_found with an sk-proj- key?
OpenAI returns the exact same 404 model_not_found message for permission blocks as for typos. Check Project Settings → Limits → Model usage in the OpenAI dashboard to verify your sk-proj- key's project allowlist includes the model, or check your token group if calling through an API gateway.
Do o3-pro and gpt-5-pro replacements work on /v1/chat/completions?
OpenAI maps o3-pro and gpt-5-pro to gpt-6.2-sol with reasoning.mode set to "pro" on the /v1/responses endpoint. Calling pro-mode parameters or Responses-only snapshots against /v1/chat/completions fails validation or returns 404.
How can I check upcoming OpenAI model shutdown dates automatically?
Query GET /v1/models and inspect the optional shutdown_date (YYYY-MM-DD) field on each model object. Any model you depend on with a non-null shutdown_date should trigger an alert or CI failure well before cutover.