PDF Inputs
SIRAYA Model Router supports PDF processing through the /v1/chat/completions API. PDFs can be sent as base64-encoded data URLs or, on models that accept them, direct URLs in the messages array, via the file content type. Base64 data URLs work on every document-capable model.
Always set filename on the file part. Some models do not read a PDF sent without one.
GPT models
GPT models accept only base64-encoded data URLs in file_data. A plain https:// URL is not supported for them; use Base64 Encoded PDFs instead.
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": {
"filename": "document.pdf",
"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: { filename: 'document.pdf', file_data: 'https://example.com/document.pdf' } },
],
},
],
}),
});
const data = await response.json();
console.log(data);
Using Base64 Encoded PDFs
For locally stored PDFs, and for GPT models, 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": {
"filename": "document.pdf",
"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"])
Using the Messages API (Claude)
On POST /v1/messages, send a PDF as a native Anthropic document block:
curl https://llm.siraya.ai/v1/messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <API_KEY>" \
-d '{
"model": "claude-sonnet-4.5",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "<BASE64_PDF>"
}
},
{"type": "text", "text": "Summarize this document."}
]
}
]
}'
Supported Document Formats
Supported document formats depend on the model you select. PDFs are supported across all document-capable models; depending on the model, additional formats such as csv, doc, docx, xls, xlsx, html, txt, and md may also be accepted.