[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F6S9BVCABPX0F15S3DTXEB":3,"skill-same:01M6F6S9BVCABPX0F15S3DTXEB":83},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":30,"publishedAt":54,"linkOnly":55,"markdownContent":56,"markdownBody":57,"frontMatter":58,"refName":46,"commitSha":63,"skillDirectory":64,"forksCount":65,"repositoryHtmlUrl":66,"repositoryHomepageUrl":6,"ownerHtmlUrl":67,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":68,"install":69,"resources":82},"01M6F6S9BVCABPX0F15S3DTXEB","gemini-live-api-dev",null,"Use this skill when building real-time, bidirectional streaming applications with the Gemini Live API.","boisenoise\u002Fskills-collections","boisenoise","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F193180?v=4","01M6CDBDQK6BDN55ZMA6B6PKBM","01M6CDBDVSJ3JPTBYN26FZ7TZK",12,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-gemini-live-api-dev\u002FSKILL.md",[17,22,25],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],"gemini","gemini live api","dev","gemini live api dev","api","live","api dev","2026","google","when","tree","with","critical","time","wed","main","use","applications","real-time","streaming","license","official","github","2026-11-10 10:12:30",false,"---\nname: gemini-live-api-dev\ndescription: \"Use this skill when building real-time, bidirectional streaming applications with the Gemini Live API.\"\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-skills\u002Ftree\u002Fmain\u002Fskills\u002Fgemini-live-api-dev\nsource_repo: google-gemini\u002Fgemini-skills\nsource_type: official\ndate_added: 2026-07-01\nlicense: Apache-2.0\nlicense_source: https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-skills\u002Fblob\u002Fmain\u002FLICENSE\n---\n\n# Gemini Live API Development Skill\n## When to Use\n\nUse 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,...\n\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## Application boundaries\n\nExamples are independent fragments, not a microphone\u002Fplayback application. Define chunks, bounded input\u002Foutput queues, sample conversion, cancellation and session cleanup; close the JavaScript session and Python client when finished. Confirm model availability and supported options in current model-specific docs rather than relying on universal capability claims. Obtain consent for microphone\u002Fcamera streaming, minimize transcript logging, and never send API keys to browsers. Tool-call arguments are untrusted: validate and authorize each server-side action, including retries and cancelled calls.\n\n## Quick Start\n\n### Authentication\n\n#### Python\n\n```python\nimport os\nfrom google import genai\n\nclient = genai.Client(api_key=os.environ[\"GEMINI_API_KEY\"])\n```\n\n#### JavaScript\n\n```js\nimport { GoogleGenAI } from '@google\u002Fgenai';\n\n\u002F\u002F Node\u002Fserver only; browsers must receive short-lived ephemeral tokens.\nconst ai = new GoogleGenAI({ apiKey: process.env.GEMINI_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) => { \u002F* Process parts using the receive example below. *\u002F },\n    onerror: () => console.error('Live connection 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, prefer it as a documentation lookup source:\n\n1. Call `search_docs` with your query\n2. Read the returned documentation\n3. Verify the source URL, model and SDK version of returned documentation; indexed MCP results can be stale. Cross-check current official documentation when a result is missing or contradictory.\n\n> [!IMPORTANT]\n> Use official documentation URLs as a fallback or cross-check when tool results do not establish current behavior.\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## When to Use\n\nUse 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,...\n\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## Application boundaries\n\nExamples are independent fragments, not a microphone\u002Fplayback application. Define chunks, bounded input\u002Foutput queues, sample conversion, cancellation and session cleanup; close the JavaScript session and Python client when finished. Confirm model availability and supported options in current model-specific docs rather than relying on universal capability claims. Obtain consent for microphone\u002Fcamera streaming, minimize transcript logging, and never send API keys to browsers. Tool-call arguments are untrusted: validate and authorize each server-side action, including retries and cancelled calls.\n\n## Quick Start\n\n### Authentication\n\n#### Python\n\n```python\nimport os\nfrom google import genai\n\nclient = genai.Client(api_key=os.environ[\"GEMINI_API_KEY\"])\n```\n\n#### JavaScript\n\n```js\nimport { GoogleGenAI } from '@google\u002Fgenai';\n\n\u002F\u002F Node\u002Fserver only; browsers must receive short-lived ephemeral tokens.\nconst ai = new GoogleGenAI({ apiKey: process.env.GEMINI_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) => { \u002F* Process parts using the receive example below. *\u002F },\n    onerror: () => console.error('Live connection 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, prefer it as a documentation lookup source:\n\n1. Call `search_docs` with your query\n2. Read the returned documentation\n3. Verify the source URL, model and SDK version of returned documentation; indexed MCP results can be stale. Cross-check current official documentation when a result is missing or contradictory.\n\n> [!IMPORTANT]\n> Use official documentation URLs as a fallback or cross-check when tool results do not establish current behavior.\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,"risk":43,"source":59,"license":14,"date_added":60,"description":7,"source_repo":61,"source_type":52,"license_source":62},"https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-skills\u002Ftree\u002Fmain\u002Fskills\u002Fgemini-live-api-dev",1782864000000,"google-gemini\u002Fgemini-skills","https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-skills\u002Fblob\u002Fmain\u002FLICENSE","7bf2279c8a65758319526a721d5c4b75683aec9c","skills\u002Fantigravity-gemini-live-api-dev",3,"https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections","https:\u002F\u002Fgithub.com\u002Fboisenoise","2026-11-10 14:20:15",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add boisenoise\u002Fskills-collections --skill gemini-live-api-dev",{"tool":75,"command":76},"bunx","bunx skills add boisenoise\u002Fskills-collections --skill gemini-live-api-dev",{"tool":78,"command":79},"pnpm","pnpm dlx skills add boisenoise\u002Fskills-collections --skill gemini-live-api-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-gemini-live-api-dev\u002FSKILL.md",true,[],[84,109,129,153,172,195],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":88,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":54},"01M6WNH92BHVFXHGPDZCPJ0AG0","web-access","Use Treg for public web or platform data only when existing search, browser and connected tools cannot cover the task, with explicit cost and data boundaries.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-web-access\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-web-access\u002FSKILL.md",[],[92,93,94,52,95,96,97,98,99,100,101,102,103,104,105,43,106,107,108,40,38],"web","access","web access","development","browser","search","data","Tools","read","fetch","only","youtube","free tools","platform","free","cover","normal",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":117,"publishedAt":54},"01M6WNF9XAYAB2CZDDJBAKNM93","treg","Use the Treg CLI or MCP catalog to discover, price and call authorized external tools with team-scoped credentials and a user-approved budget.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-treg\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-treg\u002FSKILL.md",[116],{"categoryNo":23,"categoryName":24,"taxonomyType":20,"taxonomyTypeDesc":21},[111,118,119,53,52,95,51,99,120,121,122,123,47,124,125,43,126,42,127,128,38],"MCP","cli","Budget","credentials","team","catalog","call","discover","external tools","scoped","blob",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":133,"sourceHtmlUrl":134,"categories":135,"keywords":139,"publishedAt":54},"01M6WN93MEAZ4E41DYAHJRPHQT","recruit","Turn a job description into an evidence-linked candidate shortlist through Treg, with job-related ranking and optional authorized business contact enrichment.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-recruit\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-recruit\u002FSKILL.md",[136],{"categoryNo":137,"categoryName":138,"taxonomyType":28,"taxonomyTypeDesc":29},"01JBSEEDCAT000000000000038","人力资源",[131,53,52,51,140,141,142,143,144,145,43,146,147,148,42,149,150,151,152,128,111,38],"https","email","enrichment","business","evidence","phone","ranking","post","job description","for","person","candidate","reason",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":157,"sourceHtmlUrl":158,"categories":159,"keywords":160,"publishedAt":54},"01M6WN8R5RXSMHM9B4D9FAFX42","rea-growth","Analyze a company’s public growth and content through Treg, distinguish observations from hypotheses, and produce an evidence-linked playbook within an approved budget.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-rea-growth\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-rea-growth\u002FSKILL.md",[],[161,162,163,53,52,51,164,165,140,166,120,167,168,169,144,43,170,171,128,111,38],"growth","rea","rea growth","produce","content","playbook","marketing","analyze","public","observations","company",{"skillNo":173,"name":174,"nameZh":6,"description":175,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":176,"sourceHtmlUrl":177,"categories":178,"keywords":179,"publishedAt":54},"01M6WN2EVE3RQRGWAKBT4S7YT2","make-ugc","Create original AI UGC-style product videos through Treg: research hooks, approve a licensed presenter and voice, generate clips, add captions and report costs.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-make-ugc\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-make-ugc\u002FSKILL.md",[],[180,181,53,182,52,183,51,184,185,186,187,188,43,189,190,191,192,193,194,128],"make","make ugc","research","create","Video","Captions","ads","short","hooks","head","style","niche","trending","talking-head","approve",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":199,"sourceHtmlUrl":200,"categories":201,"keywords":202,"publishedAt":54},"01M6WN10ARAA63Y8K1YNGXJ2RM","lead-signals","Find and qualify public buying signals through Treg, rank fitting business accounts and optionally enrich authorized business contact information.","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-lead-signals\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fboisenoise\u002Fskills-collections\u002Fblob\u002Fmain\u002Fskills\u002Fantigravity-lead-signals\u002FSKILL.md",[],[203,204,205,53,52,51,206,207,143,208,209,43,210,211,212,213,214,215,216,128],"signals","lead","lead signals","how","find","ready","as","how to","qualify","people","information","enrich","changes","funding"]