Stream Generate Content
Streaming variant of generateContent. Pass ?alt=sse (as Google’s SDKs do) to receive Server-Sent Events; each data: line is a partial GenerateContentResponse. The request body matches :generateContent.
Authorizations
API key authentication. Pass your API key as a Bearer token.
Headers
Function name for tracing and project-level guardrail function-scope filtering.
Parent span ID for distributed tracing context.
Comma-separated key:value usage-attribution tags (e.g. tenant:acme,project:demo, max 8). Recorded on the generation's billing/metrics rows; group spend by any key via GET /v2/analytics/usage?group_by=. Header-borne twin of the /v3/session URL prefix tags (which win per key when both are present); opper.-prefixed keys and session_id are reserved. Malformed values return 400.
Path Parameters
Model id — a bare Gemini name (e.g. gemini-2.5-flash, resolved against the Gemini-direct provider) or an Opper-canonical id (e.g. vertexai/gemini-2.5-flash).
Query Parameters
Set to sse for Server-Sent Events framing (matches Google SDK behaviour).
sse Body
Any value
Any value
Opt in to automatic prompt caching for Anthropic-family models routed through this Gemini-shape endpoint: {"type":"ephemeral"} (optionally "ttl":"1h"). Places one moving cache breakpoint on the largest cacheable prefix. Caching is off unless set; no-op on Gemini and other providers with automatic server-side caching. Cache writes cost 1.25x input and reads 0.1x