Getting The model 'X' does not exist or you do not have access to it? Check, in order:
- The exact model name — typos, wrong version date, or a renamed/retired model. List models to see what’s actually available.
- Whether your account/project has access — some models need org verification or a paid account.
- The right endpoint — calling a chat model on
/completions, or an embeddings model on/chat/completions, throws this too.
OpenAI returns an HTTP 404 with code model_not_found when the model string in your request doesn’t resolve to something your account can call. The message is deliberately ambiguous — “does not exist or you do not have access” — because OpenAI won’t reveal whether a model exists to accounts that can’t use it. So the fix is a short checklist: confirm the name, your access, and the endpoint.
What this error means
{
"error": {
"message": "The model 'gpt-5-turbo' does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
} It bundles several distinct situations under one message:
| Root cause | Tell-tale sign | Fix |
|---|---|---|
| Wrong/typo'd name | Slightly-off string (gpt-5-turbo) | Use the exact id from the models list |
| Retired model | Worked before, now 404s | Switch to the replacement model |
| No access | Real model, new/unverified account | Verify org / add billing |
| Wrong endpoint | Chat model on /completions | Call the matching endpoint |
Common causes
- Typo or wrong version.
gpt-4ovsgpt-4-o, or a dated snapshot (-2024-08-06) that’s wrong. Model ids are exact strings. - Retired or renamed model. A model you used months ago was deprecated and shut down — see the deprecations tracker for what replaced it.
- No access on your account. Newer or higher-end models can require a verified organization or a paid account; unverified accounts get the same 404.
- Wrong endpoint for the model type. Embeddings models don’t work on
/chat/completions; chat models don’t work on the legacy/completions. Mismatched pairs surface as model_not_found. - Wrong project/org key. A key scoped to a project without access to that model.
- Fine-tuned model id is off. Fine-tunes have long ids (
ft:gpt-4o-mini:org::id); a wrong suffix 404s.
How to fix it
List the models you can actually call
The fastest disambiguation: ask the API what your key has access to.
curl https://api.openai.com/v1/models \
-H "Authorization: Bearer $OPENAI_API_KEY" | python3 -c "import sys,json;[print(m['id']) for m in json.load(sys.stdin)['data']]" from openai import OpenAI
client = OpenAI()
available = {m.id for m in client.models.list().data}
target = "gpt-4o"
if target not in available:
raise SystemExit(f"{target!r} not available to this key. "
f"Did you mean one of: {sorted(a for a in available if 'gpt-4o' in a)}")
print("OK:", target) If the model is real but you lack access
- Verify your organization in the dashboard (Settings → Organization) — some models gate on verification.
- Add billing / move off the free tier if the model requires a paid account.
- Confirm the key’s project has the model enabled.
If the model was retired
Check the model deprecations tracker for the official replacement and update your model string. Pin to a dated snapshot you control so a future rename doesn’t silently break you — and handle the 404 gracefully with a fallback:
import openai
from openai import OpenAI
client = OpenAI()
PREFERRED = "gpt-5.5"
FALLBACK = "gpt-4o"
def create(messages, model=PREFERRED):
try:
return client.chat.completions.create(model=model, messages=messages)
except openai.NotFoundError:
# Model id invalid/retired/no-access — fall back and log to fix the config.
return client.chat.completions.create(model=FALLBACK, messages=messages) How to prevent it
- Centralize model ids in config, not scattered string literals, so updates are one-line.
- Validate the id against
models.list()at startup and fail fast with a clear message. - Watch deprecations so a shutdown doesn’t surprise you — the deprecations tracker lists retirement dates and replacements.
- Match the endpoint to the model type (chat vs embeddings vs responses).
Related errors
- A
401is authentication, not the model — see invalid authentication. - Rate/quota issues are separate: 429 rate limit.
Model ids change across providers as families are renamed and retired. OpenRouter gives you one OpenAI-compatible API across many models, so swapping a retired id for its successor is a one-string change. (Affiliate link.)
What to do next
- List your available models and copy the exact id.
- Check the deprecations tracker if a once-working model now 404s.
- Verify your org / billing if the model is real but inaccessible.
- Add a fallback so a bad id degrades gracefully instead of crashing.