PDF support (beta)
The new Claude 3.5 Sonnet (claude-3-5-sonnet-20241022
) model now supports PDF input and understands both text and visual content within documents.
PDF support is in public beta
To access this feature, include the anthropic-beta: pdfs-2024-09-25
header in your API requests.
We’ll be iterating on this open beta over the coming weeks, so we appreciate your feedback. Please share your ideas and suggestions using this form.
PDF Capabilities
Claude works with any standard PDF. You can ask Claude about any text, pictures, charts, and tables in the PDFs you provide. Some sample use cases:
- Analyzing financial reports and understanding charts/tables
- Extracting key information from legal documents
- Translation assistance for documents
- Converting document information into structured formats
How PDF support works
When you send a request that includes a PDF file:
The system extracts the contents of the document.
- The system converts each page of the document into an image.
- The text from each page is extracted and provided alongside the page’s image.
Claude analyzes both the text and images to better understand the document.
- Documents are provided as a combination of text and images for analysis.
- This allows users to ask for insights on visual elements of a PDF, such as charts, diagrams, and other non-textual content.
Use documents alongside other Claude features.
PDF support works well alongside:
- Prompt caching: To improve performance for repeated analysis.
- Batch processing: For high-volume document processing.
- Tool use: To extract specific information from documents for use as tool inputs.
PDF support limitations
Before integrating PDF support into your application, ensure your files meet these requirements:
Requirement | Limit |
---|---|
Maximum request size | 32MB |
Maximum pages | 100 |
The provided PDFs should not have any passwords or encryption.
Since PDF support relies on Claude’s vision capabilities, it is subject to the same limitations.
Supported platforms and models
PDF support is currently available on the new Claude 3.5 Sonnet (claude-3-5-sonnet-20241022
) via direct API access. This functionality will be supported on Amazon Bedrock and Google Vertex AI soon
Calculate expected token usage
The token count of a PDF file depends on the total text extracted from the document as well as the number of pages. Since each page is converted into an image, the same image-based cost calculations are applied. Each page typically uses 1,500 to 3,000 tokens, depending on content density. Standard input token pricing applies, with no additional fees for PDF processing.
You can also use token counting to determine the number of tokens in a message containing PDFs.
How to use PDFs in the Messages API
Here’s a simple example demonstrating how to use PDFs in the Messages API:
Here are a few other examples to help you get started:
Best practices for PDF analysis
- Ensure text is clear and legible.
- Rotate pages to the proper orientation.
- When referring to page numbers, use the logical number (the number reported by your PDF viewer) rather than the physical page number (the number visible on the page)
- Use standard fonts.
- Place PDFs before text in requests.
- Split very large PDFs into smaller chunks when limits are exceeded.
- Use prompt caching for repeated analysis of the same document.
Next steps
Ready to start working with PDFs using Claude? Here are some helpful resources: