v1
latestOpenAPI 3.0.02026-07-26117076.0 KBText Series
Gemini Native Format
Use the native Gemini request/response format.
post/v1beta/models/{model}:{method}
Path parameters
modelstring required
Example:gemini-3-flash-preview
Gemini model name. Example: gemini-3-flash-preview.
method'generateContent' | 'streamGenerateContent' required
Example:generateContent
Request method. Use generateContent for complete JSON responses and streamGenerateContent for streaming generation.
Request body
Example request
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello!"
}
]
}
],
"generationConfig": {
"temperature": 0.7,
"topP": 0.9,
"topK": 40,
"maxOutputTokens": 512
},
"safetySettings": [
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_MEDIUM_AND_ABOVE"
}
]
}Response
Content generated
Example response
{
"code": 200,
"data": {
"candidates": [
{
"content": {
"role": "user",
"parts": [
{
"text": "Hello!"
}
]
},
"finishReason": "STOP",
"safetyRatings": [
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
}
],
"promptFeedback": {
"safetyRatings": [
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
}
},
"usageMetadata": {
"promptTokenCount": 15,
"candidatesTokenCount": 29,
"totalTokenCount": 44,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 15
}
]
}
}