For the complete documentation index, see llms.txt. This page is also available as Markdown.

OCR [BETA]

OCR extracts text and structured content from documents and images, enabling applications such as document digitization, data extraction, searchable archives, and automated document processing.

To explore available models, visit cortecs.ai and filter by the OCR tag.

Example usage

import base64
import requests

api_key = "<CORTECS_API_KEY>"
pdf_path = "document.pdf"

with open(pdf_path, "rb") as file:
    encoded_pdf = base64.b64encode(file.read()).decode("utf-8")

response = requests.post(
    "https://api.cortecs.ai/v1/ocr",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json={
        "model": "mistral-ocr-4.1",
        "document": {
            "type": "document_url",
            "document_url": f"data:application/pdf;base64,{encoded_pdf}",
        },
    },
)

response.raise_for_status()
result = response.json()

for page in result["pages"]:
    print(page["markdown"])

OCR with document annotation

Last updated