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

Document Inputs

Document inputs let multimodal models analyze files together with text prompts. Common use cases include summarization, information extraction, question answering, and document comparison.

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

Supported document formats, file sizes, and page limits depend on the model and provider. The examples below send a PDF as Base64-encoded data.

OpenAI Chat Completions API

import base64
from pathlib import Path

from openai import OpenAI

client = OpenAI(
    base_url="https://api.cortecs.ai/v1",
    api_key="<API_KEY>",
)

pdf_base64 = base64.b64encode(
    Path("path/to/document.pdf").read_bytes()
).decode("utf-8")

completion = client.chat.completions.create(
    model="<MODEL_NAME>",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "file",
                    "file": {
                        "filename": "document.pdf",
                        "file_data": f"data:application/pdf;base64,{pdf_base64}",
                    },
                },
                {
                    "type": "text",
                    "text": "Summarize the key points in this document.",
                },
            ],
        }
    ],
)

print(completion.choices[0].message.content)

OpenAI Responses API

Anthropic Messages API

Last updated