Skip to content
EN

Gemini 官方格式

方法: POST路径: /v1beta/models/gemini-2.5-pro:generateContent

支持 Gemini 官方格式; 所有模型均支持使用 Gemini 格式

请求参数

Header 参数

text
Content-Type
string
必需
示例:
application/json
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}

Body 参数 application/json

text
contents
array
[object]
必需
parts
array
[object]
可选
generationConfig
object
必需
thinkingConfig
object
必需
示例
{
"contents"
:
[
{
"parts"
:
[
{
"text"
:
"Explain how AI works in a few words"
}
]
}
]
,
"generationConfig"
:
{
"thinkingConfig"
:
{
"thinkingBudget"
:
128
,
"includeThoughts"
:
true
}
}
}

请求示例代码

Shell

bash
curl --location --request POST '/v1beta/models/gemini-2.5-pro:generateContent' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "contents": [
    {
      "parts": [
        {
          "text": "Explain how AI works in a few words"
        }
      ]
    }
  ],
  "generationConfig": {
    "thinkingConfig": {
      "thinkingBudget": 128,
      "includeThoughts": true
    }
  }
}'

返回响应

🟢 200 成功

内容类型: application/json

响应结构

text
object

示例

json
{}