Skip to Content
ModelsClaudeLong context & PDF

Claude long context and PDF

This page covers Claude’s context length and how to send PDF input. For model IDs and endpoints, see the Claude family overview.

1M context

Claude Haiku 5.5 supports a 1M-token context on OfoxAI. When the input exceeds the context window, the API returns prompt is too long — see Common errors.

PDF input

claude_pdf.py
import base64 import os import anthropic client = anthropic.Anthropic(base_url="https://api.ofox.ai/anthropic", api_key=os.environ["OFOX_API_KEY"]) pdf_b64 = base64.b64encode(open("invoice.pdf", "rb").read()).decode() message = client.messages.create( model="anthropic/claude-haiku-5.5", max_tokens=1024, messages=[{"role": "user", "content": [ {"type": "document", "source": {"type": "base64", "media_type": "application/pdf", "data": pdf_b64}}, {"type": "text", "text": "What is the total amount on this invoice?"}, ]}], ) print(message.content[0].text)

Synthetic invoice showing a total of USD 27.43

Download sample PDF (invoice.pdf)

Each PDF page counts toward input tokens as both text and a page image, so watch the context length and cost for long documents.

For other errors, see Common errors.

Last updated on