Gemini

Stream generate content (Gemini-compatible)

Streams native Gemini GenerateContent Server-Sent Events without adding Chat Completions terminators. Metadata-only chunks, intermediate chunks without finishReason, and natural EOF are valid.

Authentication: Use ?key= query parameter, x-goog-api-key header, or Authorization: Bearer header.

post/v1beta/models/{model}:streamGenerateContent

Request

  • Base URL: https://api.tokenlab.sh
  • URL: https://api.tokenlab.sh/v1beta/models/{model}:streamGenerateContent
  • Auth: HTTP bearer

Path parameters

modelstring required

Model name (e.g., gemini-2.5-pro)

Query parameters

keystring

API key (alternative to header auth)

Headers

X-TokenLab-Delivery-Policy'auto' | 'verified' | 'official'

Per-request Delivery policy. Overrides the API key and Workspace defaults. Auto tries TokenLab Verified first and may switch once to Official only before output, request acceptance, or persistent resource creation.

Request body

cachedContentstring

Gemini cached content resource name for compatible models.

system_instructionobject

Original proto field-name spelling of systemInstruction.

generation_configobject

Original proto field-name spelling of generationConfig.

safety_settingsobject[]

Original proto field-name spelling of safetySettings.

tool_configobject

Original proto field-name spelling of toolConfig.

cached_contentstring

Original proto field-name spelling of cachedContent.

Response

Streaming response

Changes

No recorded changes to this operation across all 1 revision of this API.