Files are only supported in the Gemini Developer API, not Vertex AI.
Upload files
Upload a file from your local filesystem:upload method automatically detects the file type and uploads it to the Gemini API.
Upload response
The upload method returns aFile object with the following properties:
- name - The unique identifier for the file
- uri - The URI to reference the file in API calls
- mime_type - The detected MIME type
- size_bytes - File size in bytes
- create_time - When the file was uploaded
Get file metadata
Retrieve information about an uploaded file:Delete files
Remove a file from the Gemini API:Using files with models
Once uploaded, you can reference files in your model requests:Supported file types
The Files API supports various file types including:- PDF documents
- Images (JPEG, PNG, WebP)
- Audio files (MP3, WAV)
- Video files (MP4, MOV)
- Text files
File storage and lifecycle
- Files are stored temporarily on Google’s servers
- Files are automatically deleted after a period of inactivity
- You should delete files you no longer need to manage storage