PDF Inputs
Siraya Model Router supports PDF processing through the /v1/chat/completions API. PDFs can be sent as direct URLs or base64-encoded data URLs in the messages array, via the file content type.
Sending PDFs
Using PDF URLs
import requests
import json
url = "https://llm.siraya.ai/v1/chat/completions"
headers = {
"Authorization": f"Bearer <API_KEY>",
"Content-Type": "application/json"
}
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Summarize this document."
},
{
"type": "file",
"file": {
"file_data": "https://example.com/document.pdf"
}
}
]
}
]
payload = {
"model": "claude-sonnet-4.5",
"messages": messages
}
response = requests.post(url, headers=headers, json=payload)
print(response.json()["choices"][0]["message"]["content"])
const response = await fetch('https://llm.siraya.ai/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: `Bearer <API_KEY>`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'claude-sonnet-4.5',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'Summarize this document.' },
{ type: 'file', file: { file_data: 'https://example.com/document.pdf' } },
],
},
],
}),
});
const data = await response.json();
console.log(data);
Using Base64 Encoded PDFs
For locally stored PDFs, encode them as base64 data URLs:
import requests
import json
import base64
def encode_pdf_to_base64(pdf_path):
with open(pdf_path, "rb") as pdf_file:
return base64.b64encode(pdf_file.read()).decode('utf-8')
url = "https://llm.siraya.ai/v1/chat/completions"
headers = {
"Authorization": f"Bearer <API_KEY>",
"Content-Type": "application/json"
}
pdf_path = "path/to/your/document.pdf"
base64_pdf = encode_pdf_to_base64(pdf_path)
data_url = f"data:application/pdf;base64,{base64_pdf}"
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What are the key points in this document?"
},
{
"type": "file",
"file": {
"file_data": data_url
}
}
]
}
]
payload = {
"model": "claude-sonnet-4.5",
"messages": messages
}
response = requests.post(url, headers=headers, json=payload)
print(response.json()["choices"][0]["message"]["content"])
Supported Document Formats
| Provider | Supported Formats |
|---|---|
| Bedrock | pdf, csv, doc, docx, xls, xlsx, html, txt, md |
| Vertex AI | pdf, csv, txt, html, md |
| OpenAI | Passes through as-is |