Gemini format
Gemini generate content
Text chat and image / PDF / audio / video recognition using the Gemini native API format
POST
Models you can use
| Model ID | Notes |
|---|---|
gemini-3.1-pro-preview | Gemini flagship — strong multimodal, very long context |
gemini-2.5-pro | High-performance multimodal, up to 1M token context |
gemini-2.5-flash | Fast, lightweight — optimized for high-volume workloads |
GET /v1/models for the full list.
Multi-turn conversations
Alternaterole: user and role: model entries in the contents array
to build a multi-turn conversation.
Media recognition
Add aninlineData entry in parts with a mimeType (e.g.
image/jpeg, application/pdf, audio/mpeg, video/mp4) and the
base64-encoded file data.
Streaming
Replace:generateContent in the path with
:streamGenerateContent?alt=sse to switch to SSE streaming mode.
Safety filtering
UsesafetySettings to adjust the blocking threshold for each harm
category.
System instructions
Pass a system-level prompt viasystemInstruction, using the same
parts format as contents.Authorizations
Path Parameters
Model name, e.g. gemini-2.5-pro or gemini-2.5-flash.
Example:
"gemini-2.5-pro"
Body
application/json
Gemini generateContent request body, used for both text chat and media recognition.
Conversation contents in chronological order. Each element has a
role (user or model) and a parts array of content fragments.
Generation parameter configuration.
Safety filter settings to adjust blocking thresholds per harm category.
Tool list for function calling.
System-level instruction in the same format as a contents element.