generateContent
Google Gemini
generateContent
POST /v1beta/models/:generateContent — the Gemini native protocol
POST
generateContent
The Gemini native protocol, supporting multimodal input (image / PDF / audio / video) and function calling.
The response includes a
After executing, append a
Or use a model ID with the
Request
Path variables
| Variable | Description |
|---|---|
{model} | Gemini model ID, e.g. gemini-3.1-pro-preview |
Main fields
| Field | Type | Description |
|---|---|---|
contents | array | Conversation content, role is user / model |
systemInstruction | object | System prompt |
generationConfig.temperature | number | 0-2 |
generationConfig.topP | number | |
generationConfig.topK | integer | |
generationConfig.maxOutputTokens | integer | Maximum output |
generationConfig.candidateCount | integer | 1-8 |
generationConfig.stopSequences | array | |
generationConfig.responseMimeType | string | application/json enables structured output |
generationConfig.responseSchema | object | JSON Schema enforcement |
generationConfig.thinkingConfig | object | { thinkingBudget: 8000 } |
tools | array | Function / retrieval tools |
toolConfig | object | function_calling_config |
safetySettings | array | Safety filter levels |
parts types
Response
finishReason: STOP / MAX_TOKENS / SAFETY / RECITATION / OTHER.
Function calling
functionCall:
functionResponse:
Thinking mode
-thinking suffix: gemini-2.5-pro-thinking.