# Mistral Ocr

> Convert PDF/images to Markdown/JSON/HTML using Mistral OCR API. Supports image extraction, table recognition, header/footer handling. Usage: Upload a file and say "Use Mistral OCR to process this".

- Skill: `dvcrn/mistral-ocr` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add dvcrn/mistral-ocr`
- Raw SKILL.md: https://api.skillmd.com/api/skills/dvcrn/mistral-ocr/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: dvcrn (https://skillmd.com/u/dvcrn)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/dvcrn/mistral-ocr

---


# Mistral OCR Skill

## Usage

Upload a file and say "Use Mistral OCR to process this".

Supported formats:
- PDF (.pdf)
- Images (.png, .jpg, .jpeg, .tiff)

## CLI Usage

```bash
cd ~/.openclaw/workspace/skills/mistral_ocr

# Process PDF
python3 mistral_ocr.py -i input.pdf -f markdown

# Process image
python3 mistral_ocr.py -i image.png -f markdown

# Output as JSON
python3 mistral_ocr.py -i input.pdf -f json directory
python3 mistral_ocr.py -i input

# Specify output.pdf -o ~/ocr_results
```

## Arguments

| Flag | Description |
|------|-------------|
| `-i, --input` | Input file path (required) |
| `-f, --format` | Output format: markdown/json/html (default: markdown) |
| `-o, --output` | Output directory (default: ocr_result/) |

## Output

- **Markdown**: Complete document with image references
- **JSON**: Structured page data
- **Images**: Saved in images/ subdirectory

## API Key

Set the API key as an environment variable:

```bash
export MISTRAL_API_KEY=your_api_key
```

The script requires `MISTRAL_API_KEY` to be set. It will raise an error if the environment variable is missing.

