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 llmtr-your_key" \ -F "provider=google" \ -F "purpose=user_upload" \ -F "file=@./invoice.pdf"purpose values
Section titled “purpose values”| Value | When to use |
|---|---|
user_upload | General-purpose upload. PDFs, images or audio referenced from chat via input_file.file_id. |
vision_reference | Reference images sent to /v1/images/generations via file_id or file_ids. Try-on, image-to-image and image-merging flows use this purpose. |
Defaults to user_upload when omitted. Any other value returns 400 invalid_request.
provider values
Section titled “provider values”Only google is currently supported. Defaults to google when omitted; any other value returns 400 unsupported_provider.
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)
- Uploaded files are deleted automatically 7 days after upload
- The same
file_idcan be reused across models of the same provider
Storage
Section titled “Storage”Uploaded files are managed by LLMTR; you only see the canonical file_id. Use this identifier directly in input_file.file_id, or in the file_id and file_ids fields of /v1/images/generations.