# OpenRouter [Vision] API

> کیپشن، OCR یا بصری سوال و جواب کے لیے تصاویر یا PDFs والے پرامپٹ کو منتخب کیے جانے والے ملٹی موڈل LLM تک بھیجتا ہے

ایک `prompt` اور `model` میں بصارت کے قابل زبان ماڈل کا نام لیتا ہے، پھر متن کا جواب لوٹاتا ہے۔ تصاویر `image_urls` کے ذریعے اور دستاویزات `pdf_urls` کے ذریعے منسلک کریں، جو صرف PDF فائلیں قبول کرتا ہے۔ `system_prompt`، 0 سے 2 تک `temperature`، `max_tokens`، اختیاری استدلالی آؤٹ پٹ اور ویب سرچ بھی سپورٹ کرتا ہے۔

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

## Pricing

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

The full example input below holds up to $14.34 = 14340 API credits (up to 1434 units × $0.01) when it starts; a typical run costs $0.026 (26 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/vision` 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

Send either the canonical name or the native field name (not both). Canonical names are the same across models.

| Parameter | Canonical name | Type | Required | Default | Allowed values / range | Description |
|---|---|---|---|---|---|---|
| `image_urls` | `images` | array of image URL \| null | no |  |  | پروسیسنگ کے لیے تصاویر کی شناخت کرنے والے URLs۔ |
| `pdf_urls` |  | array of string \| null | no |  |  | دستاویز کے مقامات صرف PDFs کی فہرست کی صورت میں فراہم کریں: .pdf فائلوں کی طرف اشارہ کرنے والے http(s) URLs یا data:application/pdf;base64,... کی صورت میں data URIs۔ OpenRouter کا دستاویز پارسر انہیں اس وقت ہینڈل کرتا ہے جب ماڈل مقامی طور پر PDFs پروسیس نہ کر سکے۔ |
| `prompt` |  | string | yes |  |  | تصویر پر لاگو کیا جانے والا پرامپٹ۔ |
| `system_prompt` |  | string \| null | no |  |  | ماڈل کو ہدایات یا context فراہم کرنے والا system پرامپٹ۔ |
| `model` |  | string | yes |  |  | چلائے جانے والے ماڈل کی شناخت کرنے والا نام۔ |
| `reasoning` |  | boolean | no | `false` |  | حتمی جواب میں reasoning شامل کرنا ہے یا نہیں۔ |
| `temperature` |  | number | no | `1` | 0 – 2 | جواب کی variability کو کنٹرول کرتا ہے؛ ان پٹ نہ بدلنے پر 0 یکساں جواب کی ضمانت دیتا ہے۔ قدر بڑھانے سے جوابات قابل پیش گوئی اور عام جوابات سے ہٹ کر زیادہ متنوع اور کم عام ہوتے ہیں۔ |
| `max_tokens` |  | integer \| null | no |  | ≥ 1 | جواب کے تخلیق کردہ ٹوکنز کی حد مقرر کریں، جو context length میں سے پرامپٹ length منہا کرنے کے نتیجے سے زیادہ نہ ہو۔ تخلیق مقررہ حد سے تجاوز نہیں کر سکتی۔ |
| `enable_web_search` |  | boolean | no | `false` |  | Web رسائی toggle، جو ماڈل کو یہ منتخب کرنے دیتا ہے کہ کب اور آیا تلاش کرنی ہے، بشمول ایک درخواست کے اندر متعدد تلاشیں۔ تلاشیں real-time معلومات حاصل کرنے کے لیے OpenRouter کا server-side web search tool استعمال کرتی ہیں۔ |
| `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 |  |  | Web search configuration، جس میں engine selection، نتائج کی حدود اور domain filtering شامل ہیں۔ صرف اس وقت استعمال ہوتی ہے جب enable_web_search true ہو۔ |
| `web_search_options.engine` |  | enum (string) | no | `auto` | `auto`, `native`, `exa` | Search engine selection: 'auto' اور 'native' دونوں native search دستیاب نہ ہونے پر Exa پر واپس آتے ہیں۔ 'auto' دستیاب provider-native search استعمال کرتا ہے؛ 'native' OpenAI، Anthropic، Google، xAI یا Perplexity کی built-in search کو ترجیح دیتا ہے۔ صرف Exa کی search API استعمال کرنے کے لیے 'exa' منتخب کریں۔ |
| `web_search_options.max_results` |  | integer \| null | no |  | 1 – 25 | ہر Exa search call کے نتائج کی حد، 1 سے 25 تک، ڈیفالٹ 5 ہے۔ Native provider search اس setting کو نظرانداز کرتی ہے۔ |
| `web_search_options.max_uses` |  | integer \| null | no |  | ≥ 1 | فی درخواست search cap، native search کے لیے Anthropic کو بھیجی جاتی ہے مگر دیگر native providers نظرانداز کرتے ہیں۔ cap سے زیادہ calls کو error result ملتا ہے اور وہ چلتی نہیں۔ |
| `web_search_options.max_total_results` |  | integer \| null | no |  | ≥ 1 | ایک درخواست کے اندر تمام searches کے نتائج کی مشترکہ حد۔ |
| `web_search_options.search_context_size` |  | enum (string) \| null | no |  | `low`, `medium`, `high` | Exa کے لیے فی نتیجہ retrieval مقدار؛ دونوں فراہم ہونے پر max_characters اسے supersede کرتا ہے اور native provider search اسے نظرانداز کرتی ہے۔ 5K حروف کے لیے low، 15K کے لیے medium یا 30K کے لیے high منتخب کریں؛ اسے نہ بتانے پر Exa فی نتیجہ تقریباً 2–4K کے مطابق مقدار طے کرتا ہے۔ |
| `web_search_options.max_characters` |  | integer \| null | no |  | 1 – 100,000 | Exa کے لیے فی نتیجہ content حروف کی حد، دونوں settings فراہم ہونے پر search_context_size کو override کرتی ہے۔ 1 سے 100,000 حروف تک exact maximum مقرر کریں؛ native provider search اس setting کو نظرانداز کرتی ہے۔ |
| `web_search_options.allowed_domains` |  | array of string \| null | no |  |  | Exa اور زیادہ تر native search providers کے لیے domain allowlist، نتائج کو درج domains تک محدود کرتی ہے۔ Google native search اسے support نہیں کرتی۔ |
| `web_search_options.excluded_domains` |  | array of string \| null | no |  |  | Exa searches اور compatible native providers کے لیے domain exclusion list؛ Google اور OpenAI native searches اس فہرست کو لاگو نہیں کر سکتیں۔ درج domains سے آنے والے نتائج خارج کر دیے جاتے ہیں۔ |
| `web_search_options.user_location` |  | object {type, city, region, country, timezone} \| null | no |  |  | صارف کا تقریباً مقام، جو native search results کو جغرافیائی طور پر متاثر کرتا ہے؛ Exa یہ معلومات استعمال نہیں کرتا۔ |
| `web_search_options.user_location.type` |  | string | no | `approximate` |  | مقام کی درجہ بندی؛ صرف معاون value 'approximate' ہے۔ |
| `web_search_options.user_location.city` |  | string \| null | no |  |  | شہر کا نام، جیسے 'San Francisco'۔ |
| `web_search_options.user_location.region` |  | string \| null | no |  |  | ریاست یا خطے کا نام، جیسے 'California'۔ |
| `web_search_options.user_location.country` |  | string \| null | no |  |  | دو حروف میں ملک کا شناخت کنندہ، جیسے 'US'۔ |
| `web_search_options.user_location.timezone` |  | string \| null | no |  |  | IANA notation میں timezone شناخت کنندہ، جیسے 'America/Los_Angeles'۔ |

File parameters (`images`) take a public `https://` URL, a `data:` URI up to 10 MB, or the `file_url` of an upload from `POST /files`.

## Example input

Required parameters only:

```json
{
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
  "model": "openai/gpt-6-sol"
}
```

A fuller example:

```json
{
  "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
  "model": "openai/gpt-6-sol"
}
```

## 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/vision?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": "openai/gpt-6-sol"
  }'

# 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/vision?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": "openai/gpt-6-sol"
  }),
});
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": "openai/gpt-6-sol",
}

# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openrouter/router/vision", 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/vision",
      "input": {
        "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
        "model": "openai/gpt-6-sol"
      },
      "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/vision",
  "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": 14340,
    "usd": "14.34",
    "charged": 14340,
    "refunded": 0
  },
  "input": {
    "prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
    "model": "openai/gpt-6-sol"
  },
  "output": {
    "output": "A close-up of a tiger's face focusing on its bright orange iris and the area around its eye, with white fur eyebrows and a contrasting black and rich orange striped fur pattern. The word \"FLUX\" is overlaid in bold, white, brush-stroke styled text across the tiger's face.",
    "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 | ماڈل سے تیار کردہ نتیجہ۔ |
| `usage` | object {prompt_tokens, completion_tokens, total_tokens, cost, prompt_tokens_details} \| null | ٹوکن کے استعمال کی تفصیلات۔ |

## Related models

- [OpenRouter](https://doitong.com/developers/models/openrouter/router.md) (`openrouter/router`): $0.01 / usage unit
- [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
- [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/vision
- 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/vision
- Errors: https://doitong.com/developers/docs/errors
- Model details as JSON: https://api.doitong.com/v1/models/openrouter/router/vision
