AgentSkillsCN

mistral-ocr

基于 OCR 技术,利用 Mistral AI 将 PDF 或图片转换为 Markdown 格式。特别适用于扫描文档和图像,需提前配置 MISTRAL_API_KEY。

SKILL.md
--- frontmatter
name: mistral-ocr
description: OCR-based PDF/image to Markdown using Mistral AI. Best for scanned documents and images. Requires MISTRAL_API_KEY.

Mistral OCR

OCR conversion using Mistral AI API. Excellent for scanned documents, images with text, and complex layouts.

Prérequis

  1. Copy .env.example to .env
  2. Add your MISTRAL_API_KEY to .env

Usage

bash
# From the mistral-ocr directory
cd .opencode/skill/convert-to-md/converters/mistral-ocr

# Basic usage
uv run scripts/mistral_ocr.py input.pdf -o output_mistral.md

# With options
uv run scripts/mistral_ocr.py input.pdf -o output_mistral.md --table-format html
uv run scripts/mistral_ocr.py input.pdf -o output_mistral.md --no-images

Options

OptionDescription
-o, --outputOutput file path (default: {input}_mistral.md)
--table-formatmarkdown (default) or html
--no-imagesExclude base64 images from output

Supported Formats

  • PDF (.pdf)
  • Images: PNG, JPG, JPEG, GIF, WEBP

Notes

  • Best results for scanned documents and images
  • Preserves table structure
  • Can extract text from images within PDFs
  • API usage incurs costs based on Mistral pricing