OCRRouter
Hosted remote MCP for OCR: PDFs/images to Markdown with tables or JSON. Free Jina & DeepSeek-OCR models (50k pages/mo), plus Mistral, Gemini, GPT, Textract and more with auto-routing.
Hosted MCP Server
npx add-mcp 'https://api.ocrrouter.ai/v1/mcp'Installs into Claude Code, Codex, Cursor and more
Documentation
Quickstart
Create an API key, then send a file. New accounts start with 50 free credits.
curl https://api.ocrrouter.ai/v1/ocr \
-H "Authorization: Bearer $OCRROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"file_url": "https://example.com/invoice.pdf",
"format": "markdown"
}'
Request
POST https://api.ocrrouter.ai/v1/ocr with a JSON body and an Authorization: Bearer header.
| model | string | A model ID such as mistral/mistral-ocr, or auto. |
|---|---|---|
| file_url | string | Public URL of a PDF or image. Use one of file_url, file_base64 or file_id. |
| file_base64 | string | The file as base64, up to 20 MB. |
| file_id | string | ID returned by POST /v1/files, for larger files. |
| format | string | markdown (default), json, text, html, csv, docx or xlsx. |
| pages | string | Page range, for example 1-5,8. Defaults to all pages. |
| fallbacks | string[] | Model IDs to try, in order, if the first model fails. |
| route | string | With model auto: quality (default), cheapest or fastest. |
| filename | string | Optional name shown in your activity log. |
Other endpoints:
GET /v1/modelslists every model, its price and whether it is available. No key needed.POST /v1/filestakes a multipart upload with afilefield and returns afile_idthat works for 24 hours.GET /v1/requests/:idreturns an earlier result. Add?format=with any output format to get it in another one.GET /v1/creditsreturns your balance and this key's usage.POST /v1/keys/temporaryreturns a temporary key with 50 credits. No sign-up, one per day.
Output formats
markdown
The whole document as Markdown. Tables are GitHub-flavoured tables, formulas are wrapped in $...$, and pages are separated by <!-- page:N -->.
json
The same structure from every model: pages, each with typed blocks. Block types are heading, paragraph, list, table, formula, image, header and footer. bbox, confidence and page size are null when the model does not provide them, which is the case for the models live today.
{"id": "req_8f2c1a41d0b3c7e9a2","model": "mistral/mistral-ocr","format": "json","attempts": [{ "model": "mistral/mistral-ocr", "ok": true, "ms": 1180 }],"pages": [{"index": 1,"width": null,"height": null,"blocks": [{"type": "heading","level": 1,"text": "Invoice INV-2041","bbox": null,"confidence": null},{"type": "paragraph","text": "Acme Supply Co.\n14 Harbour Street, Sydney NSW 2…","bbox": null,"confidence": null},{"type": "table","rows": [["Item", "Qty", "Unit price", "Amount"],["A4 paper, 5 reams", "4", "$24.00", "$96.00"]],"markdown": "| Item | Qty | Unit price | Amount |\n|---|---|-…","bbox": null,"confidence": null}]}],"usage": {"pages": 1,"credits": 25,"latency_ms": 1180,"cached": false}}
text, html, csv, docx, xlsx
The Markdown response plus an output object holding a file: format, filename, mime_type, encoding and data. text, html and csv are UTF-8 strings (encoding: "utf8"); docx and xlsx are base64 (encoding: "base64"). csv and xlsx hold the tables (one sheet per table), or the text lines when there are none. txt is accepted as another name for text.
{"id": "req_8f2c1a41d0b3c7e9a2","model": "mistral/mistral-ocr","format": "docx","attempts": [{ "model": "mistral/mistral-ocr", "ok": true, "ms": 1180 }],"markdown": "<!-- page:1 -->\n# Invoice INV-2041\n…","pages": [{ "index": 1, "markdown": "# Invoice INV-2041\n…" }],"output": {"format": "docx","filename": "invoice.docx","mime_type": "application/vnd.openxmlformats-officedocument.w…","encoding": "base64","data": "UEsDBBQAAAAIA…"},"usage": {"pages": 1,"credits": 25,"latency_ms": 1180,"cached": false}}
Routing and fallbacks
Set model to auto and we choose a model for each document. Use route to say what matters: cheapest, fastest or quality.
Add fallbacks to keep working through outages. If the first model errors or is rate-limited, the next one runs. The response tells you which model answered, and you pay only for that one.
{"model": "mistral/mistral-ocr","fallbacks": ["google/gemini-flash", "tesseract/tesseract"],"file_url": "https://example.com/report.pdf"}
Credits
Each model has a price in credits per page. $1 buys 1,000 credits and they do not expire. Every response includes usage.credits.
- Failed and empty results are free.
- Sending the same file to the same model again is served from cache for free.
- Each API key can have its own credit limit.
Errors
400The request is malformed or the file type is not supported.
401The API key is missing or revoked.
402Not enough credits, or the key hit its credit limit.
413The file is larger than the limit for this model.
429Too many requests. Retry after the time in the Retry-After header.
502Every model in the fallback chain failed. You are not charged.
503The model you asked for is not connected yet.
Agents, MCP and CLI
OCRRouter runs a remote MCP server at https://api.ocrrouter.ai/v1/mcp with two tools: ocr (a PDF or image URL or base64 to Markdown or JSON) and list_models. Send your API key in the Authorization header. Jina OCR and DeepSeek-OCR are free, up to 50,000 pages a month per account. Agents without an account can get a temporary key with 50 credits from POST /v1/keys/temporary, one per day.
# Remote MCP server for Claude Code
claude mcp add --transport http ocrrouter https://api.ocrrouter.ai/v1/mcp \
--header "Authorization: Bearer YOUR_API_KEY"
# Cursor, Windsurf and other clients (mcp.json)
{
"mcpServers": {
"ocrrouter": {
"url": "https://api.ocrrouter.ai/v1/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}