Skip to content
Underread.
Guides

How to Fix “The model does not exist or you do not have access to it” (model_not_found)

One error covers two completely different problems, and the message refuses to tell you which one you have. Here's how to find out in 1 call.

By Vemuri Abhiram6 min read
Laptop screen filled with terminal output in a dim room
Laptop screen filled with terminal output in a dim room
On this page

The model name is right. You copied it from the docs. The API disagrees:

openai.NotFoundError: Error code: 404 - {'error': {'message': 'The model
`gpt-4.5-turbo` does not exist or you do not have access to it',
'type': 'invalid_request_error', 'code': 'model_not_found'}}

Read that message again, because the wording is doing something unusual. It's 2 completely different errors wearing 1 coat: either the model isn't real, or it's real and your key can't reach it. The API won't tell you which, and that ambiguity is deliberate rather than sloppy.

#The 4 causes, in order of likelihood

# Cause Tell Time
1 Name is wrong, renamed or retired Not in models.list() 2 min
2 Project key lacks model access In the org's list, not yours 5 min
3 Tier hasn't unlocked it New account, newest model 5 min
4 Wrong endpoint for that model Name is right, path is not 10 min

#1. Ask the API what you can actually call

Stop guessing from documentation. The list that matters is the one your key returns:

from openai import OpenAI
client = OpenAI()
names = sorted(m.id for m in client.models.list())
print(len(names))
for n in names:
    print(n)

This is the whole diagnosis. If the model you want isn't in that output, no amount of correcting your request body will help.

Two things to look for while you read it:

  • A near-match. gpt-4.1 when you typed gpt-4-1. Dots and hyphens are not interchangeable, and dated suffixes come and go.
  • Nothing close at all. That points at access rather than spelling. Go to 2.

#2. Project keys don't inherit everything

A project-scoped key (one tied to a single project rather than the whole organisation) can be restricted to a subset of models. The organisation has access. Your key doesn't. The error is identical.

The quickest test takes 2 minutes. Run models.list() with a key from a different project, or from the org itself, and compare the 2 outputs. A model present in one list and absent from the other is a permissions problem, full stop.

Fix it in the project's settings rather than in your code. Adding a retry or renaming the model will not grant access.

#3. New accounts don't get everything on day 1

Access to the newest models is often staged, and a brand new account with no payment history sits at the bottom of that staging. The model exists, it's documented, and you cannot call it yet.

You'll recognise this pattern:

  • The model appears in the documentation and in announcements.
  • It's absent from your models.list().
  • A colleague on an older account can call it.

There's no code fix. Usage history and spend move you up tiers over time. In the meantime pick a model that's in your list and move on — the difference matters less than losing a day to it.

#4. Right model, wrong endpoint

Some models only work on certain endpoints. An embedding model sent to a chat endpoint, an audio model sent to a text one, a reasoning model sent to a legacy completions path — these can surface as a model error rather than a routing one, because from the endpoint's perspective that model doesn't exist.

If the name is definitely in your list and the call still 404s, check the endpoint before anything else. Match the model family to the API surface the docs pair it with.

#Match your symptom to the fix

What you're seeing Likely cause Go to
Name isn't in models.list() at all Typo, renamed or retired 1
In the org's list, not in yours Project key restriction 2
Documented and announced, still absent Tier hasn't unlocked it 3
In your list but the call still 404s Wrong endpoint 4
Worked last month, fails now Model retired or renamed 1

#Stop it happening again

Don't hardcode a model name in 12 places. One constant, read from configuration, means a retirement is a 1-line change instead of an afternoon of grep.

Fail loudly at startup. Call models.list() when your service boots and check your configured name is in it. A clear error on deploy beats a 404 in front of a user at 2am.

MODEL = os.environ.get("LLM_MODEL", "gpt-4.1-mini")

def check():
    available = {m.id for m in client.models.list()}
    if MODEL not in available:
        raise SystemExit(f"{MODEL} not available to this key")

Prefer an alias to a dated snapshot, unless you need the opposite. An unversioned name like gpt-4.1-mini follows the current pointer and keeps working when a snapshot behind it retires, at the cost of your outputs shifting slightly when it moves. A dated snapshot gives you byte-stable behaviour and a hard expiry date. Pick the one that matches what breaks worse for you: silent drift, or a dead name on a Tuesday morning.

Watch the deprecation notices. Retirement dates are published well ahead of the date itself, usually with months of warning. That's the warning, and it's the one nobody reads until the call starts failing in production.

#Build a fallback instead of a single point of failure

A service pinned to exactly 1 model name has a hard dependency on a string somebody else controls. That's fine until the day it isn't.

An ordered list costs almost nothing to implement and removes the whole class of outage:

CANDIDATES = ["gpt-4.1", "gpt-4.1-mini"]

def pick_model():
    available = {m.id for m in client.models.list()}
    for name in CANDIDATES:
        if name in available:
            return name
    raise SystemExit(f"none of {CANDIDATES} available to this key")

Resolve it once at startup and cache the result — calling models.list() on every request adds a round trip for no benefit. Log which one it picked, because a service that silently fell back to a cheaper model 3 weeks ago explains a lot of otherwise confusing quality complaints.

#When you've checked everything

If the model is in your list, the endpoint is right, and it still returns model_not_found, capture the request id header from the failing response and raise a ticket with it, naming the exact model string and your project id.

Before you do, try the identical call with a different model from your list. If that also fails, the problem isn't the model at all — look at authentication or quota instead, both of which can surface at the same moment as a deploy.

Frequently asked questions

Why doesn't the error say which problem it is?

Deliberately. Telling an unauthorised caller that a model exists leaks information about the account and the product roadmap. Merging 'not real' and 'not yours' into one message avoids that, at the cost of a slower debug.

Does models.list() show everything my key can use?

It shows what's visible to that key, which is the list that matters for this error. Endpoint compatibility is separate — being in the list doesn't mean every endpoint accepts it.

How much notice do retired models get?

Retirement dates are published in advance in the deprecations documentation. Reading that page once a quarter is cheaper than the outage.

Can I pin a dated model version to be safe?

Yes, and it's the right call for anything where output stability matters. The tradeoff is that dated snapshots get retired too, so pinning buys predictability, not permanence.

Written by

Vemuri Abhiram

Founder & Editor

I write every post here. The tools I review are ones I pay for and run on real client work, not demo accounts, and every number you see came off my own invoice or dashboard.

More from Underread, once a week.

The guides worth reading and the tests worth trusting. One email, every Friday.

No spam. Unsubscribe in one click.