Multimodal inputs (images, audio and PDFs)
Frontier models in 2026 read far more than text. You can hand them screenshots, scanned invoices, charts, multi-hundred-page PDFs, voice notes and video, and get back text or structured data. Under the hood, every one of those becomes tokens in the context window, which means the same cost and context rules apply, just with less intuitive math. This doc covers how each modality enters the model and the practical choices that matter.
Why it matters
A large share of real business data is not clean text. Support tickets carry screenshots, finance runs on PDFs, field teams send photos, and sales calls are audio. Multimodal models collapse what used to be separate OCR, layout parsing and speech recognition pipelines into one call. That is a huge simplification, but only if you understand the token cost, the resolution limits and the failure modes, such as models misreading small text or hallucinating chart values.
How it works
Each modality has an encoder that converts raw input into embeddings the language model can attend to, alongside text tokens.
Rendering diagram…
Images
Images are split into patches and encoded into a number of tokens that grows with resolution, and providers resize images above a maximum size. Anthropic supports JPEG, PNG, GIF and WebP. Use the provider's token counter to see what an image actually costs, and downscale before sending when fine detail does not matter.
PDFs
Providers increasingly accept PDFs natively. Anthropic's PDF support processes each page as both extracted text and a page image, so the model sees charts and layout, not just text, and third-party write-ups put a typical page in the low thousands of tokens depending on density. You can send PDFs as base64, by URL, or through a Files API to reuse an upload across requests. Native PDF input is great for mixed layout documents; for long text-only documents, extracting text yourself is often cheaper.
Audio and video
Gemini's docs give concrete rates: audio is tokenized at 32 tokens per second (1,920 per minute) and video at 263 tokens per second, and they recommend the Files API when a request exceeds 20 MB. That makes a one-hour recording roughly 115,000 tokens of audio alone, which is affordable but not free. For realtime voice, providers offer dedicated speech-to-speech and realtime APIs, which are a different architecture from uploading a file.
Reference architecture
A document understanding pipeline usually mixes native multimodal calls with cheaper preprocessing.
Rendering diagram…
Code
Send an image and a PDF in the same request to Claude using base64 content blocks, and ask for a comparison. The block shapes are the documented image and document types.
import base64
import anthropic
client = anthropic.Anthropic()
def b64(path: str) -> str:
with open(path, "rb") as f:
return base64.standard_b64encode(f.read()).decode("utf-8")
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{
"role": "user",
"content": [
{
"type": "document",
"source": {"type": "base64", "media_type": "application/pdf", "data": b64("purchase_order.pdf")},
},
{
"type": "image",
"source": {"type": "base64", "media_type": "image/jpeg", "data": b64("delivery_photo.jpg")},
},
{
"type": "text",
"text": "Does the delivery photo match the items and quantities on the purchase order? "
"List any mismatches with the PO line number.",
},
],
}],
)
print(response.content[0].text)
print("input tokens:", response.usage.input_tokens)
Put media before the text question. For repeated questions over the same large PDF, combine this with prompt caching by marking the document block with cache_control.
Trade-offs and pitfalls
- Token surprises. A batch of high-resolution images or a long PDF can dwarf the text prompt. Count tokens on representative files before launch.
- Small text and dense tables. Models can misread tiny fonts, rotated pages and low-quality scans. Crop to the region of interest and upscale, or deskew first.
- Chart hallucination. Models may estimate values from a chart rather than read them. If exact numbers matter, get the underlying data.
- Spatial reasoning is still weak for precise tasks such as reading exact positions or measurements from drawings.
- Policy limits. Some models decline certain tasks on images, such as identifying people from faces. Design around this rather than fighting it.
- Native PDF versus extraction. Native is simpler and sees layout, extraction is cheaper and auditable. Pick per document type.
- Payload limits. Base64 inflates size, and providers cap request size. Use Files APIs for large or reused media.
- Audio quality. Background noise, crosstalk and accents still degrade transcription. Keep the original audio and let users correct transcripts.
Checklist
- Token cost per file type measured on real samples.
- Images resized and cropped to what the task needs.
- Scans deskewed and checked for text layer before deciding native versus extraction.
- Large or reused media uploaded once via a Files API.
- Extracted values validated against a schema and business rules.
- Repeated questions over the same document use prompt caching.