Files API
The /v1/files endpoint handles large images, audio, PDFs, and reusable media across requests.
Upload
Section titled “Upload”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}Using in a request
Section titled “Using in a request”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" } } ] } ]}Supported MIME types
Section titled “Supported MIME types”| Category | Types |
|---|---|
| Image | image/jpeg, image/png, image/webp, image/heic |
| Audio | audio/wav, audio/mp3, audio/flac, audio/ogg, audio/webm |
| Video | video/mp4, video/webm, video/quicktime |
| Document | application/pdf |
Limits
Section titled “Limits”- Max 20 MB per file (varies by provider)
- TTL 48 hours (varies by provider)
- Same
file_idcan be reused across models of the same provider
Provider backing
Section titled “Provider backing”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.