AI 服务/大语言模型
Gemini 流式对话
Changed on接口说明:Gemini :streamGenerateContent API 的兼容端点(流式输出,SSE)。请求与响应格式遵循 Gemini 规范;鉴权使用 x-goog-api-key 头(Gemini SDK 默认携带),已有 Gemini SDK 只需替换 baseURL 与 API Key 即可接入,按 AiToEarn 积分计费。
调用本接口前,请先请求「对话模型列表」接口(GET /api/ai/models/chat),获取当前可用的模型列表。
post/api/ai/v1beta/models/{model}:streamGenerateContent
Request
- Base URLhttps://aitoearn.cn
- AuthAPI key in header x-goog-api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
modelstring required
Example:gemini-3.5-flash
模型 ID。先调用「对话模型列表」接口(GET /api/ai/models/chat),传入其返回的 data[n].name。
Request body
Example request
{
"model": "gemini-3.5-flash"
}Response
第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。
Changes
- breaking
removed the media type
application/jsonfor the response with the status
- breaking