Document OCR
POST /v1/ocr — a document or image in, markdown pages out; priced per page.
POST
https://iranrouter.com/v1/ocrDocument OCR: a PDF or image (a URL or a data URI) in, markdown per page out — Mistral OCR's shape. Priced per page processed; the rate is on the model's page.
curl https://iranrouter.com/v1/ocr \ -H "Authorization: Bearer ir-..." \ -H "Content-Type: application/json" \ -d '{ "model": "mistralai/mistral-ocr-latest", "document": { "type": "document_url", "document_url": "https://example.com/contract.pdf" }, "pages": [0, 1, 2] }'
{
"pages": [ { "index": 0, "markdown": "# ...", "images": [], "dimensions": { "dpi": 200, "height": 2200, "width": 1700 } } ],
"model": "mistralai/mistral-ocr-latest",
"usage_info": { "pages_processed": 3, "doc_size_bytes": 184230 },
"usage": { "cost_rial": 45000 }
}| Parameter | Notes |
|---|---|
document | {type: document_url, document_url} or {type: image_url, image_url}; a data URI works too. |
pages | Page numbers (from zero). Without it the whole document is read. |
include_image_base64 | Return the extracted images as base64. |
The wallet hold before processing is the pages you named in pages, else 10 pages; the final charge is computed from usage_info.pages_processed.