[Integrations](https://spiral.ai/integrations) › [opencode](https://spiral.ai/integrations/opencode) › [Mistral document OCR](https://spiral.ai/integrations/opencode/mistral-document-ocr)

# How to Use Mistral document OCR in opencode

Mistral document OCR extracts text, tables, and embedded images from PDFs and images, with optional structured JSON annotations. Use it to turn reports and scanned documents into content an agent can search, compare, or analyze.

|  |  |
| --- | --- |
| Model | Mistral document OCR |
| Available through | Mistral |
| Category | Data |
| Price | $0.0026 per page ($0.0039 with document or bounding-box annotations). |
| Returns | json |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Mistral document OCR in opencode

- Use Mistral document OCR on the Mistral 7B paper at https://arxiv.org/pdf/2310.06825 and save its extracted text and images in this project's research directory.
- Use Mistral document OCR on Apple's 2024 annual report PDF and build a CSV from its consolidated statements of operations, keeping the year headings attached to each column.
- Use Mistral document OCR on Attention Is All You Need at https://arxiv.org/pdf/1706.03762 and create a Markdown research note from the extracted methods and results text.
- Use Mistral document OCR on https://upload.wikimedia.org/wikipedia/foundation/f/f6/WMF_Mid-Year-Financials_08-09-FINAL.pdf and save the extracted financial tables as HTML fixtures in this project.
- Use Mistral document OCR on the first eight pages of Microsoft's 2024 annual report PDF and save structured JSON containing the document title, reporting period, and a short summary.

## How to set up Mistral document OCR in opencode

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the server**: Leave out `--global` to add Spiral to the current project only. No header and no client ID or secret: opencode registers itself with Spiral.

```bash
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
```

2. **Sign in**: Your browser opens. Sign in to Spiral, pick the organization and click Authorize, then return to the terminal. No API key. Inside opencode, `/mcps` starts the same sign-in.

```bash
opencode mcp auth spiral
```

3. **Check it**: Spiral shows as connected.

```bash
opencode mcp list
```

### Use the Spiral skill

1. **Send opencode this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Mistral document OCR**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "mistral",
    "model": "mistral-ocr-3",
    "input": {
      "document": {
        "document_url": "<document_url>"
      }
    }
  }'
```

Then paste one of the prompts above: opencode finds Mistral document OCR on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/opencode

## Mistral document OCR tools and prices

- [Mistral OCR 3](https://spiral.ai/tools/mistral/mistral-ocr-3) (Mistral): $0.0026 per page ($0.0039 with document or bounding-box annotations).

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| pages |  | — | Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0. |
| image_limit |  | — | Max images to extract |
| table_format | markdown, html | — |  |
| extract_footer |  | false | Extract the page footer into the response's `footer` field and remove it from the markdown content |
| extract_header |  | false | Extract the page header into the response's `header` field and remove it from the markdown content |
| image_min_size |  | — | Minimum height and width of image to extract |

## What can you do with Mistral document OCR in opencode?

Build a searchable report collection from PDF text, reconstructed tables, and extracted images. A coding agent can turn the results into project data files and add structured annotations for document summaries.

### Make annual reports searchable

Extract report text into Markdown for a company research index, then use it to find business segments, risks, and accounting notes.

### Recover financial tables

Extract tables from public company reports for spreadsheet analysis. Preserve merged headers so year labels stay associated with the right figures.

### Prepare research papers for analysis

Turn paper PDFs into extracted text and images that an agent can use to summarize methods, compare results, and inspect figures.

### Compare public document revisions

Extract two editions of a government report or business publication, then compare the text and tables to identify changes.

### Build a report metadata catalog

Use structured annotations to collect document titles, reporting periods, and summaries in a consistent JSON structure. Process long reports in sections of up to eight pages.

### Describe figures for document search

Annotate extracted charts and figures with descriptions that help users find the relevant visual inside a collection of public reports.

## Overview

- [Mistral](https://spiral.ai/providers/mistral)
- [All opencode guides](https://spiral.ai/integrations/opencode)

## Mistral document OCR in other agents

- [Amp](https://spiral.ai/integrations/amp/mistral-document-ocr)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/mistral-document-ocr)
- [Claude](https://spiral.ai/integrations/claude-desktop/mistral-document-ocr)
- [Claude Code](https://spiral.ai/integrations/claude-code/mistral-document-ocr)
- [Cline](https://spiral.ai/integrations/cline/mistral-document-ocr)
- [Codex](https://spiral.ai/integrations/codex/mistral-document-ocr)
- [Cursor](https://spiral.ai/integrations/cursor/mistral-document-ocr)
- [Devin](https://spiral.ai/integrations/devin/mistral-document-ocr)
- [dots](https://spiral.ai/integrations/dots/mistral-document-ocr)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/mistral-document-ocr)
- [Gemini](https://spiral.ai/integrations/gemini/mistral-document-ocr)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/mistral-document-ocr)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/mistral-document-ocr)
- [goose](https://spiral.ai/integrations/goose/mistral-document-ocr)
- [Grok](https://spiral.ai/integrations/grok/mistral-document-ocr)
- [Grok Build](https://spiral.ai/integrations/grok-build/mistral-document-ocr)
- [Hermes](https://spiral.ai/integrations/hermes/mistral-document-ocr)
- [Instinct](https://spiral.ai/integrations/instinct/mistral-document-ocr)
- [Manus](https://spiral.ai/integrations/manus/mistral-document-ocr)
- [Muse](https://spiral.ai/integrations/muse/mistral-document-ocr)
- [Muse Code](https://spiral.ai/integrations/muse-code/mistral-document-ocr)
- [n8n](https://spiral.ai/integrations/n8n/mistral-document-ocr)
- [Notion](https://spiral.ai/integrations/notion/mistral-document-ocr)
- [OpenClaw](https://spiral.ai/integrations/openclaw/mistral-document-ocr)
- [Perplexity](https://spiral.ai/integrations/perplexity/mistral-document-ocr)
- [Raycast](https://spiral.ai/integrations/raycast/mistral-document-ocr)
- [VS Code](https://spiral.ai/integrations/vscode/mistral-document-ocr)
- [Windsurf](https://spiral.ai/integrations/windsurf/mistral-document-ocr)
- [Zapier](https://spiral.ai/integrations/zapier/mistral-document-ocr)

## More opencode guides

- [Mistral OCR document extraction](https://spiral.ai/integrations/opencode/mistral-ocr-document-extraction)
- [Mistral document text and table extraction](https://spiral.ai/integrations/opencode/mistral-document-text-and-table-extraction)
- [Mistral OCR 4.1](https://spiral.ai/integrations/opencode/mistral-ocr-4-1)
- [Mistral document text extraction](https://spiral.ai/integrations/opencode/mistral-document-text-extraction)
- [GitHub user repositories](https://spiral.ai/integrations/opencode/github-user-repositories)
- [Moondream 2 object bounding boxes](https://spiral.ai/integrations/opencode/moondream-2-object-bounding-boxes)

## Questions about Mistral document OCR in opencode

**Can opencode use Mistral document OCR?**

Yes. Add Spiral to opencode as an MCP server, and opencode can find and run Mistral document OCR like any built-in tool.

**How much does Mistral document OCR cost in opencode?**

$0.0026 per page ($0.0039 with document or bounding-box annotations). You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your opencode plan is separate.

**Do I need a Mistral account to use Mistral document OCR in opencode?**

No. Spiral runs Mistral document OCR on its own Mistral account. You sign in to Spiral once and never paste a key.

**How long does it take to set up Mistral document OCR in opencode?**

About two minutes: add the server, then sign in, then check it.

**Does opencode wait while Mistral document OCR runs?**

Mistral document OCR runs in the background. opencode starts the run, checks on it and gives you the json when it's ready.

**Where does the extracted information come from, and how current is it?**

Mistral extracts content from the PDF or image supplied for processing. Its information reflects that document, so processing an older annual report gives you that report's contents.

**Can Mistral preserve complex tables?**

OCR 3 supports reconstructed tables with merged cells, multi-row blocks, and hierarchical column headers. HTML output can represent cells spanning multiple rows or columns.

**How much of a document can structured annotations cover?**

Mistral's cookbook documents an eight-page limit for document annotations and recommends splitting longer documents. The annotation stage receives OCR text plus the first eight extracted image bounding boxes.

**Does the reported 74% benchmark mean 74% transcription accuracy?**

No. Mistral reports a 74% overall win rate against OCR 2 across forms, scans, complex tables, and handwriting; that measures comparative wins rather than the percentage of characters transcribed correctly.

**Does OCR 3 return paragraph bounding boxes?**

Paragraph-level block extraction requires OCR 4 or newer. Mistral says older models accept the option but return an empty array, so OCR 3 should not be used when paragraph coordinates are required.

