Back to Blog

OpenRouter Auto Code Explained: How It Picks a Model for Coding Agents, and What It Costs

2026-11-09·8 min read·CodeRouter Team

Disclosure: CodeRouter is our product, a router for coding agents. Everything below about OpenRouter is quoted or summarized from OpenRouter's own announcement and documentation, checked on November 9, 2026, with links. Where we describe CodeRouter, we say so.

On November 6, 2026, OpenRouter announced a rebuilt Auto Router and a new router "specialized for coding work": Auto Code, model ID openrouter/auto-code. If you run Claude Code, Codex, Cursor or your own agent harness through OpenRouter, it is the model string that lets OpenRouter choose the model for each turn.

This post explains what it does, what it costs, how to call it, and where it fits.

What Auto Code is

OpenRouter has three members in its Auto Router family (docs):

Model ID What it is for (OpenRouter's description)
openrouter/auto "A general purpose router that picks a model and reasoning effort for every request"
openrouter/auto-code "specialized for coding agents and harnesses"
openrouter/auto-beta "the experimental release channel" for Auto Router changes

Auto Code "runs on the same routing engine as the Auto Router, with a policy tuned for coding work" (Auto Code docs). OpenRouter lists three differences:

How it picks a model

The docs describe five steps:

  1. Narrow the model pool. Guardrails, zero data retention, model capabilities, provider restrictions, BYOK keys and your allowed and excluded model lists decide which models are considered.
  2. Rate the request. "A fast decision model rates the turn, for example what kind of coding task it is, whether the task just changed, how hard it is, and whether a bigger model or more thinking would help." The announcement says the routers weigh "eleven factors about each request".
  3. Pick a model and effort. "The routing policy weighs measured pass rate, speed, and cost per solved task across models and reasoning efforts, plus live prices and cache status."
  4. Route to a provider, through the same provider routing a direct request to that model would use.
  5. Carry signals to the next turn. Auto Code "favors a change in reasoning effort over a model switch, so it keeps your prompt cache, and switches when failure signals show the model is the problem."

Two details matter for coding agents:

What OpenRouter reports about results and speed

From the announcement, in OpenRouter's words:

These are OpenRouter's measurements; we haven't reproduced them.

What it costs

So the cost of an Auto Code session is the sum of what each chosen model charges for its turns, plus the platform fee on the credits you buy. Because the model can change from turn to turn, the per-turn price isn't fixed in advance. The model field of each response tells you which model answered.

OpenRouter's pricing page also covers the BYOK allowance and free-model limits; our CodeRouter vs OpenRouter page puts the fees side by side.

How to call it

Use openrouter/auto-code wherever your harness takes a model string. A minimal Chat Completions request (with your own key in OPENROUTER_API_KEY):

curl https://openrouter.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-session-id: my-agent-session-42" \
  -d '{
    "model": "openrouter/auto-code",
    "messages": [{"role": "user", "content": "Fix the off-by-one error in utils/paginate.ts"}]
  }'

Restricting the models. Auto Code applies the allowed_models and excluded_models lists of the auto-router plugin as hard restrictions:

{
  "model": "openrouter/auto-code",
  "messages": [{"role": "user", "content": "Split this module into smaller functions."}],
  "plugins": [
    { "id": "auto-router", "allowed_models": ["anthropic/*", "openai/*"] }
  ]
}

Lists saved on your workspace's Routing page apply too. If the restrictions leave no eligible model, the request fails with 404 and names the fields to change. Auto Code ignores the auto-router plugin's cost_tier and runs on its own coding tier; the Auto Code docs show how to route a request on a general tier (low, medium or high) instead.

Seeing the decision. Send X-OpenRouter-Metadata: enabled to get router metadata: the routing stage lists the resolved models, the candidates with their reasoning effort and estimated cost, and the reason for the pick. In OpenRouter's chatroom, a routing insights panel shows the same analysis.

Limits the docs mention for the Auto Router family: it "requires conversational input", it is "available only in the global data region", and you shouldn't combine openrouter/auto with another router model in the same request.

When Auto Code fits

From OpenRouter's description, Auto Code makes most sense when:

Check two things on your own traffic, whatever router you use: what whole sessions cost compared with the single model you'd otherwise use, and how often the model changes mid-session. We wrote a checklist for that: What to measure before you pick a coding router.

How CodeRouter's approach differs

Briefly, and only about our own product:

The side-by-side table is on CodeRouter vs OpenRouter.

FAQ

What is OpenRouter Auto Code? A model router on OpenRouter, model ID openrouter/auto-code, "specialized for coding agents and harnesses". It picks a model and a reasoning effort for each turn.

Is OpenRouter Auto Code free? The router adds no fee. You pay the standard price of whichever model answers each turn, plus OpenRouter's platform fee on credits (5.5% on Standard, 8% on Business, per its pricing page).

What's the difference between openrouter/auto and openrouter/auto-code? Same engine; Auto Code uses a policy tuned for coding: a higher starting cost tier with stronger coding models, more weight on speed, and harsher penalties for failures.

Does Auto Code break the prompt cache? OpenRouter says it favors changing reasoning effort over switching models and switches only when failure signals point at the model; in its beta the Auto Router stayed on the same model for nearly nine of every ten agent turns.

How do I see which model it picked? The model field of each response, or full router metadata with the X-OpenRouter-Metadata: enabled header.

Sources, checked November 9, 2026: OpenRouter announcement, Auto Code docs, Auto Router docs, OpenRouter pricing, OpenRouter FAQ. OpenRouter may change these; check its pages for current terms.

Related reading

Try phase-aware routing on your own workload

One base URL for Claude Code, Cursor or Aider. Free trial, no credit card.

Start free trial

Get weekly AI cost optimization tips

Join developers cutting their agent bills