OCR

POST /v1/ocr is Mistral's OCR endpoint. The model is <provider>/<model>, for example mistral/mistral-ocr-latest.

cURLcurl
1curl https://api.aile.sh/v1/ocr \
2-H "Authorization: Bearer $AILE_KEY" \
3-H "Content-Type: application/json" \
4-d '{
5 "model": "mistral/mistral-ocr-latest",
6 "document": { "type": "document_url", "document_url": "https://example.com/paper.pdf" },
7 "pages": "0-4"
8}'

Billing

  • One unit per page processed, never more than the hold. An image_url document is one page.
  • pages ("0,1,2", "0-5" or [0,1,2]) sets the hold. Without it the document is capped to the deployment's page limit (100 by default) and the response carries x-aile-ocr-page-cap.
  • A document is an https URL or a data URI, up to 25 MB. file_id is refused.
  • A response with no pages is a 502 and is not charged.
  • A provider refusal you can fix (400, 404, 413, 422 …) passes through. One about the lender's account is a 502 saying you were not charged. A 502 or 504 arrives as 503 with the real code in x-aile-status.
  • A key's pins and the routing headers choose the lender here too. x-aile-provider must match the model's prefix, and x-aile-max-price does not apply to a per-page price.
  • Where the deployment enables keyless x402, OCR takes it for an image, or a document with pages.