Document OCR — AgentSky

Document OCR

Extract text and structure from a document.

Overview

Reads an HTTP(S) document URL or a PDF, PNG, or JPEG base64 source and returns page-level markdown and extracted content.

Processed pages, markdown, extracted images and tables, and page usage.

Input

These go in the input object of the run request.

Field Type Required Description
document_url string No Public HTTP(S) URL. Supply exactly one document source.
document_base64 base64 No PDF, PNG, or JPEG bytes, optionally as a data URI. Supply exactly one document source.
document_type string No Interpret a URL as a document or image.
Allowed: document, image
model string No OCR model.
Allowed: mistral-ocr-latest, mistral-ocr-4-1
Default: "mistral-ocr-latest"

Requests up to 14 MB.

Example

Use your own API key and a saved idempotency key for each new job. Replace image or media placeholders with your own publicly reachable HTTPS URLs. Keep the same key and request body when recovering a timeout.

# Set once per job; reuse this key and the identical body after a timeout.
: "${AGENTSKY_IDEMPOTENCY_KEY:?Set a unique, saved key for this job}"
curl --fail-with-body https://gateway.agentsky.dev/v1/run \
  -H "authorization: Bearer $AGENTSKY_API_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: $AGENTSKY_IDEMPOTENCY_KEY" \
  -d '{"provider":"ocr","endpoint":"mistral","input":{"document_url":"https://example.com/document.pdf"}}'
# If status is READY/RUNNING, poll GET /v1/runs/{runId} with the same API key.

Pricing

Prices by input conditions in USD per image, using your plan when signed in. Read the final customer charge from price.amount.value after the run finishes. A RUNNING response is not the final bill.

Input conditions Availability USD per image
mistral-ocr-latest (default) Unavailable —
mistral-ocr-4-1 Unavailable —

Questions

What does Document OCR do?

How much does Document OCR cost?

What does Document OCR take?

What are the limits on Document OCR?

How do I retry safely and check the final charge?