PDF Support
Use AI models to send and analyze PDF documents.
OneRoute supports sending PDF documents to AI models for analysis, summarization, and question answering. This capability is available via the Chat Completions endpoint.
How It Works
PDF documents are sent as part of the message content, either as base64-encoded data or as a URL. The AI model can then analyze the document and answer questions about its contents.
Chat Completions API
Use the input_file content type to send a PDF. You can provide the PDF as base64-encoded data or as a URL.
Using a Base64-Encoded PDF
curl https://gw.1route.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ONEROUTE_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Summarize this PDF"
},
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "data:application/pdf;base64,JVBERi0="
}
]
}
]
}'
Using a PDF URL
curl https://gw.1route.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ONEROUTE_API_KEY" \
-d '{
"model": "anthropic/claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Summarize this PDF"
},
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "https://example.com/document.pdf"
}
]
}
]
}'
Parameters
type: must be"input_file"filename: the name of the PDF file (e.g.,"document.pdf")file_data: base64-encoded PDF content or a direct URL to the PDF file