Google Gemini · AsyncAPI Specification
Google Gemini Streaming and Live API
Version 1.0.0
AsyncAPI specification describing Google Gemini's real-time and streaming surface area: * The Live API bidirectional WebSocket service (BidiGenerateContent) used for low-latency multimodal voice, video and text interactions. * The streamGenerateContent HTTP server-sent events (SSE) endpoint used for token-by-token streaming of generated content. All message names and field names are taken from the official Google Gemini API reference at https://ai.google.dev/api/live and https://ai.google.dev/api/generate-content.
View Spec
View on GitHub
AI AgentsArtificial IntelligenceCode GenerationEmbeddingsGenerative AIImage GenerationLLMMachine LearningMulti-ModalReal-TimeFoundation ModelsAgentsAudio UnderstandingBatch ProcessingDeep ResearchDocument UnderstandingFunction CallingStructured OutputText-to-SpeechVideo GenerationVideo UnderstandingAsyncAPIEventsWebhooksWebSockets
Channels
/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent
Client-to-server messages sent over the Live API WebSocket.
Single bidirectional WebSocket channel for the Live API. The first message sent by the client MUST be BidiGenerateContentSetup, after which any of the client-to-server messages can be sent and any of the server-to-client messages can be received.
/v1beta/{model}:streamGenerateContent
Send a streamGenerateContent request.
HTTP POST endpoint that streams a sequence of GenerateContentResponse objects as server-sent events. The request body is a GenerateContentRequest; the response is text/event-stream.
Messages
BidiGenerateContentSetup
Setup
First message the client sends after opening the WebSocket. Tells the server which model to use and how to configure the session. Must be sent exactly once before any other client message.
BidiGenerateContentClientContent
Client Content
Incremental update of the conversation delivered from the client. All content here is unconditionally appended to the conversation history and used as part of the prompt to the model to generate content.
BidiGenerateContentRealtimeInput
Realtime Input
Real-time user input sent as a stream. Distinct from ClientContent in that it is sent continuously, can be interrupted by ActivityStart/ActivityEnd signaling and supports raw audio, video and text chunks.
BidiGenerateContentToolResponse
Tool Response
Response from the client to a BidiGenerateContentToolCall received from the server. Individual FunctionResponse objects are matched to their FunctionCall objects by the id field.
BidiGenerateContentSetupComplete
Setup Complete
Sent in response to a BidiGenerateContentSetup message from the client when setup processing has finished. Has no fields.
BidiGenerateContentServerContent
Server Content
Incremental server update generated by the model in response to client messages. Content is generated as quickly as possible and not in real time. Clients may choose to buffer and play it out in real time.
BidiGenerateContentToolCall
Tool Call
Request from the server for the client to execute the provided functionCalls and return the responses with the matching ids.
BidiGenerateContentToolCallCancellation
Tool Call Cancellation
Notification for the client that a previously issued BidiGenerateContentToolCall with the specified ids should not have been executed and should be cancelled.
UsageMetadataMessage
Usage Metadata
Token usage metadata for the current session.
GoAwayMessage
Go Away
Server notice that the current connection will soon be terminated. Clients should use this signal to prepare to reconnect or save state.
SessionResumptionUpdateMessage
Session Resumption Update
Update of the session resumption state. Only sent when sessionResumption was configured in the setup message.
GenerateContentRequest
Generate Content Request
Request body for streamGenerateContent. Has the same fields as the non-streaming generateContent call.
GenerateContentResponseEvent
Generate Content Response (SSE event)
A single server-sent event in the streamGenerateContent response stream. Each event is a complete GenerateContentResponse JSON object containing one or more candidates with partial content.
Servers
wss
live
generativelanguage.googleapis.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent
Gemini Live API bidirectional WebSocket endpoint (BidiGenerateContent). Stateful WSS connection that accepts audio (raw 16-bit PCM, 16kHz, little-endian), images (JPEG <= 1FPS) and text input, and streams audio (raw 16-bit PCM, 24kHz, little-endian) and text output back to the client.
https
rest
generativelanguage.googleapis.com
Gemini REST endpoint used for streamGenerateContent. The streaming response is delivered as text/event-stream (SSE) where each event is a serialized GenerateContentResponse JSON object.
AsyncAPI Specification
Work with this as data
Every AsyncAPI spec here is available over the APIs.io API and to AI agents over MCP.