For the complete documentation index, see llms.txt. This page is also available as Markdown.

Mistral OCR 4

This documentation is valid for the following list of our models:

  • mistral/mistral-ocr-4-0

Model Overview

Mistral OCR 4 is Mistral's most advanced document extraction and understanding model, adding native paragraph-level bounding box extraction and structural block labels on top of high-fidelity text, table, and image extraction from PDFs and images. Fully backward compatible with Mistral OCR 3.

How to make the first API call

1️⃣ Required setup (don’t skip this)Create an account: Sign up on the AI/ML API website (if you don’t have one yet). ▪ Generate an API key: In your account dashboard, create an API key and make sure it’s enabled in the UI.

2️ Copy the code example At the bottom of this page, pick the snippet for your preferred programming language (Python / Node.js) and copy it into your project.

3️ Update the snippet for your use caseInsert your API key: replace <YOUR_AIMLAPI_KEY> with your real AI/ML API key. ▪ Select a model: set the model field to the model you want to call. ▪ Provide input: fill in the request input field(s) shown in the example.

4️ (Optional) Tune the request See the API schema below for optional generation settings.

5️ Run your code Run the updated code in your development environment.

API Schema

post
Body
modelstring · enumRequiredPossible values:
documentone ofRequired

Document to run OCR

or
pagesany ofOptional

Specific pages you wants to process

Example: "3" or "0-2" or [0, 3, 4]
stringOptional
or
integer[]Optional
or
any · nullableOptional
include_image_base64boolean · nullableOptional

Include base64 images in response

image_limitinteger · nullableOptional

Max images to extract

image_min_sizeinteger · nullableOptional

Minimum height and width of image to extract

document_annotation_promptstring · nullableOptional

Optional high-level prompt to guide and instruct how the document is annotated.

Responses
200

Successful response.

application/json
modelstringRequired

The model used to generate the OCR.

document_annotationstring · nullableOptional

Structured annotation of the whole document as a JSON string, returned when document_annotation_format is provided.

post/v1/ocr
200

Successful response.

Code Example

Response

Last updated

Was this helpful?