Error Fix · As of 2026-11-26

model_not_found / "does not exist" / 404 not_found_error: how to fix model ID errors

model_not_found, "The model … does not exist or you do not have access to it" and a 404 not_found_error that names a model all mean the same thing: the server you called does not serve the exact model string you sent, on the path you sent it to. As of 2026-11-26 the most common causes are a typo or wrong separator in the ID, sending a Claude model to an OpenAI-format endpoint (or a GPT model to an Anthropic-format one), a retired or unlisted ID, and a [1m] suffix used where it is not understood. This guide shows the real error strings, ranks the causes, and gives fixes for Claude Code, Codex CLI, the SDKs and IDE plugins.

QCode is an independent third-party API service and is not affiliated with Anthropic, OpenAI, Zhipu, Moonshot, DeepSeek or Alibaba. Model availability on QCode is set by QCode and can differ from each vendor's own API.

Updated 2026-11-26

Key facts

  • Anthropic-format error (seen in Claude Code issue reports): API Error: 404 {"type":"error","error":{"type":"not_found_error","message":"model: sonnet4"}}. The message field echoes the model string that was not found.
  • OpenAI-format error: {"error":{"message":"The modelgpt-4odoes not exist or you do not have access to it.","type":"invalid_request_error","param":null,"code":"model_not_found"}}. Codex CLI surfaces it as stream disconnected before completion: The modelgpt-5-codexdoes not exist or you do not have access to it.
  • Claude Code messages include There's an issue with the selected model, Couldn't confirm model … with the API, and, for custom IDs behind a gateway, the startup warning Claude Code doesn't recognize the model "my-gateway-opus", so it assumes a context window of 200k tokens. (a warning, not a failure).
  • QCode adds one specific code: model_not_available_on_endpoint, returned when a Claude model is sent to the OpenAI-format path.
  • Protocol rule on QCode: Claude models work only on the Anthropic path (https://api.qcode.cc/api); GPT models only on the OpenAI paths (https://api.qcode.cc/openai/v1, or https://api.qcode.cc/openai for Codex Responses); GLM, Kimi, DeepSeek and Qwen work on both the Anthropic and OpenAI Chat paths, but not on Codex Responses.
  • ID style: Claude IDs use hyphens (claude-opus-5-5, claude-sonnet-5-5); GPT and most Chinese-model IDs use dots (gpt-6.2-sol, glm-5.3, kimi-k3.1-pro, deepseek-v4.1-flash).

What the error means

A model-not-found error is the server saying "I understood your request, but the model value is not something I can route." It is different from a wrong URL path: if the path itself is wrong (for example a doubled /v1/v1/messages), you also get a 404, but the message points to the route, not to the model. Look at the response body. If it names your model string, the URL is fine and the model value is the problem.

On OpenAI-format APIs, "does not exist or you do not have access to it" deliberately merges two cases: the ID is wrong, or your key is not allowed to use it. Through a gateway such as QCode, it most often means the ID is not on that gateway's list for that path.

Causes, ranked by likelihood

  1. Typo, wrong separator or wrong case. claude-opus-5.5 (dot instead of hyphen), gpt-6-2-sol (hyphens instead of dots), Claude-Sonnet-5-5 (capitals), or short forms like sonnet4 that are not IDs at all. IDs are case-sensitive exact strings.
  2. Protocol mismatch. A Claude ID sent through an OpenAI-compatible client, Codex CLI, or /openai/v1/chat/completions, which on QCode returns model_not_available_on_endpoint. Or a GPT ID put into ANTHROPIC_MODEL for Claude Code, which goes to the Anthropic path where GPT is not served.
  3. Retired or unlisted model. Old IDs copied from a tutorial, a model the vendor retired, or a new model that QCode has not listed yet. For example, GLM-5.4 and Qwen4-Max are not on QCode /models as of 2026-11-26; check /models before relying on a newly announced ID. DeepSeek retired deepseek-v4-flash upstream on 2026-09-10 (see DeepSeek model ID changes); check /models for the ID QCode currently lists.
  4. [1m] suffix in the wrong place. [1m] is a Claude Code notation for requesting the 1M-token context. Typing it into a raw SDK call, a Cline field or an OpenAI-format client, or adding it to a model where it is not listed, can produce a not-found error.
  5. A stale value in a tool-specific field. Claude Code has several model settings that override each other; Codex has model per profile; IDE plugins keep their own model field. An old value in one of them wins over the one you just changed.

Step-by-step fixes

Step 1: Read the exact model string from the error

Copy the model name out of the error body ("message":"model: sonnet4" or The model `gpt-4o`). That is what your tool actually sent, which is often not what you think you configured.

Step 2: Compare it with the current QCode model list

Family Example IDs by family Anthropic path /api OpenAI Chat /openai/v1 Codex Responses /openai
Claude claude-opus-5-5, claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-2, claude-fable-5-1, claude-fable-5, claude-opus-5, claude-sonnet-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6 Yes No No
Claude 1M variants claude-fable-5-2[1m], claude-opus-5[1m], claude-sonnet-5-5[1m], claude-sonnet-5[1m], claude-opus-4-8[1m] Yes No No
GPT gpt-6.2-sol, gpt-6.2-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-sol, gpt-5.6-sol, gpt-5.6-terra No Yes Yes
GLM glm-5.3, glm-5.3-flash, glm-5.2 Yes Yes No
Kimi kimi-k3, kimi-k3.1-pro Yes Yes No
DeepSeek deepseek-v4.1-flash, deepseek-v4-pro Yes Yes No
Qwen qwen3.8-max, qwen3.8-flash, qwen3.7-plus Yes Yes No

The list changes; check /models for the live version, prices and availability. Gemini models are not on QCode /models as of 2026-11-26.

Step 3: Make the path match the model

# Claude model -> Anthropic path
curl -sS -X POST https://api.qcode.cc/api/v1/messages \
  -H "x-api-key: $QCODE_API_KEY" -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-5-5","max_tokens":16,"messages":[{"role":"user","content":"ping"}]}'

# GPT or GLM/Kimi/DeepSeek/Qwen model -> OpenAI Chat path
curl -sS https://api.qcode.cc/openai/v1/chat/completions \
  -H "Authorization: Bearer $QCODE_API_KEY" -H "content-type: application/json" \
  -d '{"model":"gpt-6.2-sol","messages":[{"role":"user","content":"ping"}],"max_tokens":16}'

If the first call works but the same model fails in your app, the app is using the other protocol.

Step 4: Fix the field in your tool

Claude Code. The model is chosen in this order: /model in the session, --model at launch, ANTHROPIC_MODEL, the model key in settings, then ANTHROPIC_DEFAULT_MODEL (v2.1.236 and later). Aliases (opus, sonnet, haiku, fable, opusplan) are resolved through ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL and ANTHROPIC_DEFAULT_FABLE_MODEL; subagents can use CLAUDE_CODE_SUBAGENT_MODEL. Claude Code does not check a mistyped --model, ANTHROPIC_MODEL or settings model up front, so the mistake only shows on the first request as "There's an issue with the selected model".

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.qcode.cc/api",
    "ANTHROPIC_AUTH_TOKEN": "cr_your_key",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-5-5",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-5-5",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-5-5"
  }
}

Search every place a stale value can hide: env | grep ANTHROPIC, ~/.claude/settings.json, .claude/settings.json, .claude/settings.local.json, and shell profiles. Never put a GPT ID here; Claude Code talks to the Anthropic path.

Codex CLI. Set the model in ~/.codex/config.toml or per run with -m:

model = "gpt-6.1-sol"
model_provider = "qcode"

[model_providers.qcode]
name = "QCode"
base_url = "https://api.qcode.cc/openai"
wire_api = "responses"
requires_openai_auth = true

Only GPT models work here, because Codex uses the Responses protocol. A Claude ID gives model_not_available_on_endpoint; a GLM or DeepSeek ID is not served on Responses either. Check every [profiles.*] block, since a profile's model overrides the top-level one.

SDKs. Anthropic SDKs raise NotFoundError for a 404; OpenAI SDKs raise NotFoundError with code="model_not_found". Use the Anthropic SDK with base_url="https://api.qcode.cc/api" for Claude and the four Chinese families; use the OpenAI SDK with base_url="https://api.qcode.cc/openai/v1" for GPT and the Chinese families. Load the model name from config, not from scattered string literals.

Cline and other IDE plugins. In Cline's Anthropic provider with "Use custom base URL", the model comes from the "Model" field; with the OpenAI Compatible provider it is the "Model ID" field, typed exactly as listed. Do not add [1m] there. If you also see Invalid URL (POST /v1/v1/messages), your base URL has an extra /v1 (see Cline base URL 400 fix). Other plugins with a custom-model box follow the same rule: exact ID, matching protocol.

Step 5: Handle [1m] correctly

In Claude Code you can append [1m] to an alias or full ID (/model opus[1m]). Current Claude Code docs say Opus 4.7 and later, Sonnet 5 and later, Haiku 5.5 and Fable 5 / 5.1 already run with 1M context by default, so the suffix is only needed for older models such as Opus 4.6 and Sonnet 4.6. On QCode, use only [1m] IDs that appear on /models. Outside Claude Code, do not rely on the suffix in raw SDK calls: if you need 1M context there, test it with a small request first and otherwise use the plain model ID. Set CLAUDE_CODE_DISABLE_1M_CONTEXT=1 if you want to turn 1M off. More detail: 1M context with a custom base URL.

Step 6: Replace retired IDs

Swap retired or unlisted IDs for current ones: for example, deepseek-v4-flash to deepseek-v4.1-flash, and any GPT ID that is not on /models to a listed one such as gpt-6.1-sol. For a model you read about in vendor news but cannot find on QCode /models, do not assume it is available; check /models before you rely on it.

How to confirm it's fixed

  1. The curl call from Step 3 returns a normal response with the same model ID.
  2. In Claude Code, /status shows the model you expect and a short prompt gets a reply without "There's an issue with the selected model".
  3. In Codex, codex -m gpt-6.1-sol "say ok" returns text instead of stream disconnected before completion.
  4. Your usage log on QCode shows the request under the expected model.

Prevention

  • Keep model IDs in one config file or environment block per tool, and remove duplicates from shell profiles.
  • Copy IDs from /models instead of typing them; watch hyphens versus dots.
  • Pin Claude Code aliases with ANTHROPIC_DEFAULT_*_MODEL so a new alias mapping never surprises you.
  • Pair each model with its protocol: Claude on /api, GPT on /openai, Chinese models on either Chat path.
  • Review your config after vendor retirement notices and when QCode updates its list.

FAQ

What does model_not_found mean?

It is the OpenAI-format error code for a model string the server cannot serve to your key, shown as "The model … does not exist or you do not have access to it." Check the spelling and that the model is offered on the endpoint you are calling.

Why does Claude Code say "There's an issue with the selected model"?

Claude Code sent a model ID the API rejected. A mistyped --model, ANTHROPIC_MODEL or settings model is not checked until the first request. Run /model, pick a listed model, and remove the stale value.

Can I use GPT models in Claude Code through QCode?

No. Claude Code uses the Anthropic protocol, and on QCode GPT models are served only on the OpenAI paths. Use Codex CLI or an OpenAI-compatible client for GPT. GLM, Kimi, DeepSeek and Qwen do work through the Anthropic path.

What is model_not_available_on_endpoint?

A QCode error returned when a Claude model is requested through the OpenAI-format path. Move the request to https://api.qcode.cc/api with an Anthropic client.

Should I add [1m] to the model ID?

Only in Claude Code, and usually not even there: current Opus, Sonnet, Haiku and Fable models already use 1M context by default. Never add it in raw API calls or plugin fields unless that exact [1m] ID is on QCode's list.

Why does a model in the vendor's announcement return not found?

A new model is only available on QCode once it appears on QCode's model list. GLM-5.4 and Qwen4-Max, for example, are not on QCode /models as of 2026-11-26; check /models.

The URL returns 404 too. Is that the same problem?

Not always. If the 404 body names your model, it is a model problem. If it complains about the route, or you see a doubled /v1/v1, fix the base URL first.

Try every model on one key

The trial plan gives one key for Claude, GPT and the supported Chinese models, from $9 for 30 days with a $5 daily quota. Anthropic and OpenAI models are billed at official API price × 1.0; Chinese models are billed at the rate shown on /models, so you can test each model ID on the right path before you commit. See pricing for current terms.

Try every model on one key

One key for both the Anthropic Messages API and OpenAI-compatible APIs. Claude and GPT are billed at the official price ×1.0; live rates are on /models.

Not sure where to start?

Try it for a week

Small Pack: $4 for $30 of quota, valid 7 days

Use it every day

Starter: $9.00/month with $5 of quota every day — just $0.060 per $1 of quota, vs about $0.113 for the Medium Pack