Mistral OCR

HTTP client and converter for Mistral OCR.

import {
  MistralOcr4RequestOptionsSchema,
  MISTRAL_OCR_OUTPUT_CAPABILITIES,
  createHttpMistralOcrClient,
  mapMistralOcrResponseToParsedDocument,
  mistralOcrOptionsSchemaForModel,
} from '@openparser/adapters/mistral';

Client

const client = createHttpMistralOcrClient({ apiKey: mistralApiKey });
const { canonical, nativeResult } = await client.parse({
  bytes: documentBytes,
  mediaType: 'application/pdf',
  documentId: 'doc-1',
  model: 'mistral-ocr-4-0',
  options: { table_format: 'html', include_blocks: true },
});

Factory options: apiKey (required), baseUrl, timeoutMs, maxResponseBytes, fetchImpl.

include_blocks is an OCR 4 request field — use mistralOcrOptionsSchemaForModel(model) or the OCR 4 / legacy Zod schemas.

Adapter-only

Call mapMistralOcrResponseToParsedDocument when you already have a Mistral OCR JSON response and only need conversion.

On this page