SPB Git

Repository Public

live-api.md 6.2 KB 96 lines markdown

1The Live API enables low-latency, real-time voice and vision interactions with2Gemini. It processes continuous streams of audio, images, and text to deliver3immediate, human-like spoken responses, creating a natural conversational4experience for your users.56![Live API Overview](https://ai.google.dev/static/gemini-api/docs/images/live-api-overview.png)7[Try the Live API in Google AI Studio](https://aistudio.google.com/live) [Clone example apps from GitHub](https://github.com/google-gemini/gemini-live-api-examples) [Use coding agent skills](https://ai.google.dev/gemini-api/docs/coding-agents)89## Use cases1011Live API can be used to build real-time voice agents for a12variety of industries, including:1314- **E-commerce and retail:** Shopping assistants that offer personalized recommendations and support agents that resolve customer issues.15- **Gaming:** Interactive non-player characters (NPCs), in-game help assistants, and real-time translation of in-game content.16- **Next-gen interfaces:** Voice- and video-enabled experiences in robotics, smart glasses, and vehicles.17- **Healthcare:** Health companions for patient support and education.18- **Financial services:** AI advisors for wealth management and investment guidance.19- **Education:** AI mentors and learner companions that provide personalized instruction and feedback.20- **Translation and localization:** Real-time, low-latency translation of spoken conversations, enabling seamless multilingual communication.21- **Live transcription and captioning:** Real-time speech-to-text streaming for live subtitles, meeting transcription, voice dictation, and customer call logging.2223## Key features2425Live API offers a comprehensive set of features for building26robust voice agents:2728- [**Multilingual support**](https://ai.google.dev/gemini-api/docs/live-guide#supported-languages): Converse in 70 supported languages.29- [**Barge-in**](https://ai.google.dev/gemini-api/docs/live-guide#interruptions): Users can interrupt the model at any time for responsive interactions.30- [**Tool use**](https://ai.google.dev/gemini-api/docs/live-tools): Integrates tools like function calling and Google Search for dynamic interactions.31- [**Audio transcriptions**](https://ai.google.dev/gemini-api/docs/live-guide#audio-transcription): Provides text transcripts of both user input and model output.32- [**Proactive audio**](https://ai.google.dev/gemini-api/docs/live-guide#proactive-audio): Lets you control when the model responds and in what contexts.33- [**Affective dialog**](https://ai.google.dev/gemini-api/docs/live-guide#affective-dialog): Adapts response style and tone to match the user's input expression.34- [**Live Transcription**](https://ai.google.dev/gemini-api/docs/live-api/live-transcribe): Real-time, continuous speech-to-text streaming with automatic language detection and custom vocabulary.35- [**Live Translation**](https://ai.google.dev/gemini-api/docs/live-api/live-translate): Real-time voice-to-voice translation in 70+ languages.3637## Technical specifications3839The following table outlines the technical specifications for the40Live API:4142| Category | Details |43|---|---|44| Input modalities | Audio (raw 16-bit PCM audio, 16kHz, little-endian), images (JPEG \<= 1FPS), text |45| Output modalities | Audio (raw 16-bit PCM audio, 24kHz, little-endian) |46| Protocol | Stateful WebSocket connection (WSS) |4748## Choose an implementation approach4950When integrating with Live API, you'll need to choose one of the following51implementation approaches:5253- **Server-to-server** : Your backend connects to the Live API using [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API). Typically, your client sends stream data (audio, video, text) to your server, which then forwards it to the Live API.54- **Client-to-server** : Your frontend code connects directly to the Live API using [WebSockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) to stream data, bypassing your backend.5556> [!NOTE]57> **Note:** Client-to-server generally offers better performance for streaming audio and video, since it bypasses the need to send the stream to your backend first. It's also easier to set up since you don't need to implement a proxy that sends data from your client to your server and then your server to the API. However, for production environments, in order to mitigate security risks, we recommend using [ephemeral tokens](https://ai.google.dev/gemini-api/docs/ephemeral-tokens) instead of standard API keys.5859## Get started6061Select the guide that matches your development environment:62Server-to-server6364### [GenAI SDK tutorial](https://ai.google.dev/gemini-api/docs/live-api/get-started-sdk)656667Connect to the Gemini Live API using the GenAI SDK to build a real-time multimodal application with a Python backend.6869Client-to-server7071### [WebSocket tutorial](https://ai.google.dev/gemini-api/docs/live-api/get-started-websocket)727374Connect to the Gemini Live API using WebSockets to build a real-time multimodal application with a JavaScript frontend and ephemeral tokens.7576Agent development kit7778### [ADK tutorial](https://google.github.io/adk-docs/streaming/)798081Create an agent and use the Agent Development Kit (ADK) Streaming to enable voice and video communication.8283## Partner integrations848586To streamline the development of real-time audio and video apps, you can use87a third-party integration that supports the Gemini Live88API over WebRTC or WebSockets.89[LiveKit90Use the Gemini Live API with LiveKit Agents.](https://docs.livekit.io/agents/models/realtime/plugins/gemini/) [Pipecat by Daily91Create a real-time AI chatbot using Gemini Live and Pipecat.](https://docs.pipecat.ai/guides/features/gemini-live) [Fishjam by Software Mansion92Create live video and audio streaming applications with Fishjam.](https://docs.fishjam.io/tutorials/gemini-live-integration) [Vision Agents by Stream93Build real-time voice and video AI applications with Vision Agents.](https://visionagents.ai/integrations/gemini) [Voximplant94Connect inbound and outbound calls to Live API with Voximplant.](https://voximplant.com/products/gemini-client) [Agora95Build real-time conversational AI applications with Agora.](https://docs.agora.io/en/conversational-ai/models/mllm/gemini) [Firebase AI SDK96Get started with the Gemini Live API using Firebase AI Logic.](https://firebase.google.com/docs/ai-logic/live-api?api=dev)
Files main
Menu

Theme