v1
latestOpenAPI 3.1.0MIT2026-07-2614271305.9 KBContent Generation
Gemini Content Generation (All Models)
Select the Gemini text model to call via {model} in the path (see the reference table for the model parameter for all available values).
- Uses the Google native API format and returns conversation content synchronously
- Plain text / multimodal input: mixed text + image / audio / video input
- Streaming: replace generateContent in the path with streamGenerateContent (append ?alt=sse to receive SSE)
Model specs and differences
- Sampling parameters temperature / topP / topK: consistent across the entire Gemini 3.x series, custom values do not affect the output; topK is dropped outright by the gateway (not forwarded upstream), and a temperature / topP value outside the valid range returns a 400.
- Thinking control: the Gemini 3.x series uses thinkingConfig.thinkingLevel (see the thinkingLevel parameter for the levels supported and the default of each model); the Gemini 2.5 series uses thinkingConfig.thinkingBudget (an integer, 0=off). The two are mutually exclusive.
- Function calling: for Gemini 3.x, the FunctionResponse must echo back the id and name matching the corresponding FunctionCall, otherwise the request errors.
- Last-turn role: the role of the last message must not be model (Gemini 3.5+ will error).
- Token limits: gemini-3.6-flash / gemini-3.5-flash-lite have a context window of 1,048,576 and a maximum output of 65,536; other models follow their respective specs.
post/v1beta/models/{model}:generateContent
Path parameters
model'gemini-3.6-flash' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-lite-preview' | 'gemini-3-pro-preview' | 'gemini-3-flash-preview' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' required
Example:gemini-3.6-flash
Select the Gemini text model to call:
| Model ID | Series | Positioning |
|---|---|---|
| gemini-3.6-flash | 3.6 Flash | Multi-step orchestration / code refactoring / general reasoning |
| gemini-3.5-flash | 3.5 Flash | General-purpose Flash |
| gemini-3.5-flash-lite | 3.5 Flash-Lite | Low cost / high throughput / lightweight agent |
| gemini-3.1-pro-preview | 3.1 Pro (Preview) | Advanced reasoning |
| gemini-3.1-pro-preview-customtools | 3.1 Pro · CustomTools | Advanced reasoning + custom tools |
| gemini-3.1-flash-lite-preview | 3.1 Flash-Lite (Preview) | Low cost |
| gemini-3-pro-preview | 3.0 Pro (Preview) | Advanced reasoning |
| gemini-3-flash-preview | 3.0 Flash (Preview) | General-purpose Flash |
| gemini-2.5-pro | 2.5 Pro | Advanced reasoning |
| gemini-2.5-flash | 2.5 Flash | General-purpose Flash |
| gemini-2.5-flash-lite | 2.5 Flash-Lite | Low cost |
Request body
Response
Content generated successfully
Response format description:
- When using the generateContent endpoint, returns GenerateContentResponse (returns complete response at once)
- When using the streamGenerateContent endpoint, returns StreamGenerateContentResponse (streaming response, returns content in chunks)
Example response
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Hello! I'm glad to introduce myself.\n\nI'm a large language model trained and developed by Google..."
}
]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 4,
"candidatesTokenCount": 611,
"totalTokenCount": 2422,
"thoughtsTokenCount": 1807,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 4
}
]
},
"modelVersion": "gemini-3.6-flash",
"responseId": "l-LoaPu0BPmo1dkP6ZPHiQc"
}