メインコンテンツへスキップ
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
Gemini Stream Generate Content
curl --request POST \
  --url https://api.acedata.cloud/v1beta/models/{model}:streamGenerateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "parts": [
        {
          "text": "<string>",
          "inlineData": {
            "mimeType": "<string>",
            "data": "<string>"
          },
          "fileData": {
            "mimeType": "<string>",
            "fileUri": "<string>"
          },
          "functionCall": {
            "name": "<string>",
            "args": {}
          },
          "functionResponse": {
            "name": "<string>",
            "response": {}
          }
        }
      ],
      "role": "user"
    }
  ]
}
'
[
  {
    "candidates": [
      {
        "content": {
          "parts": [
            {
              "text": "<string>",
              "thought": true
            }
          ],
          "role": "<string>"
        },
        "finishReason": "STOP",
        "index": 123,
        "safetyRatings": [
          {
            "category": "<string>",
            "probability": "<string>",
            "blocked": true
          }
        ]
      }
    ],
    "usageMetadata": {
      "promptTokenCount": 123,
      "candidatesTokenCount": 123,
      "totalTokenCount": 123,
      "thoughtsTokenCount": 123,
      "promptTokensDetails": [
        {
          "modality": "<string>",
          "tokenCount": 123
        }
      ],
      "candidatesTokensDetails": [
        {
          "modality": "<string>",
          "tokenCount": 123
        }
      ]
    },
    "modelVersion": "<string>",
    "responseId": "<string>"
  }
]

承認

Authorization
string
header
必須

パスパラメータ

model
enum<string>
必須

The model to use for content generation.

利用可能なオプション:
gemini-2.5-flash,
gemini-2.5-pro,
gemini-2.5-flash-lite,
gemini-3-flash-preview,
gemini-3.1-pro,
gemini-2.0-flash
:

"gemini-2.5-flash"

クエリパラメータ

alt
enum<string>

Set to 'sse' for server-sent events streaming format.

利用可能なオプション:
sse

ボディ

application/json
contents
object[]
必須

The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries (chat), this is a repeated field that contains conversation history and the latest request.

systemInstruction
object

Developer set system instruction.

generationConfig
object

Configuration options for model generation and outputs.

tools
object[]

A list of Tools the model may use to generate the next response.

toolConfig
object

Tool configuration for the request.

safetySettings
object[]

Safety settings to block unsafe content.

cachedContent
string

The name of the cached content to use. Format: cachedContents/{cachedContent}

レスポンス

200 - text/event-stream

A stream of GenerateContentResponse objects.

candidates
object[]
usageMetadata
object
modelVersion
string
responseId
string