Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
gemini-2.5-pro (text to text)
curl --request POST \
  --url https://api.example.com/v1beta/models/{model}:generateContent
Gemini’s official format for the text to text API.
curl --location 'https://gptproto.com/v1beta/models/gemini-2.5-pro:generateContent' \
--header 'Authorization: sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "用100字以内介绍一下自己"
                }
            ]
        }
    ]
}'
{
  "error": {
    "message": "Input may not meet the guidelines. Please adjust and try again.",
    "type": "503"
  }
}

Path Parameters

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray✅ Yes-An array of content objects representing the conversation history. The role of the message sender. Typically "user" or "model". Optional for single-turn requests.
partsarray✅ Yes-An array of parts that make up the message content. Text content of the message or prompt.
inlineDataobject❌ No-Inline media data. The MIME type of the media.
functionCallobject❌ No-A function call generated by the model. The name of the function to call.
candidatesarray❌ No-An array of generated content candidates from the model. The content of the generated response.