GuidesRunning & maintaining

OpenRouter "is not a valid model ID": causes and the right ID

OpenRouter's 400 "<id> is not a valid model ID" means the model string matches nothing it serves. Read the ID in the message, find the real one, write it right.

November 21, 2026The Everpod team
The short answer

OpenRouter answers HTTP 400 with “<id> is not a valid model ID” when the model string it received matches nothing it serves. The string in the message is exactly what your agent sent, so read it first: an extra prefix such as openrouter/, an alias or display name instead of an ID, a misspelling, spaces, or a model that has been retired. The key is not what it is refusing; a bad key gets a 401. Get the real ID from the model’s page or from https://openrouter.ai/api/v1/models (it looks like qwen/qwen3.6-27b), then give it to your agent in the form that agent expects, which for OpenClaw and OpenCode means openrouter/ in front of it.

What the error looks like

The body is OpenRouter’s usual error shape, with the status repeated in code. This one is from a LiteLLM report of March 2026, as the library printed it:

OpenrouterException - {"error":{"message":"openrouter/google/gemini-2.5-flash is not a valid model ID","code":400}}
Copied

Agents show it in their own wrapping: “run error: 400 …” in OpenClaw, “HTTP 400: …” in Hermes. OpenRouter’s documentation does not list this message; it falls under 400, “invalid or missing params”. Two things follow from where it comes. Retrying sends the same string and gets the same answer. And the key is not the problem: Claude Code’s gateway docs treat an error naming an unknown model as proof that the URL and credential work. A missing or wrong key gets a 401 instead (the 401 guide decodes those).

Read the ID in the message

Compare the string OpenRouter quotes with the ID on the model’s page. The cases reported on the agents’ trackers fall into these:

Suffixes after the colon

OpenRouter’s variants page sorts suffixes into two kinds, and they behave differently:

An ID takes at most one of the first kind, and OpenRouter adds that “Only the suffixes listed on this page are variants.” When a :free version is gone, its advice is to treat it as an unavailable model, “not as a signal to retry with the base slug”: the paid ID is a different model to choose deliberately, since it bills your credits.

Finding the right ID

On the web, the model’s page address is its ID: openrouter.ai/qwen/qwen3.6-27b is qwen/qwen3.6-27b. From a terminal, the models API lists every ID, and the list needs no key:

curl -s https://openrouter.ai/api/v1/models | jq -r '.data[].id' | grep -i qwen3.6
Copied

The list holds text-output models by default (add ?output_modalities= to ask for others). To check one ID before handing it to an agent:

curl -s https://openrouter.ai/api/v1/model/qwen/qwen3.6-27b \
  | jq '.data | {id, canonical_slug, expiration_date}'
Copied

On November 22, 2026 that gave qwen/qwen3.6-27b with no expiry date, and the misspelt qwen/qwen-3.6-27b gave a 404. Three fields are worth knowing. id is what goes in the request. canonical_slug is a dated name that “never changes”, useful for recognising the model later. expiration_date is set when the model is due to be withdrawn, which is your warning before this error starts. This lookup is a little more forgiving than a request: it resolves old aliases, so anthropic/claude-3-5-sonnet comes back as anthropic/claude-3.5-sonnet. Copy the id it returns rather than the one you typed.

For a model that follows a family, the ~ aliases such as ~anthropic/claude-sonnet-latest move to each new release by themselves; OpenRouter’s advice when you need the same model every time is to call the concrete ID instead.

How each agent wants the ID written

Some agents put their own provider name in front of OpenRouter’s ID and take it off before sending; others pass the ID through as written. Getting this wrong in either direction produces the error. As their docs state it in November 2026:

AgentWhere the model goesHow it is written
OpenClaw
openclaw models set, /model, agents.defaults.model.primaryopenrouter/qwen/qwen3.6-27b; Fusion: openrouter/openrouter/fusion
OpenCode
opencode.json model, /modelsopenrouter/qwen/qwen3.6-27b
Hermes
model.default with provider: openrouterqwen/qwen3.6-27b
Codex
model in ~/.codex/config.toml, or -mqwen/qwen3.6-27b
Claude Code
ANTHROPIC_DEFAULT_*_MODEL, --model~anthropic/claude-sonnet-latest or a pinned Anthropic ID

In OpenClaw, the part after the first openrouter/ must be the whole OpenRouter ID, and openclaw models list --provider openrouter shows the strings it knows. In Hermes, hermes config get model --json shows the active model, and hermes model picks one from the provider’s list and writes it to the config. In Claude Code, a [1m] on the end is allowed: OpenRouter strips it before routing. Claude Code is the one agent here where non-Claude models are unsupported by both Anthropic and OpenRouter. The full setup for the last three, key and all, is in using OpenRouter with Codex, OpenCode and Claude Code.

If the ID is right and it still fails

Once OpenRouter accepts the ID, the next refusals are different messages with different fixes. “No endpoints found that support tool use” or “No allowed providers are available” mean the model exists but no provider of it can take this request (the no-endpoints guide). “Provider returned error” is the company running the model refusing, with its reason inside (the provider-error guide). And in Claude Code, OpenRouter’s own page says a model-not-found error for an OpenRouter-only model such as openrouter/auto is “Usually caused by a credential conflict”, an old Anthropic sign-in still active, which /logout clears.

Run Claude Code, Codex, OpenCode, Pi, Hermes or OpenClaw on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.