POST /v1beta/models/{model}:generateContent
text/event-stream
: keep-alive
data:
mode: "async"
Authorization: Bearer ********************
{ "contents": [ { "role": "user", "parts": [ {"text": "一张海边日落的产品海报,干净构图,不要文字"} ] } ], "generationConfig": { "responseFormat": { "image": { "aspectRatio": "16:9", "imageSize": "2K" } } }, "response_format": "b64_json" }
curl --location 'https://feichuangtech.cn/v1beta/models/gemini-3.1-flash-image:streamGenerateContent' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "contents": [ { "role": "user", "parts": [ {"text": "一张海边日落的产品海报,干净构图,不要文字"} ] } ], "generationConfig": { "responseFormat": { "image": { "aspectRatio": "16:9", "imageSize": "2K" } } }, "response_format": "b64_json" }'
: keep-alive data: {"candidates": [{"content": {"parts": [{"inlineData": {"mimeType": "image/png", "data": "iVBORw0KGgo...(Base64 示例已截断)"}}], "role": "model"}, "finishReason": "STOP"}], "usageMetadata": {"promptTokenCount": 0, "candidatesTokenCount": 0, "totalTokenCount": 0}}