Error database

NotFoundError 404: The model does not exist or you do not have access to it

The model name string is wrong, retired, or not available to your account. Copy the exact id from the provider's model list — never type it from memory.

The message you saw
NotFoundError 404: The model does not exist or you do not have access to it

By Updated

The error

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

Anthropic's version:

Output
anthropic.NotFoundError: Error code: 404 - {'type': 'error', 'error': {'type': 'not_found_error', 'message': 'model: claude-3-opus'}}

What it means

The request authenticated fine — the provider knows who you are — but the model string matches nothing you can use. The wording is deliberately ambiguous between "no such model" and "not for your account", because providers avoid confirming model names to accounts without access. Treat both possibilities.

Why it happens

Model ids are exact strings, and near-misses are everywhere: gpt4 for gpt-4o, a missing date suffix on an Anthropic id, a hyphen where a dot belongs. Second cause: retirement — model versions are deprecated on a schedule, and code pinned to an old id eventually 404s. Third: access — some models need a billing method on file, a certain usage tier, or region availability. Fourth, subtler: a custom base_url (a proxy, Azure, or a local server) that expects its own model names, like Azure's deployment names.

How to fix it

1. List the models your key can actually see, and copy from that.

python
from openai import OpenAI
client = OpenAI()
for m in client.models.list():
    print(m.id)
python
import anthropic
client = anthropic.Anthropic()
for m in client.models.list():
    print(m.id)

If the id you wanted is absent from your own list, the problem is access or retirement, not spelling.

2. Copy ids from the provider's model documentation, character for character. Both providers keep a current models page with exact ids and deprecation dates. Anthropic ids include a version suffix — the bare family name is not a valid id.

3. Check the deprecation notices when old code breaks. A model that worked last month and 404s today has likely been retired; the docs name its replacement. Update the id and re-test — successor models can behave differently at the margins.

4. Using a base_url? The naming rules changed under you. Azure OpenAI wants your deployment name, not the model family. Local servers and gateways expose whatever names they were configured with — query the gateway's own model list.

5. Do not "fix" a 404 by retrying. Unlike rate limits, a 404 is deterministic. Retry loops turn one clear error into a quiet hammering.

How to prevent it

Keep the model id in one config value, not scattered through the code. Log it at startup. Subscribe to the provider's deprecation announcements so retirements arrive as calendar items, not outages.