# OCR

**Last updated:** 2026-10-28T13:54:53-03:00 (UTC-3)

Extract the text of PDFs and images as markdown, page by page, with Mistral OCR (directly or on Azure AI Foundry). `POST /v1/ocr` follows the Mistral format. Flag: `ocr`; the alias declares the `ocr` capability and the key needs `route:ocr`.

The document arrives as an HTTPS URL, fetched by the provider, or as a data URL. The gateway never fetches the document.

## How to enable it

```yaml
providers:
  - id: foundry
    preset: azure_mistral_ocr          # or mistral (api.mistral.ai)
    base_url: https://{resource}.services.ai.azure.com/providers/mistral/azure
models:
  - id: reader
    capabilities: [ocr]
    targets: [{provider: foundry, model: ocr}]   # deployment name
vector_stores:
  ocr_model: reader     # PDFs and images enter vector stores through OCR
```

## In vector stores

With `vector_stores.ocr_model`, a PDF or image (up to 20 MiB) attached to a vector store is converted to text by the gateway's own `/v1/ocr`:
- **As the caller:** the key needs `route:ocr` and the OCR alias, and quota and ledger apply.
- **Indexing:** the markdown pages are joined and indexed.
- **Binary upload:** `/v1/files` accepts binary content only for PDFs and images with `purpose` `assistants` or `user_data`.

## See also

- [Vector stores](/docs/features/vector-stores/).
- [Providers](/docs/features/providers/).
