跳转到主要内容
POST
/
v1beta
/
models
/
{model}
:generateContent
生成 Gemini 兼容内容
curl --request POST \
  --url https://api.apiany.ai/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "parts": [
        {}
      ],
      "role": "<string>"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "topP": 123,
    "topK": 123,
    "maxOutputTokens": 123,
    "stopSequences": [
      "<string>"
    ],
    "responseMimeType": "<string>",
    "responseSchema": {},
    "responseModalities": [
      "<string>"
    ]
  },
  "tools": [
    {}
  ],
  "systemInstruction": {}
}
'
{
  "candidates": [
    {}
  ],
  "usageMetadata": {}
}

授权

Authorization
string
header
必填

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

路径参数

model
string
必填

请求体

application/json
contents
object[]
必填
generationConfig
object

生成配置。另外:调用 :streamGenerateContent(而非 :generateContent)可获得 Gemini SSE 流。

tools
object[]

含 functionDeclarations 的工具声明。

systemInstruction
object

系统指令,Gemini Content 对象({ parts: [{ text }] })。

响应

Gemini 兼容响应。

candidates
object[]
必填
usageMetadata
object