Skip to main content

File Inputs (PDF)

NagaAI supports PDF file input for models with document understanding capabilities. You can send files in Chat Completions using the file content block. The file can be provided as a direct HTTPS URL (publicly accessible) or as base64-encoded data.

How to Send Files

Using File URLs

This is the most efficient way for publicly accessible files.

{
"model": "gpt-5-mini-2025-08-07",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize this PDF briefly." },
{
"type": "file",
"file": {
"filename": "document.pdf",
"file_data": "https://bitcoin.org/bitcoin.pdf"
}
}
]
}
]
}

Using Base64-Encoded Files

For local or private files, encode the file as base64 and use a data URL:

{
"model": "gpt-5-mini-2025-08-07",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize this PDF briefly." },
{
"type": "file",
"file": {
"filename": "document.pdf",
"file_data": "data:application/pdf;base64,JVBERi0xLjQKJ..."
}
}
]
}
]
}

Supported File Types

  • application/pdf (PDF only)

Notes

  • For URLs, files must be publicly accessible via HTTPS.
  • Large PDFs will count towards token usage after provider-side parsing.
  • For models without native file support, we may enable this via external tools in the future (e.g., OCR).

Discover Supported Models

You can see which models accept file (PDF) inputs on the NagaAI Models page (file filter).