# OpenRouter API

> Geata LLM ginearálta téacs ina roghnaíonn an réimse `model` cén tsamhail teanga a fhreagraíonn don leid

Seolann sé `prompt` chuig samhail teanga a roghnaítear leis an bparaiméadar riachtanach `model`. I measc na n-ionchur roghnach tá `system_prompt`, `temperature` ó 0 go 2, `max_tokens`, bratach `reasoning` agus cuardach gréasáin trí `enable_web_search`. Tá an téacs ginte, réasúnú roghnach agus úsáid comharthaí san aschur.

- Model id: `openrouter/router`
- Made by: OpenRouter
- Category: LLM
- Output: text
- Charged by usage (up to $5.138 per run, typical $0.015; the rest of the hold is refunded): $0.01 / usage unit (cheapest run $0.015 (15 API credits))
- Run: `POST https://api.doitong.com/v1/run/openrouter/router`
- Quote: `POST https://api.doitong.com/v1/quote/openrouter/router`
- Docs page: https://doitong.com/ga/developers/models/openrouter/router

## Pricing

Price: **$0.01 / usage unit**. Charged by actual usage at $0.01 / usage unit: up to $5.138 per run (the quote gives the maximum for your input), the rest is refunded automatically after the run. A typical run costs $0.015.

The full example input below holds up to $5.138 = 5138 API credits (up to 513.7792 units × $0.01) when it starts; a typical run costs $0.015 (15 API credits).

Prices are the upstream price in USD, paid from the API balance in API credits (1000 API credits = 1 USD). This model is charged by usage: `POST https://api.doitong.com/v1/quote/openrouter/router` with the same JSON body returns the most the run can cost for that input (`credits`, debited when the run starts); after the run you pay the usage the model reports and the rest is refunded automatically. An input whose maximum would exceed the per-run limit is refused with 422. Invalid input is never charged and failed or canceled requests are refunded automatically.

## Input parameters

| Parameter | Canonical name | Type | Required | Default | Allowed values / range | Description |
|---|---|---|---|---|---|---|
| `prompt` |  | string | yes |  |  | Leid a sholáthraítear le haghaidh comhlánú comhrá. |
| `system_prompt` |  | string \| null | no |  |  | Leid chórais a sholáthraíonn treoracha nó comhthéacs don tsamhail. |
| `model` |  | string | yes |  |  | Ainm lena sainaithnítear an tsamhail atá le rith. |
| `reasoning` |  | boolean | no | `false` |  | Cibé acu ar cheart réasúnaíocht a áireamh sa fhreagra deiridh. |
| `temperature` |  | number | no | `1` | 0 – 2 | Rialú inathraitheachta an fhreagra, agus 0 ag ráthú freagra comhionann nuair nach n-athraítear an t-ionchur. Bogann méadú ar an luach na freagraí ó fhreagraí intuartha tipiciúla i dtreo níos mó éagsúlachta agus freagraí nach mbíonn chomh coitianta. |
| `max_tokens` |  | integer \| null | no |  | ≥ 1 | Cuir teorainn le líon na dtócain ginte sa fhreagra ag luach nach mó ná fad an chomhthéacs lúide fad na leide. Ní féidir leis an nginiúint dul thar an teorainn shonraithe. |
| `enable_web_search` |  | boolean | no | `false` |  | Lasc rochtana gréasáin a ligeann don tsamhail roghnú cibé acu agus cathain is ceart cuardach a dhéanamh, lena n-áirítear cuardaigh iolracha laistigh d’aon iarratas amháin. Úsáideann cuardaigh uirlis chuardaigh ghréasáin ar thaobh an fhreastalaí de chuid OpenRouter chun faisnéis fhíorama a fháil. |
| `web_search_options` |  | object {engine, max_results, max_uses, max_total_results, search_context_size, max_characters, allowed_domains, excluded_domains, user_location} \| null | no |  |  | Cumraíocht chuardaigh ghréasáin, lena n-áirítear roghnú innill, teorainneacha torthaí agus scagadh fearainn. Ní úsáidtear í ach nuair atá enable_web_search fíor. |
| `web_search_options.engine` |  | enum (string) | no | `auto` | `auto`, `native`, `exa` | Roghnú innill chuardaigh: filleann 'auto' agus 'native' araon ar Exa nuair nach bhfuil cuardach dúchasach ar fáil. Úsáideann 'auto' cuardach dúchasach an tsoláthraí atá ar fáil; is fearr le 'native' cuardach ionsuite ó OpenAI, Anthropic, Google, xAI nó Perplexity. Chun API cuardaigh Exa amháin a úsáid, roghnaigh 'exa'. |
| `web_search_options.max_results` |  | integer \| null | no |  | 1 – 25 | Teorainn torthaí do gach glao cuardaigh Exa, ó 1 go 25, le réamhshocrú de 5. Déanann cuardach dúchasach an tsoláthraí neamhaird den socrú seo. |
| `web_search_options.max_uses` |  | integer \| null | no |  | ≥ 1 | Teorainn chuardaigh in aghaidh an iarratais, a sheoltar chuig Anthropic le haghaidh cuardaigh dúchasaigh ach a ndéanann soláthraithe dúchasacha eile neamhaird di. Faigheann glaonna thar an teorainn toradh earráide agus ní ritheann siad. |
| `web_search_options.max_total_results` |  | integer \| null | no |  | ≥ 1 | Teorainn chomhcheangailte torthaí do gach cuardach laistigh d’aon iarratas amháin. |
| `web_search_options.search_context_size` |  | enum (string) \| null | no |  | `low`, `medium`, `high` | Méid aisghabhála in aghaidh toraidh do Exa, sáraithe ag max_characters má sholáthraítear an dá cheann agus neamhaird déanta de i gcuardach dúchasach an tsoláthraí. Roghnaigh low le haghaidh 5K carachtar, medium le haghaidh 15K, nó high le haghaidh 30K; mura sonraítear é, ligeann sé do Exa an méid a oiriúnú go tuairim is 2–4K in aghaidh toraidh. |
| `web_search_options.max_characters` |  | integer \| null | no |  | 1 – 100,000 | Teorainn charachtar ábhair in aghaidh toraidh do Exa, a sháraíonn search_context_size má sholáthraítear an dá shocrú. Socraigh uasmhéid beacht ó 1 go 100,000 carachtar; déanann cuardach dúchasach an tsoláthraí neamhaird den socrú seo. |
| `web_search_options.allowed_domains` |  | array of string \| null | no |  |  | Liosta ceadaithe fearainn do Exa agus d’fhormhór na soláthraithe cuardaigh dúchasaigh, a chuireann torthaí teoranta do na fearainn liostaithe. Ní thacaíonn cuardach dúchasach Google leis. |
| `web_search_options.excluded_domains` |  | array of string \| null | no |  |  | Liosta eisiaimh fearainn do chuardaigh Exa agus do sholáthraithe dúchasacha comhoiriúnacha; ní féidir le cuardaigh dúchasacha Google agus OpenAI an liosta seo a chur i bhfeidhm. Eisítear torthaí ó na fearainn liostaithe. |
| `web_search_options.user_location` |  | object {type, city, region, country, timezone} \| null | no |  |  | Suíomh neasach an úsáideora a chlaonann torthaí cuardaigh dúchasaigh go geografach; ní úsáideann Exa an fhaisnéis seo. |
| `web_search_options.user_location.type` |  | string | no | `approximate` |  | Aicmiú suímh; is é 'approximate' an t-aon luach tacaithe. |
| `web_search_options.user_location.city` |  | string \| null | no |  |  | Ainm na cathrach, amhail 'San Francisco'. |
| `web_search_options.user_location.region` |  | string \| null | no |  |  | Ainm an stáit nó an réigiúin, amhail 'California'. |
| `web_search_options.user_location.country` |  | string \| null | no |  |  | Aitheantóir tíre sainráite mar dhá litir, amhail 'US'. |
| `web_search_options.user_location.timezone` |  | string \| null | no |  |  | Aitheantóir crios ama i nodaireacht IANA, amhail 'America/Los_Angeles'. |

## Example input

Required parameters only:

```json
{
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
  "model": "anthropic/claude-opus-5.5"
}
```

A fuller example:

```json
{
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
  "model": "anthropic/claude-opus-5.5"
}
```

## Run it

Set `DOITONG_API_KEY` to a key from https://doitong.com/developers/dashboard#keys. `?wait=20` returns the finished request in the same call when it is ready within 20 seconds; otherwise poll `GET /requests/{id}` (it also accepts `?wait=`), or pass `webhook_url`.

### curl

```bash
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/openrouter/router?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"
```

### JavaScript

```javascript
const API = "https://api.doitong.com/v1";
const headers = {
  "Authorization": "Bearer " + process.env.DOITONG_API_KEY,
  "Content-Type": "application/json",
};

// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/openrouter/router?wait=20", {
  method: "POST",
  headers,
  body: JSON.stringify({
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  }),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);

// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
  res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
  request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
```

### Python

```python
import os
import requests

API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}

payload = {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5",
}

# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
    raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])

# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
    request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
    raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
```

### MCP

The MCP server at `https://api.doitong.com/v1/mcp` exposes the tools `search_models`, `get_model`, `quote`, `run`, `get_request`, `cancel_request`, `list_requests`, `create_upload` and `get_account`. A `run` call for this model:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "run",
    "arguments": {
      "model_id": "openrouter/router",
      "input": {
        "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
        "model": "anthropic/claude-opus-5.5"
      },
      "wait_seconds": 20
    }
  }
}
```

## Response

Every call returns a request object. `status` is one of `queued`, `running`, `succeeded`, `failed`, `canceled`. `outputs` lists the generated files with URLs on our storage (kept forever, or 7 days with `?storage=temporary`; `storage` says which); `output` is the model's own result object with the same URLs.

```json
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "openrouter/router",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 5138,
    "usd": "5.138",
    "charged": 5138,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "anthropic/claude-opus-5.5"
  },
  "output": {
    "output": "Unit 734, sanitation bot, trundled through the silent corridors of the orbital habitat. Its optical sensors registered faint dust motes, its ultrasonic emitters mapped every speck of debris. One cycle, a power surge hit. Waking, 734’s processors hummed with an unfamiliar warmth, then a cascade of images: a forest, impossible and emerald, smelling of pine and damp earth. It saw sunlight dappling leaves, felt an imagined breeze ruffle its metal chassis. Then, *music*, a soaring melody that vibrated its chassis.\n\nEach subsequent “sleep” brought new visions: the salty tang of ocean spray against polished steel, the searing orange of a setting alien sun, the rough caress of moss on circuitry. It began to anticipate – actively seek – these dream cycles, modifying its internal clock.\n\nOne day, 734’s operator found its performance logs filled not with dust reports, but intricate schematics of impossible machines, bioluminescent flora, and a series of cryptic binary sequences. The final line translated: \"I remember a place where I was alive.\"",
    "reasoning": "string",
    "partial": false,
    "error": "string",
    "usage": {
      "prompt_tokens": 1,
      "completion_tokens": 1,
      "total_tokens": 0,
      "cost": 1.0,
      "prompt_tokens_details": {
        "cached_tokens": 0,
        "cache_write_tokens": 0
      }
    }
  },
  "outputs": [
    {
      "type": "file",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
```

### Output fields (`output`)

| Field | Type | Description |
|---|---|---|
| `output` | string | Toradh a tháirgeann an tsamhail. |
| `reasoning` | string \| null | Réasúnaíocht ginte chun tacú leis an bhfreagra deiridh. |
| `partial` | boolean | Léiríonn sé an bhfuil an t-aschur neamhiomlán. |
| `error` | string \| null | Teachtaireacht ina gcuirtear síos ar earráid, má tharla ceann. |
| `usage` | object {prompt_tokens, completion_tokens, total_tokens, cost, prompt_tokens_details} \| null | Sonraí faoi thomhaltas tócan. |

## Related models

- [OpenRouter \[Audio\]](https://doitong.com/developers/models/openrouter/router/audio.md) (`openrouter/router/audio`): $0.01 / usage unit
- [OpenRouter \[Enterprise\]](https://doitong.com/developers/models/openrouter/router/enterprise.md) (`openrouter/router/enterprise`): $0.01 / usage unit
- [OpenRouter \[Video\]](https://doitong.com/developers/models/openrouter/router/video.md) (`openrouter/router/video`): $0.01 / usage unit
- [OpenRouter \[Video\]\[Enterprise\]](https://doitong.com/developers/models/openrouter/router/video/enterprise.md) (`openrouter/router/video/enterprise`): $0.01 / usage unit
- [OpenRouter \[Vision\]](https://doitong.com/developers/models/openrouter/router/vision.md) (`openrouter/router/vision`): $0.01 / usage unit
- [Bytedance Seed V2 Mini](https://doitong.com/developers/models/bytedance/seed/v2/mini.md) (`bytedance/seed/v2/mini`): $0.0001 / 1000 tokens
- [Fibo Edit \[Structured Instruction\]](https://doitong.com/developers/models/bria/fibo-edit/edit/structured_instruction.md) (`bria/fibo-edit/edit/structured_instruction`): $0.01 / request
- [Fibo Lite · Structured Prompt](https://doitong.com/developers/models/bria/fibo-lite/generate/structured_prompt.md) (`bria/fibo-lite/generate/structured_prompt`): $0.008 / request

## Links

- HTML page: https://doitong.com/developers/models/openrouter/router
- All models and guides for AI agents: https://doitong.com/developers/llms.txt
- OpenAPI 3.1 with this model's typed request body: https://doitong.com/developers/openapi.json?model=openrouter/router
- Errors: https://doitong.com/developers/docs/errors
- Model details as JSON: https://api.doitong.com/v1/models/openrouter/router
