PDF Processing
End-to-end guide to PDF ingestion in FastRouter chat completions, including plugin config, request examples, and billing details.
Introduction
FastRouter supports PDF understanding in chat completions by attaching PDFs to messages and enabling the file-parser plugin with the mistral-ocr engine.
This allows you to ask questions about PDFs (including scanned/image PDFs) using your chosen chat model—FastRouter will OCR/parse the document and provide the extracted text to the model.
Pricing: PDF OCR via mistral-ocr is billed at $2 / 1,000 pages, in addition to normal model token usage.
Note: If you’re using a model with native document understanding (e.g., openai/gpt-4.1), you can leverage the model’s built-in document processing — no plugin may be needed.
Endpoint
POST https://api.fastrouter.ai/api/v1/chat/completions
How PDF processing works
When you include a PDF in messages[].content[] and enable the plugin:
FastRouter fetches/decodes the PDF (URL or base64)
Runs mistral-ocr to extract text (works well on scanned pages and embedded images)
Feeds the extracted content into the target model so it can answer your prompt
Plugin configuration (required for OCR)
Enable PDF processing with the plugins parameter:
Sending PDFs in messages
Attach PDFs inside a message’s content array using type: "file":
Supported file_data formats
Public URL (recommended):
https://.../file.pdfBase64 data URL (for local/private docs):
data:application/pdf;base64,JVBERi0xLjc...
Example: PDF via public URL
Example: PDF via base64 (data URL)
Use base64 when the PDF is local or not publicly reachable.
Pricing
mistral-ocr: $2 / 1,000 pages processed
Model tokens: billed normally for the model you select
Prefer URLs for large PDFs to avoid request size limits and base64 overhead.
Last updated
