cURL
stream-single-turn
curl --request POST \ --url https://api.foxapi.cc/v1beta/models/{model}:streamGenerateContent \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "contents": [ { "role": "user", "parts": [ { "text": "详细讲解 Git 的分支管理最佳实践" } ] } ] } '
{ "candidates": [ { "content": { "parts": [ { "text": "Hello! How can I help you today?" } ], "role": "model" }, "finishReason": "STOP", "safetyRatings": [ { "category": "<string>", "probability": "<string>" } ] } ], "usageMetadata": { "promptTokenCount": 25, "candidatesTokenCount": 150, "totalTokenCount": 175 } }
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
模型名称,如 gemini-2.5-flash
"gemini-2.5-flash"
必须设置为 'sse' 以启用流式输出
对话内容列表
Show child attributes
系统指令
生成配置
可用工具列表
安全设置
流式内容生成响应(SSE 格式)
候选结果列表
用量统计