NativePort

Make scanned documents useful to your app

Turn a scanned PDF or image into readable text and tables. Extract the fields you need for an invoice workflow, document search, or an AI assistant.

Read the document, then extract what matters

Use OCR to recover text and structure from a scan. The response can include Markdown headings and tables, making it easier to store the content or pass it to an AI model.

If you already know which fields you need, Mistral’s OCR endpoint also supports structured annotations. You provide a JSON schema and receive the extracted fields alongside the page content. Annotated requests use the Document AI rate; a separate model call is another option, shown in the example below.

Send the document as an HTTPS URL and select the pages to process. This route accepts up to 100 pages per request, with a 16 KB request-body limit. If your PDF already contains usable text, check whether ordinary text extraction is enough before running OCR.

Try it step by step

Try a request

Pass an HTTPS link to your PDF and select the pages you need. Replace the example URL before running the request.

curl
curl https://api.nativeport.ai/mistral/v1/ocr \
  -H "Authorization: Bearer $NATIVEPORT_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"model": "mistral-ocr-4-0",
           "document": {"type": "document_url",
                        "document_url": "https://example.com/scan.pdf"},
           "pages": [0, 1, 2]}'
example response
{
  "usage_info": {"pages_processed": 3},
  "pages": [{
    "index": 0,
    "markdown": "# INVOICE\n\n| Item | Qty | Price |\n| --- | --- | --- |\n| Widget | 2 | 19.00 |"
  }]
}

Compare providers

Compare starting prices and the tasks each provider supports. Features and usage affect the total cost. For measured results, see the benchmarks and how we test.

ProviderBest suited forStarting price
Mistral Document AI Read scanned pages and request structured annotations. $0.004 per call
LlamaParse Parse documents and preserve useful structure. $0.00625 per call
OpenAI Interpret document images with supported vision models. metered by OpenAI
Anthropic Ask questions about a document image or extracted text. metered by Anthropic
Grok Analyze images or text with supported models. metered by Grok (xAI)
Hugging Face Compare supported models for image and text tasks. metered by Hugging Face

Build on an example

Set your NativePort API key and adapt an example to your own data. Outputs below illustrate the response format.

Extract an invoice total and date from a scanned page

OCR is billed per page. The model request is billed separately by token usage.
python
import json, os, urllib.request

def post(path, payload):
    req = urllib.request.Request(
        "https://api.nativeport.ai" + path,
        data=json.dumps(payload).encode(),
        headers={
            "Authorization": f"Bearer {os.environ['NATIVEPORT_API_KEY']}",
            "Content-Type": "application/json",
        },
    )
    with urllib.request.urlopen(req) as r:
        return json.load(r)

ocr = post("/mistral/v1/ocr", {
    "model": "mistral-ocr-4-0",
    "document": {"type": "document_url",
                 "document_url": "https://example.com/invoice.pdf"},
    "pages": [0],
})
page = ocr["pages"][0]["markdown"]

out = post("/inference/v1/chat/completions", {
    "model": "openai/gpt-5.4-mini",
    "messages": [{"role": "user", "content":
        "Return JSON with total, currency and invoice_date.\n\n" + page}],
    "response_format": {"type": "json_object"},
})
print(out["choices"][0]["message"]["content"])
example output
$ python invoice.py
{"total": 38.00, "currency": "USD", "invoice_date": "2026-08-14"}

More ways to use these APIs

Convert an image into structured JSON

Add a supported JSON-schema annotation format to the Mistral OCR request to extract specific fields alongside the page content. Supply the document through an HTTPS URL. Annotated requests use the Document AI rate, which you can check on the Mistral provider page.

Mistral · /mistral/v1/ocr

Analyze or classify an image with a vision model

Ask a vision-capable model about the document when you need more than its text, such as identifying the document type or describing an image. Check the model catalog for vision support and use the image input format it accepts. Provider-native routes require access for your account during the pilot.

NativePort Inference · /inference/v1/chat/completions

Compare OCR and vision API pricing

Compare OCR’s per-page rate with the token rates of the vision models you are considering. /inference/v1/models provides model capabilities and token prices. Estimate the cost for a representative set of documents, then check the quality of the returned text or fields.

NativePort Inference · /inference/v1/models

Use it with NativePort

Process a document and work with its contents using one NativePort key. The same balance covers OCR and any model requests you add afterwards.

Before you start

When should I use a vision model instead?

Use OCR when you need readable text and document structure. A vision model can help with questions about the page, such as identifying the type of document or interpreting an image. Test with your own documents to compare the results.

Can I upload the file in the OCR request?

This route accepts a document URL. Upload the file to storage accessible over HTTPS, then pass the link. The JSON request is limited to 16 KB and does not accept an inline file.

Why do I need to select pages?

The page selection determines how much work the request can perform. Pages are numbered from zero, and each request can select up to 100. Split longer documents into batches, as the OCR guide shows.

Try it with $5 in credits