Skip to main content
Auto Code (openrouter/auto-code) is a router specialized for coding agents and harnesses. It runs on the same routing engine as the Auto Router, with a policy tuned for coding work:
  • It starts in a higher cost tier that includes stronger coding models.
  • It weighs speed more heavily.
  • It penalizes failures more harshly, so it course corrects faster when tests fail or the same error comes back.
Use Auto Code in a coding harness and the Auto Router for mixed traffic and general agents. See how both perform on the Model Routing Benchmarks.

How it works

  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.
  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. The request goes through the same provider routing a direct request to that model would.
  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.

Usage

Set model to openrouter/auto-code wherever your harness takes a model string:
Send a session_id (or the x-session-id header) so the router treats every turn of an agent session as one conversation. See Auto Router session stickiness.

Restrict the models

Auto Code applies the allowed_models and excluded_models lists from the auto-router plugin as hard restrictions, the same lists the Auto Router uses. Lists you save on your workspace’s Routing page apply too.
See Allowed models for the pattern syntax. If your restrictions leave no eligible model, the request fails with 404 and names the fields to change.

Change the cost tier

Auto Code ignores the auto-router plugin’s cost_tier and runs on its own coding tier. To route a request on a general tier instead, set cost_tier on a jev-router plugin entry to low, medium, or high:

Inspect routing decisions

Send X-OpenRouter-Metadata: enabled to get router metadata. The jev-router stage in openrouter_metadata.pipeline lists resolved_models, the routed candidates with their reasoning effort and estimated cost, and the reason for the pick. See Jev Router: Seeing what the router did for every field.

Pricing

You pay the standard price of whichever model serves each request. Auto Code doesn’t add a fee.