PDF Inputs
Send PDF documents to models through the AgnicPay AI Gateway
PDF Inputs
Process PDF documents with compatible models through the AgnicPay AI Gateway. PDFs can be sent as direct URLs or base64-encoded data URLs.
Overview
PDF processing is available via the /v1/chat/completions API using the file content type. This feature works with models that support file input.
When a model supports file input natively, the PDF is passed directly. Otherwise, the PDF is parsed and the text is passed to the model.
Using PDF URLs
For publicly accessible PDFs, send the URL directly:
Python
JavaScript
cURL
Using Base64 Encoded PDFs
For local PDF files:
Python
JavaScript
Compatible Models
Models with PDF/file processing capabilities:
| Provider | Models | Notes |
|---|---|---|
| Anthropic | Claude 3.5 Sonnet, Claude 3 Opus | Native PDF support |
| Gemini 1.5 Pro, Gemini 2.0 Flash | Native file support |
Use Cases
- Document summarization - Get key points from long documents
- Data extraction - Pull specific information from reports
- Q&A over documents - Ask questions about PDF content
- Contract analysis - Review legal documents
- Research papers - Analyze academic content
Best Practices
- Use URLs when possible - More efficient for large files
- Provide context - Tell the model what to look for
- Break up large documents - Split very long PDFs if needed
- Check model limits - Different models have different page limits
For scanned PDFs or documents with images, use models with strong OCR capabilities like Claude 3 or Gemini 1.5 Pro.
Troubleshooting
PDF not processing?
- Verify the model supports file input
- Check that the PDF is not corrupted
- Ensure the file size is within limits
Poor extraction results?
- Try a model with better OCR capabilities
- Ensure the PDF has selectable text (not just images)