Mistral PDF OCR
/install extracting-mistral-ocr
Mistral OCR PDF extraction
Quick start (default)
Run the bundled script to OCR a local PDF and write Markdown + JSON outputs:
python {baseDir}/scripts/mistral_ocr_extract.py --input path/to/file.pdf --out out/ocr
Output directory layout:
combined.md(all pages concatenated)pages/page-000.md(per-page markdown)raw_response.json(full OCR response)images/(decoded embedded images, if requested)tables/(separate tables, if requested)
Workflow
-
Pick input mode
- Local PDF (most common): upload via Files API, then OCR via
file_id. - Public URL: OCR directly via
document_url.
- Local PDF (most common): upload via Files API, then OCR via
-
Choose output fidelity (defaults are safe for RAG)
- Keep
table_format=inlineunless the user explicitly wants tables split out. - Set
--include-image-base64when the user needs figures/diagrams extracted. - Use
--extract-header/--extract-footerif header/footer noise hurts downstream search.
- Keep
-
Run OCR
- Use
scripts/mistral_ocr_extract.pyto produce a deterministic on-disk artefact set.
- Use
-
(Optional) Structured extraction from the whole document
- If the user wants fields (invoice totals, contract parties, etc.), provide an annotation prompt.
- The OCR API can return a document-level
document_annotationin addition to page markdown.
Example:
python {baseDir}/scripts/mistral_ocr_extract.py \ --input invoice.pdf \ --out out/invoice \ --annotation-prompt "Extract supplier_name, invoice_number, invoice_date (ISO-8601), currency, total_amount. Return JSON." \ --annotation-format json_object
Decision rules
- If the PDF is local and not publicly accessible, upload it (the script does this automatically).
- If the PDF URL is private or requires authentication, do not pass it as
document_url; upload instead. - If output quality is critical, prefer
table_format=htmlfor downstream parsing over brittle regex.
Common failure modes
- Missing
MISTRAL_API_KEY: set it in the environment before running. - URL OCR fails: the URL likely is not publicly accessible; upload the file.
- Large files: upload supports large files, but very large PDFs may need page selection (
--pages) or batch processing.
References
- API + parameters:
references/mistral_ocr_api.md - Output mapping rules (placeholders to extracted images/tables):
references/output_mapping.md - Example annotation prompts for common document types:
references/annotation_prompts.md
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install extracting-mistral-ocr - After installation, invoke the skill by name or use
/extracting-mistral-ocr - Provide required inputs per the skill's parameter spec and get structured output
What is Mistral PDF OCR?
Extracts text, tables, and images from PDFs (including scanned PDFs) using the Mistral OCR API. Use when user asks to OCR a PDF/image, extract text from a PD... It is an AI Agent Skill for Claude Code / OpenClaw, with 573 downloads so far.
How do I install Mistral PDF OCR?
Run "/install extracting-mistral-ocr" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Mistral PDF OCR free?
Yes, Mistral PDF OCR is completely free (open-source). You can download, install and use it at no cost.
Which platforms does Mistral PDF OCR support?
Mistral PDF OCR is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Mistral PDF OCR?
It is built and maintained by Tristan Manchester (@tristanmanchester); the current version is v1.0.0.