pdfmux/blog
pdf-extraction

Gemini vs Mistral OCR for PDF Extraction: Which One to Use

TL;DRGemini is a general vision-language model; Mistral OCR is a dedicated document API. Compare architecture, pricing, output shape, and when to use each.

Direct answer: Mistral OCR and Gemini solve PDF extraction from opposite ends. Mistral OCR (mistral-ocr-latest) is a dedicated, single-purpose API: send a page, get back Markdown with tables and structure preserved, at a low fixed per-page price. Gemini (2.5 Flash or 2.5 Pro) is a general-purpose vision-language model you prompt: send a page and instructions, get back whatever you asked for — free-form Markdown, a JSON object matching your schema, or an answer to a question about the document. Reach for Mistral OCR when the job is “transcribe this document accurately and cheaply.” Reach for Gemini when the job needs judgment — messy layouts, custom field extraction, or reasoning about content the page doesn’t state directly.


Two different tools wearing the same label

“OCR” undersells what either of these does, and it overstates what one of them is built for. Neither is a classic OCR engine in the Tesseract sense — both understand layout, not just glyphs. But they are not interchangeable.

Mistral OCR is purpose-built for one job. You call client.ocr.process(), point it at a document, and get back a page-by-page Markdown transcription with tables, headings, and math preserved. There is no prompt, because there is nothing to prompt — the model’s entire job is faithful transcription plus light structure recovery.

Gemini is a general model you’re pointing at a document task. There is no dedicated OCR endpoint. You send the PDF (or page images) as input alongside a text instruction, the same way you’d send any other multimodal request. That instruction can be “transcribe this page as Markdown” — which makes it behave like an OCR tool — or it can be “pull the invoice number, vendor name, and total, and return them as JSON matching this schema,” which an OCR-only model cannot do without a second pass.

That distinction is the whole comparison. Mistral trades flexibility for a narrower, cheaper, more predictable job. Gemini trades a higher per-page cost and less predictable latency for the ability to reason about what’s on the page, not just read it.


Calling Mistral OCR

import os
from mistralai import Mistral

client = Mistral(api_key=os.environ["MISTRAL_API_KEY"])

resp = client.ocr.process(
    model="mistral-ocr-latest",
    document={
        "type": "document_url",
        "document_url": "https://example.com/invoice.pdf",
    },
    include_image_base64=True,
)

for page in resp.pages:
    print(f"--- page {page.index} ---")
    print(page.markdown)

One call, one model name, no prompt to design. The output shape never changes: a list of pages, each with Markdown and any extracted images. For a fuller walkthrough — multilingual pages, cost model, where it falls short — see Mistral OCR for PDF-to-Markdown conversion.

Calling Gemini

import os
from google import genai
from google.genai import types

client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

with open("invoice.pdf", "rb") as f:
    doc_bytes = f.read()

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents=[
        types.Part.from_bytes(data=doc_bytes, mime_type="application/pdf"),
        "Transcribe this document as Markdown. Preserve table structure and reading order.",
    ],
)

print(response.text)

Same shape of call — bytes in, text out — but the third argument, the instruction, is where the real difference lives. Swap that string and the same model call becomes something Mistral OCR fundamentally cannot do:

from pydantic import BaseModel

class Invoice(BaseModel):
    invoice_number: str
    vendor_name: str
    total_amount: float
    line_items: list[str]

response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents=[
        types.Part.from_bytes(data=doc_bytes, mime_type="application/pdf"),
        "Extract the invoice fields.",
    ],
    config=types.GenerateContentConfig(
        response_mime_type="application/json",
        response_schema=Invoice,
    ),
)

invoice = Invoice.model_validate_json(response.text)

Mistral OCR has no equivalent — it hands you Markdown, and you write the parsing step yourself, the way the financial statement extraction guide does with a custom JSON schema layered on top of raw extraction. Gemini folds that step into the same call, at the cost of trusting a general model’s field extraction instead of your own parsing logic.


Pricing: what pdfmux actually charges internally for each

pdfmux ships both as BYOK (bring-your-own-key) backends, and its own per-page cost estimates for routing decisions are:

BackendCost per page (pdfmux estimate)
mistral_ocr$0.002
Gemini 2.5 Flash / 2.5 Pro (BYOK)~$0.01

These are pdfmux’s internal estimates for its own router, not official published vendor rate cards — Gemini in particular is billed per token, not per page, so actual cost scales with page density and output length rather than being a flat per-page fee. For current, authoritative pricing, check Mistral’s pricing page and the Gemini API pricing page directly before budgeting a large job — both vendors have adjusted rates before and will again.

The directional point holds regardless of the exact current numbers: a dedicated OCR endpoint doing one narrow job is cheaper per page than a general reasoning model doing the same job, because you’re not paying for reasoning capacity you don’t need on a page that just needs transcribing.


Output shape and what breaks

Mistral OCR returns one Markdown block per page plus an image list. Predictable, easy to test against — the same document sent twice returns structurally identical output. What breaks: anything that isn’t transcription. It won’t summarize, won’t answer a question about the document, won’t restructure a table into a schema you define. You get exactly what’s on the page, reformatted.

Gemini returns whatever the prompt and schema ask for. That flexibility is also the failure mode: a vision-LLM extracting fields it wasn’t explicitly told are present can infer a plausible-looking value instead of returning null, especially on a low-confidence read of a handwritten field. A schema with required fields forces the model to commit to a value even when it should be less sure. Guard against this by checking extracted values against page content programmatically where you can (a total that doesn’t match the sum of line items, for instance) rather than trusting the JSON at face value — the same discipline as the arithmetic validation step in the financial-statement guide.


Latency and reliability in production

The two also behave differently once you’re running them at volume instead of testing one call in a notebook.

Mistral OCR’s job is narrow, so its failure modes are narrow too. It either transcribes the page or it doesn’t. A malformed or corrupted input tends to produce a clear error rather than a plausible-looking wrong answer, because there’s no reasoning step that can paper over a bad read with an inferred guess. Retries are simple: same request, same expected shape back.

Gemini’s failure modes are the ones a reasoning model has. A response schema with required fields forces a value even on a page where the true answer is “not present” — the model has to pick something, and it may pick something plausible instead of correct. This matters more on pages near the edge of what the prompt anticipated: an invoice with a discount line item you didn’t put in the schema, a form with a field the model interprets differently than you intended. Build validation around outputs you can check programmatically (does a computed total match a stated total, does a date parse, does a required field come back non-empty) the same way the financial statement guide validates balance-sheet arithmetic instead of trusting extracted numbers directly.

Rate limits and batching differ too. Mistral OCR’s per-page pricing and narrow job make it straightforward to fire off a large batch of pages in parallel and expect uniform latency per page. Gemini’s latency varies more with output length and prompt complexity — a page that needs the model to reason through a long list of line items takes longer than a page that just needs a short JSON object back. If you’re processing a queue of thousands of documents, budget for that variance rather than assuming a flat per-page time, and prefer 2.5 Flash over 2.5 Pro when latency matters more than the marginal accuracy gain on harder pages.

Side-by-side

DimensionMistral OCRGemini (2.5 Flash / Pro)
What it isDedicated OCR/document APIGeneral vision-language model
InterfaceNo prompt — fixed jobPrompt + optional response schema
OutputPage-scoped Markdown + imagesWhatever the prompt/schema specifies
Cost modelFlat per pagePer token (page-density dependent)
Custom field extractionNo — you parse the Markdown yourselfYes — response schema does it in one call
Reasoning about contentNoYes
Best forHigh-volume, structure-preserving OCRMessy layouts, custom schemas, judgment calls
Data residencyHosted — pages sent to MistralHosted — pages sent to Google
Local/offline optionNoNo

Neither runs on your machine. If documents cannot leave your environment, this comparison doesn’t apply to you — look at a local OCR backend instead, covered in PDF extraction without a GPU.


A decision path

  1. Is the job “transcribe accurately,” full stop? Use Mistral OCR. It’s cheaper, faster to integrate, and gives you Markdown you parse yourself with full control.
  2. Does the job need a specific schema, or judgment about ambiguous content? Use Gemini with response_schema. You’re paying for reasoning; use it.
  3. Is the corpus mixed — some pages need transcription, some need judgment? Route per page rather than picking one for the whole corpus. This is exactly the routing problem pdfmux’s router exists to solve — classify each page, send Mistral-shaped pages to Mistral, and reserve Gemini calls for the pages that actually need reasoning.
  4. Can you validate the vendor’s own accuracy claims against your documents? Neither vendor’s published numbers were measured on your corpus. Run 20-50 representative pages through both before committing, the same practice covered in benchmarking PDF extractors.

Picking one for an entire pipeline is usually the wrong question. The cheaper, narrower tool should handle everything it can do reliably; the more expensive, general one should only see the pages that actually need it.

Last updated: September 2026.

Frequently asked questions

Which one is more accurate?

There is no independent, apples-to-apples benchmark comparing the two on the same corpus — only vendor-published numbers on vendor-chosen test sets, which is not a fair comparison. Run your own 20-50 representative pages through both before picking one for production, the same advice that applies to every extractor claim in this space.

Can I use both in the same pipeline?

Yes. They solve different problems well: Mistral OCR for cheap, structure-preserving OCR at volume; Gemini for pages that need reasoning, not just transcription — messy layouts, mixed instructions, or a custom schema. pdfmux exposes both as BYOK backends and can route between them per page.

Does either one run locally?

No. Both are hosted APIs — pages leave your environment for either one. If documents cannot leave your infrastructure, neither is an option; look at a local tool with an OCR extra instead, such as RapidOCR or Surya.

Which is cheaper at scale?

Mistral OCR is priced per page and is meaningfully cheaper per page than a general vision-LLM call for the same document, because it is a narrow, single-purpose endpoint rather than a full reasoning model. See the pricing section below for the actual numbers and where to verify current rates.