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": "Explain Git branch management best practices in detail" } ] } ] } '
{ "candidates": [ { "content": { "parts": [ { "text": "Hello! How can I help you today?" } ], "role": "model" }, "finishReason": "STOP", "safetyRatings": [ { "category": "<string>", "probability": "NEGLIGIBLE" } ] } ], "usageMetadata": { "promptTokenCount": 20, "candidatesTokenCount": 150, "totalTokenCount": 170 } }
Add to request header:
Authorization: Bearer YOUR_API_KEY
Model name, e.g. gemini-2.5-flash
"gemini-2.5-flash"
Must be set to 'sse' for streaming
sse
The content of the current conversation with the model
Show child attributes
System instruction for the model
Configuration for generation
List of tools the model may use
Safety settings for content filtering
Stream Generate Content response (SSE stream of GenerateContentResponse chunks)
Each SSE chunk contains a GenerateContentResponse object with partial content
List of generated candidates
Token usage metadata (present in the final chunk)