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

# How to Use Mistral document text extraction in opencode

Mistral OCR 3 extracts text, tables, and embedded images from PDFs and images into page-based Markdown. Use it to turn scanned reports and complex tables into material an agent can search, compare, or analyze.

|  |  |
| --- | --- |
| Model | Mistral document text extraction |
| 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 text extraction in opencode

- Use Mistral document text extraction on https://arxiv.org/pdf/2201.04234 and save the extracted page text as Markdown in this project's research directory.
- Use Mistral document text extraction on Microsoft's 2024 annual report PDF and build a CSV from the extracted income statement, preserving its headings.
- Use Mistral document text extraction on the Mistral 7B paper at https://arxiv.org/pdf/2310.06825 and add its extracted text to this project's search index.
- Use Mistral document text extraction on Apple's 2023 and 2024 annual report PDFs and write a script that compares their extracted segment tables.
- Use Mistral document text extraction on https://arxiv.org/pdf/2201.04234 and build a page-by-page reader in this project using the returned text.

## How to set up Mistral document text extraction 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 text extraction**: 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-0",
    "input": {
      "document": {
        "document_url": "<document_url>"
      }
    }
  }'
```

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

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

## Mistral document text extraction tools and prices

- [Mistral OCR 3.0](https://spiral.ai/tools/mistral/mistral-ocr-3-0) (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 text extraction in opencode?

Build a searchable collection of scanned reports using Mistral's extracted page text and images. A coding agent can add the results to a project's document index or write a table comparison tool.

### Search scanned business archives

Extract page text from archived company reports, then index it so staff can find passages without reading every scan.

### Compare annual report tables

Extract financial tables from successive public annual reports and compare rows while retaining their column headings.

### Prepare research papers for retrieval

Convert technical PDFs into page-based text for a research search tool, keeping extracted figures available alongside the text.

### Extract operational document fields

Turn authorized supplier invoices into structured records for a reviewer to check before entering them into accounting software.

### Compare manual revisions

Extract text and tables from two editions of a product manual, then identify changed specifications and instructions.

### Make historical publications searchable

Transcribe scanned institutional publications into searchable text, including handwritten annotations where present.

### Catalog figures in technical reports

Extract embedded figures and request captions to help readers locate relevant diagrams within a report collection.

## Overview

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

## Mistral document text extraction in other agents

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

## More opencode guides

- [Mistral document text and table extraction](https://spiral.ai/integrations/opencode/mistral-document-text-and-table-extraction)
- [Moondream 2 object bounding boxes](https://spiral.ai/integrations/opencode/moondream-2-object-bounding-boxes)
- [Mistral document OCR](https://spiral.ai/integrations/opencode/mistral-document-ocr)
- [Moondream 2 object coordinates](https://spiral.ai/integrations/opencode/moondream-2-object-coordinates)
- [Mistral OCR document extraction](https://spiral.ai/integrations/opencode/mistral-ocr-document-extraction)
- [SAM 3 image embedding](https://spiral.ai/integrations/opencode/sam-3-image-embedding)

## Questions about Mistral document text extraction in opencode

**Can opencode use Mistral document text extraction?**

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

**How much does Mistral document text extraction 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 text extraction in opencode?**

No. Spiral runs Mistral document text extraction 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 text extraction in opencode?**

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

**Does opencode wait while Mistral document text extraction runs?**

Mistral document text extraction 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?**

It comes from the PDF or image submitted for processing. A report's contents therefore reflect that document's edition, including any outdated figures it contains.

**How large a document can Mistral OCR process?**

Mistral's chunking cookbook lists typical limits of approximately 50 MB and 1,000 pages per processing call. It recommends splitting larger documents into smaller parts and combining their results.

**Can OCR 3 extract tables with merged cells?**

Yes. Mistral documents support for merged cells, multi-row blocks, table headers, and column hierarchies.

**Does OCR 3 handle handwriting?**

Mistral describes support for cursive, mixed-content annotations, and handwriting layered over printed forms. These are supported document types, rather than a published guarantee of perfect transcription.

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

Mistral's current documentation says paragraph-level block extraction requires OCR 4 or newer. Do not build an OCR 3 workflow that depends on those paragraph coordinates.

