Skip to main content
POST
/
v1beta
/
models
/
gemini-3-pro-preview:generateContent
gemini-3-pro-preview (text to text)
curl --request POST \
  --url https://api.example.com/v1beta/models/gemini-3-pro-preview:generateContent
Gemini’s official format for the text to text API.
curl --location 'https://gptproto.com/v1beta/models/gemini-3-pro-preview:generateContent' \
--header 'Authorization: Bearer sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "介绍一下量子计算的基本原理"
                }
            ]
        }
    ],
    "generationConfig": {
        "temperature": 0.3,
        "topP": 0.95,
        "topK": 64,
        "maxOutputTokens": 8192
    },
    "safetySettings": [
        {
            "category": "HARM_CATEGORY_HARASSMENT",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        },
        {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        },
        {
            "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        },
        {
            "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        }
    ]
}'
{
  "error": {
    "code": 401,
    "message": "Invalid API key provided.",
    "status": "UNAUTHENTICATED"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray✅ Yes-Contains the content to be processed.
rolestring✅ Yes-The role of the message sender (e.g., “user”).
partsarray✅ Yes-Parts of the content, containing text.
textstring✅ Yes-The text prompt for the generation.
generationConfigobject❌ No-Generation configuration settings.
temperaturenumber❌ No0.3Controls randomness in the response (0.0 to 1.0).
topPnumber❌ No0.95Controls diversity via nucleus sampling.
topKnumber❌ No64Limits the number of tokens considered.
maxOutputTokensnumber❌ No8192Maximum number of tokens in the response.
safetySettingsarray❌ No-Safety settings for content filtering.
categorystring✅ Yes-The harm category to filter.
thresholdstring✅ Yes-The threshold for blocking content.