[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79DQ2JRMEZ3BAMY96JEFEDD":3,"skill-same:01M79DQ2JRMEZ3BAMY96JEFEDD":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M79DQ2JRMEZ3BAMY96JEFEDD","gemini-live-api-dev",null,"Use this skill when building real-time, bidirectional streaming applications with the Gemini Live API. Covers WebSocket-based audio\u002Fvideo\u002Ftext streaming, voice activity detection (VAD), native audio features, function calling, session management, ephemeral tokens for client-side auth, live translation, and all Live API configuration options. SDKs covered - google-genai (Python), @google\u002Fgenai (JavaScript\u002FTypeScript).","hamzabellouch\u002Fagent-skills","hamzabellouch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F237856042?v=4","01M79BRYW7XAMK3YDWQEMTWGWS","Hamza Bellouch","01M79BRYWXQV3JK2TGVTX8GN2A",8,"MIT","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FProgramming\u002FAI_Engineering_and_Platforms\u002FAgents_and_LLM_Platforms\u002Fgemini-live-api-dev\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: gemini-live-api-dev\ndescription: Use this skill when building real-time, bidirectional streaming applications with the Gemini Live API. Covers WebSocket-based audio\u002Fvideo\u002Ftext streaming, voice activity detection (VAD), native audio features, function calling, session management, ephemeral tokens for client-side auth, live translation, and all Live API configuration options. SDKs covered - google-genai (Python), @google\u002Fgenai (JavaScript\u002FTypeScript).\n---\n\n# Gemini Live API Development Skill\n\n## Overview\n\nThe Live API enables **low-latency, real-time voice and video interactions** with Gemini over WebSockets. It processes continuous streams of audio, video, or text to deliver immediate, human-like spoken responses.\n\nKey capabilities:\n- **Bidirectional audio streaming** — real-time mic-to-speaker conversations\n- **Video streaming** — send camera\u002Fscreen frames alongside audio\n- **Text input\u002Foutput** — send and receive text within a live session\n- **Audio transcriptions** — get text transcripts of both input and output audio\n- **Voice Activity Detection (VAD)** — automatic interruption handling\n- **Native audio** — thinking (with configurable `thinkingLevel`)\n- **Function calling** — synchronous tool use\n- **Google Search grounding** — ground responses in real-time search results\n- **Session management** — context compression, session resumption, GoAway signals\n- **Ephemeral tokens** — secure client-side authentication\n\n> [!NOTE]\n> The Live API currently **only supports WebSockets**. For WebRTC support or simplified integration, use a [partner integration](#partner-integrations).\n\n## Models\n\n- `gemini-3.1-flash-live-preview` — Optimized for low-latency, real-time dialogue. Native audio output, thinking (via `thinkingLevel`). 128k context window. **This is the recommended model for all Live API use cases.**\n- `gemini-3.5-live-translate-preview` — Real-time streaming translation model.\n\n> [!WARNING]\n> The following Live API models are **deprecated** and will be shut down. Migrate to `gemini-3.1-flash-live-preview`.\n> - `gemini-2.5-flash-native-audio-preview-12-2025` — Migrate to `gemini-3.1-flash-live-preview`.\n> - `gemini-live-2.5-flash-preview` — Released June 17, 2025. Shutdown: December 9, 2025.\n> - `gemini-2.0-flash-live-001` — Released April 9, 2025. Shutdown: December 9, 2025.\n\n## SDKs\n\n- **Python**: `google-genai` — `pip install google-genai`\n- **JavaScript\u002FTypeScript**: `@google\u002Fgenai` — `npm install @google\u002Fgenai`\n\n> [!WARNING]\n> Legacy SDKs `google-generativeai` (Python) and `@google\u002Fgenerative-ai` (JS) are deprecated. Use the new SDKs above.\n\n## Partner Integrations\n\nTo streamline real-time audio\u002Fvideo app development, use a third-party integration supporting the Gemini Live API over **WebRTC** or **WebSockets**:\n\n- [LiveKit](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Frealtime\u002Fplugins\u002Fgemini\u002F) — Use the Gemini Live API with LiveKit Agents.\n- [Pipecat by Daily](https:\u002F\u002Fdocs.pipecat.ai\u002Fguides\u002Ffeatures\u002Fgemini-live) — Create a real-time AI chatbot using Gemini Live and Pipecat.\n- [Fishjam by Software Mansion](https:\u002F\u002Fdocs.fishjam.io\u002Ftutorials\u002Fgemini-live-integration) — Create live video and audio streaming applications with Fishjam.\n- [Vision Agents by Stream](https:\u002F\u002Fvisionagents.ai\u002Fintegrations\u002Fgemini) — Build real-time voice and video AI applications with Vision Agents.\n- [Voximplant](https:\u002F\u002Fvoximplant.com\u002Fproducts\u002Fgemini-client) — Connect inbound and outbound calls to Live API with Voximplant.\n- [Firebase AI SDK](https:\u002F\u002Ffirebase.google.com\u002Fdocs\u002Fai-logic\u002Flive-api?api=dev) — Get started with the Gemini Live API using Firebase AI Logic.\n\n## Audio Formats\n\n- **Input**: Raw PCM, little-endian, 16-bit, mono. 16kHz native (will resample others). MIME type: `audio\u002Fpcm;rate=16000`\n- **Output**: Raw PCM, little-endian, 16-bit, mono. 24kHz sample rate.\n\n> [!IMPORTANT]\n> Use `send_realtime_input` \u002F `sendRealtimeInput` for all real-time user input (audio, video, **and text**). `send_client_content` \u002F `sendClientContent` is **only** supported for seeding initial context history (requires setting `initial_history_in_client_content` in `history_config`). Do **not** use it to send new user messages during the conversation.\n\n> [!WARNING]\n> Do **not** use `media` in `sendRealtimeInput`. Use the specific keys: `audio` for audio data, `video` for images\u002Fvideo frames, and `text` for text input.\n\n---\n\n## Quick Start\n\n### Authentication\n\n#### Python\n\n```python\nfrom google import genai\n\nclient = genai.Client(api_key=\"YOUR_API_KEY\")\n```\n\n#### JavaScript\n\n```js\nimport { GoogleGenAI } from '@google\u002Fgenai';\n\nconst ai = new GoogleGenAI({ apiKey: 'YOUR_API_KEY' });\n```\n\n### Connecting to the Live API\n\n#### Python\n```python\nfrom google.genai import types\n\nconfig = types.LiveConnectConfig(\n    response_modalities=[types.Modality.AUDIO],\n    system_instruction=types.Content(\n        parts=[types.Part(text=\"You are a helpful assistant.\")]\n    )\n)\n\nasync with client.aio.live.connect(model=\"gemini-3.1-flash-live-preview\", config=config) as session:\n    pass  # Session is active\n```\n\n#### JavaScript\n```js\nconst session = await ai.live.connect({\n  model: 'gemini-3.1-flash-live-preview',\n  config: {\n    responseModalities: ['audio'],\n    systemInstruction: { parts: [{ text: 'You are a helpful assistant.' }] }\n  },\n  callbacks: {\n    onopen: () => console.log('Connected'),\n    onmessage: (response) => console.log('Message:', response),\n    onerror: (error) => console.error('Error:', error),\n    onclose: () => console.log('Closed')\n  }\n});\n```\n\n### Sending Text\n\n#### Python\n```python\nawait session.send_realtime_input(text=\"Hello, how are you?\")\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({ text: 'Hello, how are you?' });\n```\n\n### Sending Audio\n\n#### Python\n```python\nawait session.send_realtime_input(\n    audio=types.Blob(data=chunk, mime_type=\"audio\u002Fpcm;rate=16000\")\n)\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({\n  audio: { data: chunk.toString('base64'), mimeType: 'audio\u002Fpcm;rate=16000' }\n});\n```\n\n### Sending Video\n\n#### Python\n```python\n# frame: raw JPEG-encoded bytes\nawait session.send_realtime_input(\n    video=types.Blob(data=frame, mime_type=\"image\u002Fjpeg\")\n)\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({\n  video: { data: frame.toString('base64'), mimeType: 'image\u002Fjpeg' }\n});\n```\n\n### Receiving Audio and Text\n\n> [!IMPORTANT]\n> A single server event can contain **multiple content parts simultaneously** (e.g., audio chunks and transcript). Always process **all** parts in each event to avoid missing content.\n\n#### Python\n```python\nasync for response in session.receive():\n    content = response.server_content\n    if content:\n        # Audio — process ALL parts in each event\n        if content.model_turn:\n            for part in content.model_turn.parts:\n                if part.inline_data:\n                    audio_data = part.inline_data.data\n        # Transcription\n        if content.input_transcription:\n            print(f\"User: {content.input_transcription.text}\")\n        if content.output_transcription:\n            print(f\"Gemini: {content.output_transcription.text}\")\n        # Interruption\n        if content.interrupted is True:\n            pass  # Stop playback, clear audio queue\n```\n\n#### JavaScript\n```js\n\u002F\u002F Inside the onmessage callback\nconst content = response.serverContent;\nif (content?.modelTurn?.parts) {\n  for (const part of content.modelTurn.parts) {\n    if (part.inlineData) {\n      const audioData = part.inlineData.data; \u002F\u002F Base64 encoded\n    }\n  }\n}\nif (content?.inputTranscription) console.log('User:', content.inputTranscription.text);\nif (content?.outputTranscription) console.log('Gemini:', content.outputTranscription.text);\nif (content?.interrupted) { \u002F* Stop playback, clear audio queue *\u002F }\n```\n\n---\n\n## Live Translation (Gemini Live Translate)\n\nThe Live API supports real-time, low-latency streaming translation of speech (audio) across 70+ languages. For full details on options and capabilities, see the [Live Translate Guide](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-api\u002Flive-translate.md.txt).\n\n### Model\n- `gemini-3.5-live-translate-preview` — The recommended translation model for all Live Translate use cases.\n\n### Configuration (`TranslationConfig`)\n\nTo enable translation, specify a `TranslationConfig` object inside your live session setup:\n\n- **Python SDK**: Configure the connection using `translation_config` on `LiveConnectConfig`:\n  ```python\n  config = types.LiveConnectConfig(\n      response_modalities=[types.Modality.AUDIO],\n      translation_config=types.TranslationConfig(\n          target_language_code=\"es\",  # Target language code (e.g. es, fr, pl)\n          echo_target_language=True,\n      ),\n      input_audio_transcription=types.AudioTranscriptionConfig(),\n      output_audio_transcription=types.AudioTranscriptionConfig(),\n  )\n  ```\n- **Raw WebSockets**: Place `translationConfig` inside `generationConfig`:\n  ```json\n  {\n    \"setup\": {\n      \"model\": \"models\u002Fgemini-3.5-live-translate-preview\",\n      \"generationConfig\": {\n        \"responseModalities\": [\"AUDIO\"],\n        \"translationConfig\": {\n          \"targetLanguageCode\": \"es\",\n          \"echoTargetLanguage\": true\n        }\n      }\n    }\n  }\n  ```\n\n---\n\n## Limitations\n\n- **Response modality** — Only `TEXT` **or** `AUDIO` per session, not both. Native audio models only support audio.\n- **Audio-only session** — 15 min without compression\n- **Audio+video session** — 2 min without compression\n- **Connection lifetime** — ~10 min (use session resumption)\n- **Context window** — 128k tokens (native audio) \u002F 32k tokens (standard)\n- **Async function calling** — Not yet supported; function calling is synchronous only. The model will not start responding until you've sent the tool response.\n- **Proactive audio** — Not yet supported in Gemini 3.1 Flash Live. Remove any configuration for this feature.\n- **Affective dialogue** — Not yet supported in Gemini 3.1 Flash Live. Remove any configuration for this feature.\n- **Code execution** — Not supported\n- **URL context** — Not supported\n\n## Migrating from Gemini 2.5 Flash Live\n\nWhen migrating from `gemini-2.5-flash-native-audio-preview-12-2025` to `gemini-3.1-flash-live-preview`:\n\n1. **Model string** — Update from `gemini-2.5-flash-native-audio-preview-12-2025` to `gemini-3.1-flash-live-preview`.\n2. **Thinking configuration** — Use `thinkingLevel` (`minimal`, `low`, `medium`, `high`) instead of `thinkingBudget`. Default is `minimal` for lowest latency.\n3. **Server events** — A single event can contain multiple content parts simultaneously (audio + transcript). Process **all** parts in each event.\n4. **Client content** — `send_client_content` is only for seeding initial context history (set `initial_history_in_client_content` in `history_config`). Use `send_realtime_input` for text during conversation.\n5. **Turn coverage** — Defaults to `TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO` instead of `TURN_INCLUDES_ONLY_ACTIVITY`. If sending constant video frames, consider sending only during audio activity to reduce costs.\n6. **Async function calling** — Not yet supported. Function calling is synchronous only.\n7. **Proactive audio & affective dialogue** — Not yet supported. Remove any configuration for these features.\n\n## Best Practices\n\n1. **Use headphones** when testing mic audio to prevent echo\u002Fself-interruption\n2. **Enable context window compression** for sessions longer than 15 minutes\n3. **Implement session resumption** to handle connection resets gracefully\n4. **Use ephemeral tokens** for client-side deployments — never expose API keys in browsers\n5. **Use `send_realtime_input`** for all real-time user input (audio, video, text). Reserve `send_client_content` only for seeding initial context history\n6. **Send `audioStreamEnd`** when the mic is paused to flush cached audio\n7. **Clear audio playback queues** on interruption signals\n8. **Process all parts** in each server event — events can contain multiple content parts\n\n## Documentation Lookup\n\n### When MCP is Installed (Preferred)\n\nIf the **`search_docs`** tool (from the Google MCP server) is available, use it as your **only** documentation source:\n\n1. Call `search_docs` with your query\n2. Read the returned documentation\n3. **Trust MCP results** as source of truth for API details — they are always up-to-date.\n\n> [!IMPORTANT]\n> When MCP tools are present, **never** fetch URLs manually. MCP provides up-to-date, indexed documentation that is more accurate and token-efficient than URL fetching.\n\n### When MCP is NOT Installed (Fallback Only)\n\nIf no MCP documentation tools are available, fetch from the official docs index:\n\n**llms.txt URL**: `https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fllms.txt`\n\nThis index contains links to all documentation pages in `.md.txt` format. Use web fetch tools to:\n\n1. Fetch `llms.txt` to discover available documentation pages\n2. Fetch specific pages (e.g., `https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-session.md.txt`)\n\n### Key Documentation Pages \n\n> [!IMPORTANT]\n> Those are not all the documentation pages. Use the `llms.txt` index to discover available documentation pages\n\n- [Live API Overview](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive.md.txt) — getting started, raw WebSocket usage\n- [Live Translate](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-api\u002Flive-translate.md.txt) — configuration options and capabilities for translation\n- [Live API Capabilities Guide](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-guide.md.txt) — voice config, transcription config, native audio (thinking), VAD configuration, media resolution\n- [Live API Tool Use](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-tools.md.txt) — function calling (sync and async), Google Search grounding\n- [Session Management](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-session.md.txt) — context window compression, session resumption, GoAway signals\n- [Ephemeral Tokens](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fephemeral-tokens.md.txt) — secure client-side authentication for browser\u002Fmobile\n- [WebSockets API Reference](https:\u002F\u002Fai.google.dev\u002Fapi\u002Flive.md.txt) — raw WebSocket protocol details\n\n## Supported Languages\n\nThe Live API supports 70 languages including: English, Spanish, French, German, Italian, Portuguese, Chinese, Japanese, Korean, Hindi, Arabic, Russian, and many more. Native audio models automatically detect and switch languages.\n","# Gemini Live API Development Skill\n\n## Overview\n\nThe Live API enables **low-latency, real-time voice and video interactions** with Gemini over WebSockets. It processes continuous streams of audio, video, or text to deliver immediate, human-like spoken responses.\n\nKey capabilities:\n- **Bidirectional audio streaming** — real-time mic-to-speaker conversations\n- **Video streaming** — send camera\u002Fscreen frames alongside audio\n- **Text input\u002Foutput** — send and receive text within a live session\n- **Audio transcriptions** — get text transcripts of both input and output audio\n- **Voice Activity Detection (VAD)** — automatic interruption handling\n- **Native audio** — thinking (with configurable `thinkingLevel`)\n- **Function calling** — synchronous tool use\n- **Google Search grounding** — ground responses in real-time search results\n- **Session management** — context compression, session resumption, GoAway signals\n- **Ephemeral tokens** — secure client-side authentication\n\n> [!NOTE]\n> The Live API currently **only supports WebSockets**. For WebRTC support or simplified integration, use a [partner integration](#partner-integrations).\n\n## Models\n\n- `gemini-3.1-flash-live-preview` — Optimized for low-latency, real-time dialogue. Native audio output, thinking (via `thinkingLevel`). 128k context window. **This is the recommended model for all Live API use cases.**\n- `gemini-3.5-live-translate-preview` — Real-time streaming translation model.\n\n> [!WARNING]\n> The following Live API models are **deprecated** and will be shut down. Migrate to `gemini-3.1-flash-live-preview`.\n> - `gemini-2.5-flash-native-audio-preview-12-2025` — Migrate to `gemini-3.1-flash-live-preview`.\n> - `gemini-live-2.5-flash-preview` — Released June 17, 2025. Shutdown: December 9, 2025.\n> - `gemini-2.0-flash-live-001` — Released April 9, 2025. Shutdown: December 9, 2025.\n\n## SDKs\n\n- **Python**: `google-genai` — `pip install google-genai`\n- **JavaScript\u002FTypeScript**: `@google\u002Fgenai` — `npm install @google\u002Fgenai`\n\n> [!WARNING]\n> Legacy SDKs `google-generativeai` (Python) and `@google\u002Fgenerative-ai` (JS) are deprecated. Use the new SDKs above.\n\n## Partner Integrations\n\nTo streamline real-time audio\u002Fvideo app development, use a third-party integration supporting the Gemini Live API over **WebRTC** or **WebSockets**:\n\n- [LiveKit](https:\u002F\u002Fdocs.livekit.io\u002Fagents\u002Fmodels\u002Frealtime\u002Fplugins\u002Fgemini\u002F) — Use the Gemini Live API with LiveKit Agents.\n- [Pipecat by Daily](https:\u002F\u002Fdocs.pipecat.ai\u002Fguides\u002Ffeatures\u002Fgemini-live) — Create a real-time AI chatbot using Gemini Live and Pipecat.\n- [Fishjam by Software Mansion](https:\u002F\u002Fdocs.fishjam.io\u002Ftutorials\u002Fgemini-live-integration) — Create live video and audio streaming applications with Fishjam.\n- [Vision Agents by Stream](https:\u002F\u002Fvisionagents.ai\u002Fintegrations\u002Fgemini) — Build real-time voice and video AI applications with Vision Agents.\n- [Voximplant](https:\u002F\u002Fvoximplant.com\u002Fproducts\u002Fgemini-client) — Connect inbound and outbound calls to Live API with Voximplant.\n- [Firebase AI SDK](https:\u002F\u002Ffirebase.google.com\u002Fdocs\u002Fai-logic\u002Flive-api?api=dev) — Get started with the Gemini Live API using Firebase AI Logic.\n\n## Audio Formats\n\n- **Input**: Raw PCM, little-endian, 16-bit, mono. 16kHz native (will resample others). MIME type: `audio\u002Fpcm;rate=16000`\n- **Output**: Raw PCM, little-endian, 16-bit, mono. 24kHz sample rate.\n\n> [!IMPORTANT]\n> Use `send_realtime_input` \u002F `sendRealtimeInput` for all real-time user input (audio, video, **and text**). `send_client_content` \u002F `sendClientContent` is **only** supported for seeding initial context history (requires setting `initial_history_in_client_content` in `history_config`). Do **not** use it to send new user messages during the conversation.\n\n> [!WARNING]\n> Do **not** use `media` in `sendRealtimeInput`. Use the specific keys: `audio` for audio data, `video` for images\u002Fvideo frames, and `text` for text input.\n\n---\n\n## Quick Start\n\n### Authentication\n\n#### Python\n\n```python\nfrom google import genai\n\nclient = genai.Client(api_key=\"YOUR_API_KEY\")\n```\n\n#### JavaScript\n\n```js\nimport { GoogleGenAI } from '@google\u002Fgenai';\n\nconst ai = new GoogleGenAI({ apiKey: 'YOUR_API_KEY' });\n```\n\n### Connecting to the Live API\n\n#### Python\n```python\nfrom google.genai import types\n\nconfig = types.LiveConnectConfig(\n    response_modalities=[types.Modality.AUDIO],\n    system_instruction=types.Content(\n        parts=[types.Part(text=\"You are a helpful assistant.\")]\n    )\n)\n\nasync with client.aio.live.connect(model=\"gemini-3.1-flash-live-preview\", config=config) as session:\n    pass  # Session is active\n```\n\n#### JavaScript\n```js\nconst session = await ai.live.connect({\n  model: 'gemini-3.1-flash-live-preview',\n  config: {\n    responseModalities: ['audio'],\n    systemInstruction: { parts: [{ text: 'You are a helpful assistant.' }] }\n  },\n  callbacks: {\n    onopen: () => console.log('Connected'),\n    onmessage: (response) => console.log('Message:', response),\n    onerror: (error) => console.error('Error:', error),\n    onclose: () => console.log('Closed')\n  }\n});\n```\n\n### Sending Text\n\n#### Python\n```python\nawait session.send_realtime_input(text=\"Hello, how are you?\")\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({ text: 'Hello, how are you?' });\n```\n\n### Sending Audio\n\n#### Python\n```python\nawait session.send_realtime_input(\n    audio=types.Blob(data=chunk, mime_type=\"audio\u002Fpcm;rate=16000\")\n)\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({\n  audio: { data: chunk.toString('base64'), mimeType: 'audio\u002Fpcm;rate=16000' }\n});\n```\n\n### Sending Video\n\n#### Python\n```python\n# frame: raw JPEG-encoded bytes\nawait session.send_realtime_input(\n    video=types.Blob(data=frame, mime_type=\"image\u002Fjpeg\")\n)\n```\n\n#### JavaScript\n```js\nsession.sendRealtimeInput({\n  video: { data: frame.toString('base64'), mimeType: 'image\u002Fjpeg' }\n});\n```\n\n### Receiving Audio and Text\n\n> [!IMPORTANT]\n> A single server event can contain **multiple content parts simultaneously** (e.g., audio chunks and transcript). Always process **all** parts in each event to avoid missing content.\n\n#### Python\n```python\nasync for response in session.receive():\n    content = response.server_content\n    if content:\n        # Audio — process ALL parts in each event\n        if content.model_turn:\n            for part in content.model_turn.parts:\n                if part.inline_data:\n                    audio_data = part.inline_data.data\n        # Transcription\n        if content.input_transcription:\n            print(f\"User: {content.input_transcription.text}\")\n        if content.output_transcription:\n            print(f\"Gemini: {content.output_transcription.text}\")\n        # Interruption\n        if content.interrupted is True:\n            pass  # Stop playback, clear audio queue\n```\n\n#### JavaScript\n```js\n\u002F\u002F Inside the onmessage callback\nconst content = response.serverContent;\nif (content?.modelTurn?.parts) {\n  for (const part of content.modelTurn.parts) {\n    if (part.inlineData) {\n      const audioData = part.inlineData.data; \u002F\u002F Base64 encoded\n    }\n  }\n}\nif (content?.inputTranscription) console.log('User:', content.inputTranscription.text);\nif (content?.outputTranscription) console.log('Gemini:', content.outputTranscription.text);\nif (content?.interrupted) { \u002F* Stop playback, clear audio queue *\u002F }\n```\n\n---\n\n## Live Translation (Gemini Live Translate)\n\nThe Live API supports real-time, low-latency streaming translation of speech (audio) across 70+ languages. For full details on options and capabilities, see the [Live Translate Guide](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-api\u002Flive-translate.md.txt).\n\n### Model\n- `gemini-3.5-live-translate-preview` — The recommended translation model for all Live Translate use cases.\n\n### Configuration (`TranslationConfig`)\n\nTo enable translation, specify a `TranslationConfig` object inside your live session setup:\n\n- **Python SDK**: Configure the connection using `translation_config` on `LiveConnectConfig`:\n  ```python\n  config = types.LiveConnectConfig(\n      response_modalities=[types.Modality.AUDIO],\n      translation_config=types.TranslationConfig(\n          target_language_code=\"es\",  # Target language code (e.g. es, fr, pl)\n          echo_target_language=True,\n      ),\n      input_audio_transcription=types.AudioTranscriptionConfig(),\n      output_audio_transcription=types.AudioTranscriptionConfig(),\n  )\n  ```\n- **Raw WebSockets**: Place `translationConfig` inside `generationConfig`:\n  ```json\n  {\n    \"setup\": {\n      \"model\": \"models\u002Fgemini-3.5-live-translate-preview\",\n      \"generationConfig\": {\n        \"responseModalities\": [\"AUDIO\"],\n        \"translationConfig\": {\n          \"targetLanguageCode\": \"es\",\n          \"echoTargetLanguage\": true\n        }\n      }\n    }\n  }\n  ```\n\n---\n\n## Limitations\n\n- **Response modality** — Only `TEXT` **or** `AUDIO` per session, not both. Native audio models only support audio.\n- **Audio-only session** — 15 min without compression\n- **Audio+video session** — 2 min without compression\n- **Connection lifetime** — ~10 min (use session resumption)\n- **Context window** — 128k tokens (native audio) \u002F 32k tokens (standard)\n- **Async function calling** — Not yet supported; function calling is synchronous only. The model will not start responding until you've sent the tool response.\n- **Proactive audio** — Not yet supported in Gemini 3.1 Flash Live. Remove any configuration for this feature.\n- **Affective dialogue** — Not yet supported in Gemini 3.1 Flash Live. Remove any configuration for this feature.\n- **Code execution** — Not supported\n- **URL context** — Not supported\n\n## Migrating from Gemini 2.5 Flash Live\n\nWhen migrating from `gemini-2.5-flash-native-audio-preview-12-2025` to `gemini-3.1-flash-live-preview`:\n\n1. **Model string** — Update from `gemini-2.5-flash-native-audio-preview-12-2025` to `gemini-3.1-flash-live-preview`.\n2. **Thinking configuration** — Use `thinkingLevel` (`minimal`, `low`, `medium`, `high`) instead of `thinkingBudget`. Default is `minimal` for lowest latency.\n3. **Server events** — A single event can contain multiple content parts simultaneously (audio + transcript). Process **all** parts in each event.\n4. **Client content** — `send_client_content` is only for seeding initial context history (set `initial_history_in_client_content` in `history_config`). Use `send_realtime_input` for text during conversation.\n5. **Turn coverage** — Defaults to `TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO` instead of `TURN_INCLUDES_ONLY_ACTIVITY`. If sending constant video frames, consider sending only during audio activity to reduce costs.\n6. **Async function calling** — Not yet supported. Function calling is synchronous only.\n7. **Proactive audio & affective dialogue** — Not yet supported. Remove any configuration for these features.\n\n## Best Practices\n\n1. **Use headphones** when testing mic audio to prevent echo\u002Fself-interruption\n2. **Enable context window compression** for sessions longer than 15 minutes\n3. **Implement session resumption** to handle connection resets gracefully\n4. **Use ephemeral tokens** for client-side deployments — never expose API keys in browsers\n5. **Use `send_realtime_input`** for all real-time user input (audio, video, text). Reserve `send_client_content` only for seeding initial context history\n6. **Send `audioStreamEnd`** when the mic is paused to flush cached audio\n7. **Clear audio playback queues** on interruption signals\n8. **Process all parts** in each server event — events can contain multiple content parts\n\n## Documentation Lookup\n\n### When MCP is Installed (Preferred)\n\nIf the **`search_docs`** tool (from the Google MCP server) is available, use it as your **only** documentation source:\n\n1. Call `search_docs` with your query\n2. Read the returned documentation\n3. **Trust MCP results** as source of truth for API details — they are always up-to-date.\n\n> [!IMPORTANT]\n> When MCP tools are present, **never** fetch URLs manually. MCP provides up-to-date, indexed documentation that is more accurate and token-efficient than URL fetching.\n\n### When MCP is NOT Installed (Fallback Only)\n\nIf no MCP documentation tools are available, fetch from the official docs index:\n\n**llms.txt URL**: `https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fllms.txt`\n\nThis index contains links to all documentation pages in `.md.txt` format. Use web fetch tools to:\n\n1. Fetch `llms.txt` to discover available documentation pages\n2. Fetch specific pages (e.g., `https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-session.md.txt`)\n\n### Key Documentation Pages \n\n> [!IMPORTANT]\n> Those are not all the documentation pages. Use the `llms.txt` index to discover available documentation pages\n\n- [Live API Overview](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive.md.txt) — getting started, raw WebSocket usage\n- [Live Translate](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-api\u002Flive-translate.md.txt) — configuration options and capabilities for translation\n- [Live API Capabilities Guide](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-guide.md.txt) — voice config, transcription config, native audio (thinking), VAD configuration, media resolution\n- [Live API Tool Use](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-tools.md.txt) — function calling (sync and async), Google Search grounding\n- [Session Management](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Flive-session.md.txt) — context window compression, session resumption, GoAway signals\n- [Ephemeral Tokens](https:\u002F\u002Fai.google.dev\u002Fgemini-api\u002Fdocs\u002Fephemeral-tokens.md.txt) — secure client-side authentication for browser\u002Fmobile\n- [WebSockets API Reference](https:\u002F\u002Fai.google.dev\u002Fapi\u002Flive.md.txt) — raw WebSocket protocol details\n\n## Supported Languages\n\nThe Live API supports 70 languages including: English, Spanish, French, German, Italian, Portuguese, Chinese, Japanese, Korean, Hindi, Arabic, Russian, and many more. Native audio models automatically detect and switch languages.\n",{"name":5,"description":7},"main","e905af21e5f1e1c3ca605e9656c3a7930360a84e","Programming\u002FAI_Engineering_and_Platforms\u002FAgents_and_LLM_Platforms\u002Fgemini-live-api-dev",1,"https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills","https:\u002F\u002Fhamzabellouch.github.io\u002F","https:\u002F\u002Fgithub.com\u002Fhamzabellouch","hamzabellouch.github.io","CEO & Founder of @tknoglobal | Researcher in Technology & Applied Sciences.","2026-10-17 03:20:19",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add hamzabellouch\u002Fagent-skills --skill gemini-live-api-dev",{"tool":40,"command":41},"bunx","bunx skills add hamzabellouch\u002Fagent-skills --skill gemini-live-api-dev",{"tool":43,"command":44},"pnpm","pnpm dlx skills add hamzabellouch\u002Fagent-skills --skill gemini-live-api-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FProgramming\u002FAI_Engineering_and_Platforms\u002FAgents_and_LLM_Platforms\u002Fgemini-live-api-dev\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M79FHH2H815A9TAP6WNKH4Q8","security-audit","Comprehensive security guidance, source code audit, vulnerability assessment, and penetration test review for codebases, APIs, microservices, CLI tools, libraries, and LLM-backed applications. Triggers on requests to audit a codebase, conduct security reviews, find vulnerabilities or flaws, pen-test source code, or when the user asks in Arabic (فحص أمني، تدقيق الكود أمنياً، مراجعة الثغرات، فحص أمان المشروع). Supports Guidance mode (focused review) and Full Audit mode (deterministic 6-phase harness).","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FSecurity_Audit_and_Code_Review\u002Fsecurity-audit\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M79FHBGXVBY6VQ1X7ETAZMF1","malware-analysis-reversing","Production malware analysis workflows, reverse engineering methodologies, isolated sandbox triage, static\u002Fdynamic binary analysis, memory forensics, and YARA detection rule authoring.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FOffensive_Security_and_Pentesting\u002Fmalware-analysis-reversing\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79FH6EACDR801TZCE4R8SAC","application-security-pentesting","Production Application Security (AppSec) standards, OWASP Top 10 vulnerability remediation, SAST\u002FDAST pipeline integration, secure code review, threat modeling, and defensive security posture.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FOffensive_Security_and_Pentesting\u002Fapplication-security-pentesting\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M79FH0VKVT44FK923K520ZQA","oauth2-oidc-security-flows","Implement enterprise OAuth 2.1 and OpenID Connect (OIDC) authorization code flow with Proof Key for Code Exchange (PKCE), state and nonce verification, refresh token rotation, token revocation, and centralized IdP federation (Keycloak, Auth0, Okta). Trigger when building secure authentication, single sign-on (SSO), or third-party delegated authorization.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FIdentity_and_Access_Management_IAM\u002Foauth2-oidc-security-flows\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M79FGVVB3R4T88XXD8FRSV5B","jwt-session-management-hardening","Harden JWT-based authentication and session lifecycles using asymmetric signing (RS256\u002FEdDSA), JWKS rotation, strict claims validation, Redis-backed sliding window sessions, revocation lists, and secure HttpOnly cookie storage. Trigger when implementing token validation, session revocation, or hardening API authentication.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FIdentity_and_Access_Management_IAM\u002Fjwt-session-management-hardening\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M79FGNCPZ85CVEY0B3NE4H3B","soc2-compliance-automation","Best practices for implementing SOC 2 Type II compliance controls, continuous evidence collection, infrastructure policy-as-code, and automated security monitoring. Use when automating Trust Services Criteria (Security, Availability, Confidentiality, Processing Integrity, Privacy), audit logging, IAM least privilege, or CI\u002FCD security gates.","https:\u002F\u002Fgithub.com\u002Fhamzabellouch\u002Fagent-skills\u002Fblob\u002Fmain\u002FSecurity\u002FGovernance_Compliance_and_Legal_Tech\u002Fsoc2-compliance-automation\u002FSKILL.md",[],[]]