Skip to main content
POST
流式生成内容
This API uses the same request format as Generate content and returns the model’s generated results incrementally. Set alt=sse to receive the response via Server-Sent Events; each data event contains a JSON response chunk. Provide your GeekAI API KEY in the x-goog-api-key header and replace {model} with the Gemini model ID. Available features depend on the model and proxy route; for the detailed format, see the official Gemini streaming API documentation.

Authorizations

Authorization
string
header
required

极客智坊 API KEY

Path Parameters

model
string
required

Gemini 模型 ID,不包含 models/ 前缀。

Example:

"gemini-3-flash-preview"

Query Parameters

alt
string

设置为 sse 时以 Server-Sent Events 格式返回流式响应。

Example:

"sse"

Body

application/json
contents
object[]
required

当前请求的对话内容;多轮对话需包含历史消息和最新消息。

systemInstruction
object

开发者提供的系统指令,目前仅支持文本。

tools
object[]

模型可使用的工具;可用工具取决于模型和渠道。

toolConfig
object
safetySettings
object[]

按类别覆盖默认安全设置;同一类别不能重复。

generationConfig
object

生成参数。默认值和可用范围可能因模型而异。

cachedContent
string

缓存内容资源名称,格式为 cachedContents/{cachedContent}。

serviceTier
enum<string>

请求的服务等级,是否可用取决于模型和渠道。

Available options:
unspecified,
standard,
flex,
priority
store
boolean

此请求的日志记录配置,设置时覆盖项目级配置。

continuationToken
string

用于继续 finishReason 为 CONTINUATION 的响应;contents 必须与原请求一致。

labels
object

用户定义的请求标签。

Response

流式生成结果;使用 alt=sse 时,data 事件包含 JSON 格式的响应片段。

SSE 事件流,事件之间以空行分隔。