Skip to navigation

Stream generated content (Gemini streamGenerateContent format)

The streamed form of generateContent. Send ?alt=sse, as the Google GenAI SDKs and gemini-cli do. Meadow refuses the stream without it. The response is text/event-stream with one data: line per GenerateContentResponse chunk, as the vendor sent it. Token counts in usageMetadata add up over the stream, so the last chunk holds the final ones. Auth, model ids, limits and errors are as on generateContent. /v1/models/{model}:streamGenerateContent is served too.

Scope: models.

curl -sS -N "$MEADOW_BASE_URL/v1beta/models/gemini-3.8-flash:streamGenerateContent?alt=sse" \
-H "x-goog-api-key: $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"role":"user","parts":[{"text":"Reply with the single word: meadow"}]}],
"generationConfig":{"maxOutputTokens":16}}'

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

modelstringRequired

A Meadow model id, for example gemini-3.8-flash.

Query parameters

altenumRequired

Must be sse.

Allowed values:

Request

A Google GenerateContentRequest, passed to the vendor unchanged. At most 16 MiB.

Response headers

x-meadow-providerstringOptional

The provider that answered, for example anthropic. Present on a 200 and on a vendor error that was passed through.

x-meadow-modelstringOptional
The vendor's own id for the model that answered.
x-meadow-attemptsintegerOptional
The number of vendors tried, including the one that answered. A value above 1 means a fallback happened.
x-meadow-routestringOptional

Why this vendor answered, in stable codes only. direct: <vendor> when the first vendor in the route served the call. fallback: <vendor> <reason> -> <vendor> when an earlier vendor failed, with the same reason codes as attempts[].reason in an error body. failed: ... on a vendor error passed through. It never carries vendor error text.

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

x-meadow-provider-request-idstringOptional

The request id of the vendor that answered, taken from its x-request-id, request-id, x-amzn-requestid, apim-request-id or x-generation-id header, the first one present in that order. Use it with that vendor’s support. Vendors tried before a fallback are not listed. Absent when the vendor sent none.

Response

The vendor's event stream, unchanged.