Skip to main content
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
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
  }
}

Authorizations

Authorization
string
header
required

All APIs require Bearer Token authentication

Add to request header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

model
string
required

Model name, e.g. gemini-2.5-flash

Example:

"gemini-2.5-flash"

Query Parameters

alt
enum<string>
default:sse
required

Must be set to 'sse' for streaming

Available options:
sse

Body

application/json
contents
object[]
required

The content of the current conversation with the model

systemInstruction
object

System instruction for the model

generationConfig
object

Configuration for generation

tools
object[]

List of tools the model may use

safetySettings
object[]

Safety settings for content filtering

Response

Stream Generate Content response (SSE stream of GenerateContentResponse chunks)

Each SSE chunk contains a GenerateContentResponse object with partial content

candidates
object[]

List of generated candidates

usageMetadata
object

Token usage metadata (present in the final chunk)