Fix Model Not Found in Claude Code and Codex CLI
Step-by-step fixes for the "Model Not Found" error when connecting Claude Code or Codex CLI to DeepSeek, OpenRouter, and other providers.
Error output
Error: model not found: deepseek-chat
{"error":{"message":"Model Not Exist"}}
Common variations
anthropic: Request to Anthropic API failed with status 404: {"error":{"message":"Model not found"}}
Unknown model "gpt-5.3-codex". Available models are listed at https://openrouter.ai/models
The exact text varies by agent version and provider. Match the status code and the message above.
Quick diagnosis
Print the model variables — the typo or retired name is usually right there.
Claude Code
echo $ANTHROPIC_MODEL $ANTHROPIC_DEFAULT_OPUS_MODEL $ANTHROPIC_DEFAULT_SONNET_MODEL $ANTHROPIC_DEFAULT_HAIKU_MODEL Codex CLI
grep "^model" ~/.codex/config.toml Common causes
- The model name does not exist or was retired (deepseek-chat / deepseek-reasoner retired 2026-07-24).
- The model slug is missing the provider prefix required by the gateway (OpenRouter).
- A cached old login overrides the environment variables (Claude Code with OpenRouter).
Fix by scenario
1 Fails right after the initial setup
- Use the current model names: deepseek-v4-pro[1m] and deepseek-v4-flash.
- On OpenRouter the slug needs the provider prefix, e.g. openai/gpt-5.3-codex — the bare name alone will not match.
- Codex × DeepSeek: the model must exist in the models.json catalog for metadata to load.
2 The model was retired
- deepseek-chat and deepseek-reasoner were retired on 2026-07-24; update any old config.
- Check the provider docs for the current name before assuming the model still exists.
- Old blog tutorials frequently reference retired names — prefer current docs.
3 OpenRouter shows the wrong model
- Run /logout inside Claude Code once — a cached Anthropic login overrides your model variables.
- Confirm ANTHROPIC_API_KEY is empty (""), not unset, in OpenRouter setups.
- Aliases with ~ (e.g. ~anthropic/claude-sonnet-latest) always resolve to the newest version.
Agent-specific fixes
Claude Code
- Fix
- Set all four model variables (ANTHROPIC_MODEL and the three ANTHROPIC_DEFAULT_*_MODEL) to a current name. With OpenRouter, /logout and relaunch clears cached overrides.
- Verify
- `claude /status` shows the model label, then a short test prompt succeeds.
Codex CLI
- Fix
- Copy the full slug from the provider catalog, e.g. openai/gpt-5.3-codex or deepseek/deepseek-v4-flash. For DeepSeek direct, keep the model inside the models.json catalog.
- Verify
- `codex exec "hi"` succeeds and the provider dashboard shows the expected model name.
Claude Code vs Codex CLI at a glance
| Claude Code | Codex CLI | |
|---|---|---|
| Model variable | ANTHROPIC_MODEL + ANTHROPIC_DEFAULT_*_MODEL | model in config.toml |
| Model catalog | Provider docs | ~/.codex/models.json (DeepSeek) |
| Cached login fix | /logout inside Claude Code | codex logout |
Prevent it from happening again
- Use aliases (like ~anthropic/…) on OpenRouter to follow the newest model automatically.
- After a model rename, update all configs in one pass and note the date.
- Follow the provider release notes to catch retirements early.
Related errors
Related setup guides
Frequently asked questions
Why is deepseek-chat not found anymore?
DeepSeek retired the old aliases on 2026-07-24. Use deepseek-v4-pro[1m] and deepseek-v4-flash, which are the current model names.
What does the ~ prefix on OpenRouter models mean?
Aliases like ~anthropic/claude-sonnet-latest resolve to the newest version of that model, so you do not need to update the config when a new version ships.