Auto Router API: toman pricing and code
openrouter/auto
visiontoolsreasoningjsonfilesaudioimage outAuto Router example: image generation
The example is picked from this model's own capabilities. Drop in your key and it runs as is.
curl https://api.uttapen.ir/v1/chat/completions \
-H "Authorization: Bearer sk-up-…" \
-H "Content-Type: application/json" \
-d '{
"model": "openrouter/auto",
"messages": [{"role": "user", "content": "A minimal photo of a coffee cup on a wooden table, natural light"}],
"modalities": ["image", "text"]
}'import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.uttapen.ir/v1", api_key="sk-up-…")
resp = client.chat.completions.create(
model="openrouter/auto",
messages=[{"role": "user", "content": "A minimal photo of a coffee cup on a wooden table, natural light"}],
extra_body={"modalities": ["image", "text"]},
)
# images are billed on image output tokens — check the balance before generating in bulk
for img in resp.choices[0].message.images or []:
data = img["image_url"]["url"].split(",", 1)[1]
open("out.png", "wb").write(base64.b64decode(data))
print("saved out.png")import OpenAI from "openai";
import { writeFileSync } from "node:fs";
const client = new OpenAI({ baseURL: "https://api.uttapen.ir/v1", apiKey: "sk-up-…" });
const resp = await client.chat.completions.create({
model: "openrouter/auto",
messages: [{ role: "user", content: "A minimal photo of a coffee cup on a wooden table, natural light" }],
modalities: ["image", "text"],
});
for (const img of resp.choices[0].message.images ?? []) {
const b64 = img.image_url.url.split(",", 2)[1];
writeFileSync("out.png", Buffer.from(b64, "base64"));
}What is Auto Router good for?
The id for Auto Router in our API is "openrouter/auto", served from OpenRouter. Context is 2,000,000 tokens; past that you have to summarise the history yourself. It has no fixed price: the destination model is chosen per request, and you are charged exactly what the model that answered actually cost.
What it can do beyond plain text: it reads images directly, which makes it a real option for invoices, forms and screenshots; it takes files such as PDFs as input; it accepts audio input; it supports tool calling, so it can invoke your own functions with valid arguments; it returns schema-valid JSON through response_format, ready to hand to your code; it has a reasoning mode that pays off on multi-step problems, maths and debugging; it can return generated images. All of it works through the standard parameters of the official OpenAI SDK — no custom client, no wrapper. Keep in mind that reasoning tokens are output tokens and do appear on the bill.
Its nearest relative in the catalogue is "openrouter/auto-beta", and choosing between those two is where most people hesitate.
OpenRouter has 6 models in our catalogue. Among the less common parameters it accepts logit_bias, logprobs, min_p, prediction, reasoning_effort, repetition_penalty — all through the standard request body. By context size the nearest option from another provider is Grok 4.20 at 2,000,000 tokens.
Good fits: automatic routing when you would rather not pick a model yourself, logic puzzles and code review, pulling text and fields out of images, agents that reach out to APIs and databases, extracting data against a fixed schema, analysing a long document or codebase in one request.
The Auto Router automatically selects the best model for your prompt, powered by the wisdom of the market. It routes you based on what the OpenRouter community collectively spends on...
Frequently asked
- How do I call Auto Router from Iran?
- Sign up with your mobile number, top the wallet up in toman, create an API key, then in the official OpenAI SDK point base_url at https://api.uttapen.ir/v1 and set model to "openrouter/auto". Nothing else in your code changes.
- What does Auto Router cost in toman?
- This model has no fixed price: the cost depends on the model that answered the request, and that exact amount is what leaves your wallet.
- How much input does Auto Router take?
- Up to 2,000,000 tokens per request, roughly 1,500k words. Cap the answer length yourself with max_tokens.
- Does Auto Router support streaming and tool calling?
- Streaming (stream=true) works on every model here. This one supports tool calling in the standard OpenAI shape. Image input is accepted through image_url, as a data URI or a public URL. Structured output through response_format works too.