Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
Gemini 风格生成
curl --request POST \
  --url https://aiapi.xiaoliu.fun/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "parts": [
        {
          "text": "<string>"
        }
      ]
    }
  ],
  "generationConfig": {
    "temperature": 123,
    "maxOutputTokens": 123
  },
  "safetySettings": [
    {}
  ],
  "tools": [
    {}
  ]
}
'
{
  "candidates": [
    {
      "content": {
        "role": "<string>",
        "parts": [
          {
            "text": "<string>"
          }
        ]
      },
      "finishReason": "<string>"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

model
string
required

模型名称,如 gemini-2.5-pro

Body

application/json
contents
object[]
required
generationConfig
object
safetySettings
object[]
tools
object[]

Response

200 - application/json

成功响应

candidates
object[]
usageMetadata
object