跳轉到主要內容
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
curl -X POST "https://api.lemondata.cc/v1beta/models/gemini-2.5-pro:streamGenerateContent?key=sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [{"text": "Tell me a story"}]
      }
    ]
  }'
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {"text": "Once upon a time"}
        ]
      }
    }
  ]
}
Gemini generateContent 端點的串流版本。返回 Server-Sent Events。

路徑參數

model
string
必填
模型名稱(例如:gemini-2.5-progemini-2.5-flash)。

查詢參數

key
string
API 金鑰(標頭驗證的替代方案)。

請求主體

生成內容 相同。

回應

返回 JSON 物件串流,每個物件包含部分回應。
curl -X POST "https://api.lemondata.cc/v1beta/models/gemini-2.5-pro:streamGenerateContent?key=sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [{"text": "Tell me a story"}]
      }
    ]
  }'
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {"text": "Once upon a time"}
        ]
      }
    }
  ]
}