Skip to content

Files API

The /v1/files endpoint handles large images, audio, PDFs, and reusable media across requests.

Terminal window
curl https://llmtr.com/v1/files \
-H "Authorization: Bearer sk_your_key" \
-F "provider=google" \
-F "purpose=user_upload" \
-F "file=@./invoice.pdf"

Response:

{
"id": "file_xxx",
"object": "file",
"provider": "google",
"purpose": "user_upload",
"filename": "invoice.pdf",
"bytes": 184732,
"mime_type": "application/pdf",
"created_at": 1739200000
}

Reference the returned file_id in any content-part:

{
"model": "google/gemini-2.5-flash",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Summarize this PDF." },
{
"type": "input_file",
"input_file": {
"file_id": "file_xxx",
"mime_type": "application/pdf"
}
}
]
}
]
}
CategoryTypes
Imageimage/jpeg, image/png, image/webp, image/heic
Audioaudio/wav, audio/mp3, audio/flac, audio/ogg, audio/webm
Videovideo/mp4, video/webm, video/quicktime
Documentapplication/pdf
  • Max 20 MB per file (varies by provider)
  • TTL 48 hours (varies by provider)
  • Same file_id can be reused across models of the same provider

Each provider has its own file storage. For Google, files are held in generativelanguage.googleapis.com/v1beta/files behind the scenes; you only see the canonical file_id.