POST
https://your-instance.com/v1beta/models/{model}:generateContentThe same endpoint accepts non-text parts. Inline the bytes as base64 with the right MIME type and the model reads them alongside your question — this is how you get video and PDF understanding rather than generation.
Accepted media
| Kind | MIME type | Typical use |
|---|---|---|
Image | image/png, image/jpeg, image/webp | Describe, extract text, compare |
Document | application/pdf | Summarise or query a document |
Audio | audio/mp3, audio/wav, audio/ogg | Transcribe, summarise, answer about a recording |
Video | video/mp4, video/mov, video/webm | Describe the footage, find a moment, summarise |
Asking about a video
import base64
with open("clip.mp4", "rb") as f:
data = base64.b64encode(f.read()).decode()
response = client.models.generate_content(
model="gemini-3-pro",
contents=[{
"parts": [
{"inline_data": {"mime_type": "video/mp4", "data": data}},
{"text": "What happens in this clip?"},
]
}],
)
print(response.text)