This is a comprehensive guide that covers capabilities and configurations available with the Live API. See Get started with Live API page for an overview and sample code for common use cases.
Прежде чем начать
- Familiarize yourself with core concepts: If you haven't already done so, read the Get started with Live API page first. This will introduce you to the fundamental principles of the Live API, how it works, and the different implementation approaches .
- Try the Live API in AI Studio: You may find it useful to try the Live API in Google AI Studio before you start building. To use the Live API in Google AI Studio, select Stream .
Сравнение моделей
The following table summarizes the key differences between the Gemini 3.1 Flash Live Preview and the Gemini 2.5 Flash Live Preview models:
| Особенность | Gemini 3.1 Flash Live Preview | Gemini 2.5 Flash Live Preview |
|---|---|---|
| Мышление | Uses thinkingLevel to control thinking depth with settings like minimal , low , medium , and high . Defaults to minimal to optimize for lowest latency. See Thinking levels and budgets . | Используется thinkingBudget для установки количества жетонов мышления. Динамическое мышление включено по умолчанию. Установите thinkingBudget равным 0 , чтобы отключить его. См. Уровни и бюджеты мышления . |
| Receiving response | A single server event can contain multiple content parts simultaneously (for example, inlineData and transcript). Ensure your code processes all parts in each event to avoid missing content. | Each server event contains only one content part. Parts are delivered in separate events. |
| Client content | send_client_content is only supported for seeding initial context history (requires setting initial_history_in_client_content in session config). To send text updates during the conversation, use send_realtime_input instead. | send_client_content поддерживается на протяжении всего диалога для отправки поэтапных обновлений контента и установления контекста. |
| Покрытие поворота | По умолчанию используется значение TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO . В ход модели включается обнаруженная аудиоактивность и все видеокадры. | Defaults to TURN_INCLUDES_ONLY_ACTIVITY . The model's turn includes only the detected activity. |
Custom VAD ( activity_start / activity_end ) | Supported . Disable automatic VAD and send activityStart and activityEnd messages manually to control turn boundaries. | Supported . Disable automatic VAD and send activityStart and activityEnd messages manually to control turn boundaries. |
| Automatic VAD configuration | Supported . Configure parameters such as start_of_speech_sensitivity , end_of_speech_sensitivity , prefix_padding_ms , and silence_duration_ms . | Поддерживается . Настройте такие параметры, как start_of_speech_sensitivity , end_of_speech_sensitivity , prefix_padding_ms и silence_duration_ms . |
Asynchronous function calling ( behavior: NON_BLOCKING ) | Не поддерживается . Вызов функций осуществляется только последовательно. Модель не начнет отвечать, пока вы не отправите инструменту ответ. | Supported . Set behavior to NON_BLOCKING on a function declaration to let the model continue interacting while the function runs. Control how the model handles responses with the scheduling parameter ( INTERRUPT , WHEN_IDLE , or SILENT ). |
| Proactive audio | Не поддерживается | Поддерживается . При включении этой функции модель может заблаговременно принять решение не отвечать, если входной контент нерелевантен. Установите proactive_audio в true в конфигурации proactivity (требуется v1alpha ). |
| Affective dialogue | Не поддерживается | Supported . The model adapts its response style to match the expression and tone of the input. Set enable_affective_dialog to true in session config (requires v1alpha ). |
Для перехода с Gemini 2.5 Flash Live на Gemini 3.1 Flash Live см. руководство по миграции .
Установление связи
The following example shows how to create a connection with an API key:
Python
import asyncio
from google import genai
client = genai.Client()
model = "gemini-3.1-flash-live-preview"
config = {"response_modalities": ["AUDIO"]}
async def main():
async with client.aio.live.connect(model=model, config=config) as session:
print("Session started")
# Send content...
if __name__ == "__main__":
asyncio.run(main())
JavaScript
import { GoogleGenAI, Modality } from '@google/genai';
const ai = new GoogleGenAI({});
const model = 'gemini-3.1-flash-live-preview';
const config = { responseModalities: [Modality.AUDIO] };
async function main() {
const session = await ai.live.connect({
model: model,
callbacks: {
onopen: function () {
console.debug('Opened');
},
onmessage: function (message) {
console.debug(message);
},
onerror: function (e) {
console.debug('Error:', e.message);
},
onclose: function (e) {
console.debug('Close:', e.reason);
},
},
config: config,
});
console.debug("Session started");
// Send content...
session.close();
}
main();
Interaction modalities
The following sections provide examples and supporting context for the different input and output modalities available in Live API.
Отправка аудио
Audio needs to be sent as raw PCM data (raw 16-bit PCM audio, 16kHz, little-endian).
Python
# Assuming 'chunk' is your raw PCM audio bytes
await session.send_realtime_input(
audio=types.Blob(
data=chunk,
mime_type="audio/pcm;rate=16000"
)
)
JavaScript
// Assuming 'chunk' is a Buffer of raw PCM audio
session.sendRealtimeInput({
audio: {
data: chunk.toString('base64'),
mimeType: 'audio/pcm;rate=16000'
}
});
Аудиоформаты
Audio data in the Live API is always raw, little-endian, 16-bit PCM. Audio output always uses a sample rate of 24kHz. Input audio is natively 16kHz, but the Live API will resample if needed so any sample rate can be sent. To convey the sample rate of input audio, set the MIME type of each audio-containing Blob to a value like audio/pcm;rate=16000 .
Receiving audio
The model's audio responses are received as chunks of data.
Python
async for response in session.receive():
if response.server_content and response.server_content.model_turn:
for part in response.server_content.model_turn.parts:
if part.inline_data:
audio_data = part.inline_data.data
# Process or play the audio data
JavaScript
// Inside the onmessage callback
const content = response.serverContent;
if (content?.modelTurn?.parts) {
for (const part of content.modelTurn.parts) {
if (part.inlineData) {
const audioData = part.inlineData.data;
// Process or play audioData (base64 encoded string)
}
}
}
Отправка текста
Текст можно отправлять с помощью send_realtime_input (Python) или sendRealtimeInput (JavaScript).
Python
await session.send_realtime_input(text="Hello, how are you?")
JavaScript
session.sendRealtimeInput({
text: 'Hello, how are you?'
});
Отправка видео
Видеокадры передаются в виде отдельных изображений (например, JPEG или PNG) с определенной частотой кадров (максимум 1 кадр в секунду).
Python
# Assuming 'frame' is your JPEG-encoded image bytes
await session.send_realtime_input(
video=types.Blob(
data=frame,
mime_type="image/jpeg"
)
)
JavaScript
// Assuming 'frame' is a Buffer of JPEG-encoded image data
session.sendRealtimeInput({
video: {
data: frame.toString('base64'),
mimeType: 'image/jpeg'
}
});
Incremental content updates
Use incremental updates to send text input, establish session context, or restore session context. For short contexts you can send turn-by-turn interactions to represent the exact sequence of events:
Python
turns = [
{"role": "user", "parts": [{"text": "What is the capital of France?"}]},
{"role": "model", "parts": [{"text": "Paris"}]},
]
await session.send_client_content(turns=turns, turn_complete=False)
turns = [{"role": "user", "parts": [{"text": "What is the capital of Germany?"}]}]
await session.send_client_content(turns=turns, turn_complete=True)
JavaScript
let inputTurns = [
{ "role": "user", "parts": [{ "text": "What is the capital of France?" }] },
{ "role": "model", "parts": [{ "text": "Paris" }] },
]
session.sendClientContent({ turns: inputTurns, turnComplete: false })
inputTurns = [{ "role": "user", "parts": [{ "text": "What is the capital of Germany?" }] }]
session.sendClientContent({ turns: inputTurns, turnComplete: true })
For longer contexts it's recommended to provide a single message summary to free up the context window for subsequent interactions. See Session Resumption for another method for loading session context.
Audio transcriptions
Помимо ответа модели, вы также можете получать транскрипции как аудиовыхода, так и аудиовхода.
Для включения транскрипции аудиовыхода модели укажите output_audio_transcription в конфигурации настройки. Язык транскрипции определяется на основе ответа модели.
Python
import asyncio
from google import genai
from google.genai import types
client = genai.Client()
model = "gemini-3.1-flash-live-preview"
config = {
"response_modalities": ["AUDIO"],
"output_audio_transcription": {}
}
async def main():
async with client.aio.live.connect(model=model, config=config) as session:
message = "Hello? Gemini are you there?"
await session.send_client_content(
turns={"role": "user", "parts": [{"text": message}]}, turn_complete=True
)
async for response in session.receive():
if response.server_content.model_turn:
print("Model turn:", response.server_content.model_turn)
if response.server_content.output_transcription:
print("Transcript:", response.server_content.output_transcription.text)
if __name__ == "__main__":
asyncio.run(main())
JavaScript
import { GoogleGenAI, Modality } from '@google/genai';
const ai = new GoogleGenAI({});
const model = 'gemini-3.1-flash-live-preview';
const config = {
responseModalities: [Modality.AUDIO],
outputAudioTranscription: {}
};
async function live() {
const responseQueue = [];
async function waitMessage() {
let done = false;
let message = undefined;
while (!done) {
message = responseQueue.shift();
if (message) {
done = true;
} else {
await new Promise((resolve) => setTimeout(resolve, 100));
}
}
return message;
}
async function handleTurn() {
const turns = [];
let done = false;
while (!done) {
const message = await waitMessage();
turns.push(message);
if (message.serverContent && message.serverContent.turnComplete) {
done = true;
}
}
return turns;
}
const session = await ai.live.connect({
model: model,
callbacks: {
onopen: function () {
console.debug('Opened');
},
onmessage: function (message) {
responseQueue.push(message);
},
onerror: function (e) {
console.debug('Error:', e.message);
},
onclose: function (e) {
console.debug('Close:', e.reason);
},
},
config: config,
});
const inputTurns = 'Hello how are you?';
session.sendClientContent({ turns: inputTurns });
const turns = await handleTurn();
for (const turn of turns) {
if (turn.serverContent && turn.serverContent.outputTranscription) {
console.debug('Received output transcription: %s\n', turn.serverContent.outputTranscription.text);
}
}
session.close();
}
async function main() {
await live().catch((e) => console.error('got error', e));
}
main();
Для включения транскрипции аудиовхода модели укажите параметр input_audio_transcription в конфигурации setup.
Python
import asyncio
from pathlib import Path
from google import genai
from google.genai import types
client = genai.Client()
model = "gemini-3.1-flash-live-preview"
config = {
"response_modalities": ["AUDIO"],
"input_audio_transcription": {},
}
async def main():
async with client.aio.live.connect(model=model, config=config) as session:
audio_data = Path("16000.pcm").read_bytes()
await session.send_realtime_input(
audio=types.Blob(data=audio_data, mime_type='audio/pcm;rate=16000')
)
async for msg in session.receive():
if msg.server_content.input_transcription:
print('Transcript:', msg.server_content.input_transcription.text)
if __name__ == "__main__":
asyncio.run(main())
JavaScript
import { GoogleGenAI, Modality } from '@google/genai';
import * as fs from "node:fs";
import pkg from 'wavefile';
const { WaveFile } = pkg;
const ai = new GoogleGenAI({});
const model = 'gemini-3.1-flash-live-preview';
const config = {
responseModalities: [Modality.AUDIO],
inputAudioTranscription: {}
};
async function live() {
const responseQueue = [];
async function waitMessage() {
let done = false;
let message = undefined;
while (!done) {
message = responseQueue.shift();
if (message) {
done = true;
} else {
await new Promise((resolve) => setTimeout(resolve, 100));
}
}
return message;
}
async function handleTurn() {
const turns = [];
let done = false;
while (!done) {
const message = await waitMessage();
turns.push(message);
if (message.serverContent && message.serverContent.turnComplete) {
done = true;
}
}
return turns;
}
const session = await ai.live.connect({
model: model,
callbacks: {
onopen: function () {
console.debug('Opened');
},
onmessage: function (message) {
responseQueue.push(message);
},
onerror: function (e) {
console.debug('Error:', e.message);
},
onclose: function (e) {
console.debug('Close:', e.reason);
},
},
config: config,
});
// Send Audio Chunk
const fileBuffer = fs.readFileSync("16000.wav");
// Ensure audio conforms to API requirements (16-bit PCM, 16kHz, mono)
const wav = new WaveFile();
wav.fromBuffer(fileBuffer);
wav.toSampleRate(16000);
wav.toBitDepth("16");
const base64Audio = wav.toBase64();
// If already in correct format, you can use this:
// const fileBuffer = fs.readFileSync("sample.pcm");
// const base64Audio = Buffer.from(fileBuffer).toString('base64');
session.sendRealtimeInput(
{
audio: {
data: base64Audio,
mimeType: "audio/pcm;rate=16000"
}
}
);
const turns = await handleTurn();
for (const turn of turns) {
if (turn.text) {
console.debug('Received text: %s\n', turn.text);
}
else if (turn.data) {
console.debug('Received inline data: %s\n', turn.data);
}
else if (turn.serverContent && turn.serverContent.inputTranscription) {
console.debug('Received input transcription: %s\n', turn.serverContent.inputTranscription.text);
}
}
session.close();
}
async function main() {
await live().catch((e) => console.error('got error', e));
}
main();
Change voice and language
Встроенные модели вывода звука поддерживают любые голоса, доступные для наших моделей преобразования текста в речь (TTS) . Вы можете прослушать все голоса в AI Studio .
Чтобы указать голос, задайте имя голоса в объекте speechConfig в рамках конфигурации сессии:
Python
config = {
"response_modalities": ["AUDIO"],
"speech_config": {
"voice_config": {"prebuilt_voice_config": {"voice_name": "Kore"}}
},
}
JavaScript
const config = {
responseModalities: [Modality.AUDIO],
speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: "Kore" } } }
};
API Live поддерживает несколько языков . Встроенные модели вывода звука автоматически выбирают соответствующий язык и не поддерживают явную настройку языкового кода.
Native audio capabilities
Наши новейшие модели оснащены встроенным аудиовыходом , обеспечивающим естественное, реалистичное звучание речи и улучшенную многоязычную производительность.
Мышление
Gemini 3.1 models use thinkingLevel to control thinking depth, with settings like minimal , low , medium , and high . The default is minimal to optimize for lowest latency. Gemini 2.5 models use thinkingBudget to set the number of thinking tokens instead. For more details on levels vs budgets, see Thinking levels and budgets .
Python
model = "gemini-3.1-flash-live-preview"
config = types.LiveConnectConfig(
response_modalities=["AUDIO"]
thinking_config=types.ThinkingConfig(
thinking_level="low",
)
)
async with client.aio.live.connect(model=model, config=config) as session:
# Send audio input and receive audio
JavaScript
const model = 'gemini-3.1-flash-live-preview';
const config = {
responseModalities: [Modality.AUDIO],
thinkingConfig: {
thinkingLevel: 'low',
},
};
async function main() {
const session = await ai.live.connect({
model: model,
config: config,
callbacks: ...,
});
// Send audio input and receive audio
session.close();
}
main();
Кроме того, вы можете включить отображение кратких обзоров мыслей, установив includeThoughts в true в вашем конфигурационном файле. Дополнительную информацию см. в разделе «Краткие обзоры мыслей» :
Python
model = "gemini-3.1-flash-live-preview"
config = types.LiveConnectConfig(
response_modalities=["AUDIO"]
thinking_config=types.ThinkingConfig(
thinking_level="low",
include_thoughts=True
)
)
JavaScript
const model = 'gemini-3.1-flash-live-preview';
const config = {
responseModalities: [Modality.AUDIO],
thinkingConfig: {
thinkingLevel: 'low',
includeThoughts: true,
},
};
Эмоциональный диалог
Эта функция позволяет Gemini адаптировать свой стиль отклика к входному сигналу, его выразительности и тембру.
Для использования диалогового окна с эффектом аффективности установите версию API на v1alpha и параметр enable_affective_dialog в true в сообщении настройки:
Python
client = genai.Client(http_options={"api_version": "v1alpha"})
config = types.LiveConnectConfig(
response_modalities=["AUDIO"],
enable_affective_dialog=True
)
JavaScript
const ai = new GoogleGenAI({ httpOptions: {"apiVersion": "v1alpha"} });
const config = {
responseModalities: [Modality.AUDIO],
enableAffectiveDialog: true
};
Proactive audio
При включении этой функции Gemini может заблаговременно принять решение не отвечать, если контент неактуален.
Для использования установите версию API на v1alpha , настройте поле proactivity в сообщении настройки и установите proactive_audio в true :
Python
client = genai.Client(http_options={"api_version": "v1alpha"})
config = types.LiveConnectConfig(
response_modalities=["AUDIO"],
proactivity={'proactive_audio': True}
)
JavaScript
const ai = new GoogleGenAI({ httpOptions: {"apiVersion": "v1alpha"} });
const config = {
responseModalities: [Modality.AUDIO],
proactivity: { proactiveAudio: true }
}
Voice Activity Detection (VAD)
Voice Activity Detection (VAD) allows the model to recognize when a person is speaking. This is essential for creating natural conversations, as it allows a user to interrupt the model at any time.
When VAD detects an interruption, the ongoing generation is canceled and discarded. Only the information already sent to the client is retained in the session history. The server then sends a BidiGenerateContentServerContent message to report the interruption.
Затем сервер Gemini отбрасывает все ожидающие вызовы функций и отправляет сообщение BidiGenerateContentServerContent с идентификаторами отмененных вызовов.
Python
async for response in session.receive():
if response.server_content.interrupted is True:
# The generation was interrupted
# If realtime playback is implemented in your application,
# you should stop playing audio and clear queued playback here.
JavaScript
const turns = await handleTurn();
for (const turn of turns) {
if (turn.serverContent && turn.serverContent.interrupted) {
// The generation was interrupted
// If realtime playback is implemented in your application,
// you should stop playing audio and clear queued playback here.
}
}
Automatic VAD
By default, the model automatically performs VAD on a continuous audio input stream. VAD can be configured with the realtimeInputConfig.automaticActivityDetection field of the setup configuration .
When the audio stream is paused for more than a second (for example, because the user switched off the microphone), an audioStreamEnd event should be sent to flush any cached audio. The client can resume sending audio data at any time.
Python
# example audio file to try:
# URL = "https://storage.googleapis.com/generativeai-downloads/data/hello_are_you_there.pcm"
# !wget -q $URL -O sample.pcm
import asyncio
from pathlib import Path
from google import genai
from google.genai import types
client = genai.Client()
model = "gemini-3.1-flash-live-preview"
config = {"response_modalities": ["AUDIO"]}
async def main():
async with client.aio.live.connect(model=model, config=config) as session:
audio_bytes = Path("sample.pcm").read_bytes()
await session.send_realtime_input(
audio=types.Blob(data=audio_bytes, mime_type="audio/pcm;rate=16000")
)
# if stream gets paused, send:
# await session.send_realtime_input(audio_stream_end=True)
async for response in session.receive():
if response.text is not None:
print(response.text)
if __name__ == "__main__":
asyncio.run(main())
JavaScript
// example audio file to try:
// URL = "https://storage.googleapis.com/generativeai-downloads/data/hello_are_you_there.pcm"
// !wget -q $URL -O sample.pcm
import { GoogleGenAI, Modality } from '@google/genai';
import * as fs from "node:fs";
const ai = new GoogleGenAI({});
const model = 'gemini-3.1-flash-live-preview';
const config = { responseModalities: [Modality.AUDIO] };
async function live() {
const responseQueue = [];
async function waitMessage() {
let done = false;
let message = undefined;
while (!done) {
message = responseQueue.shift();
if (message) {
done = true;
} else {
await new Promise((resolve) => setTimeout(resolve, 100));
}
}
return message;
}
async function handleTurn() {
const turns = [];
let done = false;
while (!done) {
const message = await waitMessage();
turns.push(message);
if (message.serverContent && message.serverContent.turnComplete) {
done = true;
}
}
return turns;
}
const session = await ai.live.connect({
model: model,
callbacks: {
onopen: function () {
console.debug('Opened');
},
onmessage: function (message) {
responseQueue.push(message);
},
onerror: function (e) {
console.debug('Error:', e.message);
},
onclose: function (e) {
console.debug('Close:', e.reason);
},
},
config: config,
});
// Send Audio Chunk
const fileBuffer = fs.readFileSync("sample.pcm");
const base64Audio = Buffer.from(fileBuffer).toString('base64');
session.sendRealtimeInput(
{
audio: {
data: base64Audio,
mimeType: "audio/pcm;rate=16000"
}
}
);
// if stream gets paused, send:
// session.sendRealtimeInput({ audioStreamEnd: true })
const turns = await handleTurn();
for (const turn of turns) {
if (turn.text) {
console.debug('Received text: %s\n', turn.text);
}
else if (turn.data) {
console.debug('Received inline data: %s\n', turn.data);
}
}
session.close();
}
async function main() {
await live().catch((e) => console.error('got error', e));
}
main();
With send_realtime_input , the API will respond to audio automatically based on VAD. While send_client_content adds messages to the model context in order, send_realtime_input is optimized for responsiveness at the expense of deterministic ordering.
Automatic VAD configuration
Для более полного контроля над работой VAD можно настроить следующие параметры. Дополнительную информацию см. в справочнике API .
Python
from google.genai import types
config = {
"response_modalities": ["AUDIO"],
"realtime_input_config": {
"automatic_activity_detection": {
"disabled": False, # default
"start_of_speech_sensitivity": types.StartSensitivity.START_SENSITIVITY_LOW,
"end_of_speech_sensitivity": types.EndSensitivity.END_SENSITIVITY_LOW,
"prefix_padding_ms": 20,
"silence_duration_ms": 100,
}
}
}
JavaScript
import { GoogleGenAI, Modality, StartSensitivity, EndSensitivity } from '@google/genai';
const config = {
responseModalities: [Modality.AUDIO],
realtimeInputConfig: {
automaticActivityDetection: {
disabled: false, // default
startOfSpeechSensitivity: StartSensitivity.START_SENSITIVITY_LOW,
endOfSpeechSensitivity: EndSensitivity.END_SENSITIVITY_LOW,
prefixPaddingMs: 20,
silenceDurationMs: 100,
}
}
};
Disable automatic VAD
Alternatively, the automatic VAD can be disabled by setting realtimeInputConfig.automaticActivityDetection.disabled to true in the setup message. In this configuration the client is responsible for detecting user speech and sending activityStart and activityEnd messages at the appropriate times. An audioStreamEnd isn't sent in this configuration. Instead, any interruption of the stream is marked by an activityEnd message.
Python
config = {
"response_modalities": ["AUDIO"],
"realtime_input_config": {"automatic_activity_detection": {"disabled": True}},
}
async with client.aio.live.connect(model=model, config=config) as session:
# ...
await session.send_realtime_input(activity_start=types.ActivityStart())
await session.send_realtime_input(
audio=types.Blob(data=audio_bytes, mime_type="audio/pcm;rate=16000")
)
await session.send_realtime_input(activity_end=types.ActivityEnd())
# ...
JavaScript
const config = {
responseModalities: [Modality.AUDIO],
realtimeInputConfig: {
automaticActivityDetection: {
disabled: true,
}
}
};
session.sendRealtimeInput({ activityStart: {} })
session.sendRealtimeInput(
{
audio: {
data: base64Audio,
mimeType: "audio/pcm;rate=16000"
}
}
);
session.sendRealtimeInput({ activityEnd: {} })
Количество токенов
Общее количество потреблённых токенов можно найти в поле usageMetadata в ответном сообщении сервера.
Python
async for message in session.receive():
# The server will periodically send messages that include UsageMetadata.
if message.usage_metadata:
usage = message.usage_metadata
print(
f"Used {usage.total_token_count} tokens in total. Response token breakdown:"
)
for detail in usage.response_tokens_details:
match detail:
case types.ModalityTokenCount(modality=modality, token_count=count):
print(f"{modality}: {count}")
JavaScript
const turns = await handleTurn();
for (const turn of turns) {
if (turn.usageMetadata) {
console.debug('Used %s tokens in total. Response token breakdown:\n', turn.usageMetadata.totalTokenCount);
for (const detail of turn.usageMetadata.responseTokensDetails) {
console.debug('%s\n', detail);
}
}
}
Разрешение СМИ
Разрешение входного медиафайла можно указать, задав поле mediaResolution в конфигурации сессии:
Python
from google.genai import types
config = {
"response_modalities": ["AUDIO"],
"media_resolution": types.MediaResolution.MEDIA_RESOLUTION_LOW,
}
JavaScript
import { GoogleGenAI, Modality, MediaResolution } from '@google/genai';
const config = {
responseModalities: [Modality.AUDIO],
mediaResolution: MediaResolution.MEDIA_RESOLUTION_LOW,
};
Ограничения
При планировании проекта учитывайте следующие ограничения Live API.
Response modalities
Встроенные аудиомодели поддерживают только режим аудиоответа. Если вам нужен ответ модели в текстовом формате, используйте функцию транскрипции выходного аудиофайла .
Client authentication
The Live API only provides server-to-server authentication by default. If you're implementing your Live API application using a client-to-server approach , you need to use ephemeral tokens to mitigate security risks.
Продолжительность сессии
Audio-only sessions are limited to 15 minutes, and audio plus video sessions are limited to 2 minutes. However, you can configure different session management techniques for unlimited extensions on session duration.
Контекстное окно
A session has a context window limit of:
- 128k tokens for native audio output models
- 32k tokens for other Live API models
Поддерживаемые языки
Live API supports the following 97 languages.
| Язык | BCP-47 Code | Язык | BCP-47 Code |
|---|---|---|---|
| африкаанс | af | латышский | lv |
| Акан | ak | литовский | lt |
| албанский | sq | македонский | mk |
| амхарский | am | малайский | ms |
| арабский | ar | Малаялам | ml |
| армянский | hy | мальтийский | mt |
| ассамский | as | маори | mi |
| азербайджанский | az | маратхи | mr |
| Баскский | eu | монгольский | mn |
| белорусский | be | непальский | ne |
| бенгальский | bn | норвежский | no |
| боснийский | bs | Одиа | or |
| болгарский | bg | Оромо | om |
| бирманский | my | пушту | ps |
| каталанский | ca | персидский | fa |
| Себуано | ceb | польский | pl |
| китайский | zh | португальский | pt |
| хорватский | hr | Пенджаби | pa |
| чешский | cs | кечуа | qu |
| датский | da | румынский | ro |
| Голландский | nl | романшский | rm |
| Английский | en | Русский | ru |
| эстонский | et | сербский | sr |
| Фарерский | fo | Синдхи | sd |
| филиппинский | fil | сингальский | si |
| финский | fi | словацкий | sk |
| Французский | fr | словенский | sl |
| галисийский | gl | сомалийский | so |
| грузинский | ka | Южный Сото | st |
| немецкий | de | испанский | es |
| греческий | el | суахили | sw |
| гуджарати | gu | шведский | sv |
| Хауса | ha | Таджик | tg |
| иврит | iw | тамильский | ta |
| хинди | hi | телугу | te |
| венгерский | hu | Тайский | th |
| исландский | is | Тсвана | tn |
| индонезийский | id | турецкий | tr |
| Ирландский | ga | туркменский | tk |
| итальянского | it | украинский | uk |
| японский | ja | урду | ur |
| Каннада | kn | узбекский | uz |
| казахский | kk | вьетнамский | vi |
| кхмерский | km | валлийский | cy |
| Киньяруанда | rw | Западно-фризский | fy |
| корейский | ko | Вольф | wo |
| курдский | ku | Йоруба | yo |
| кыргызы | ky | зулу | zu |
| Лао | lo |
Что дальше?
- Ознакомьтесь с руководствами по использованию инструментов и управлению сессиями, чтобы получить важную информацию об эффективном использовании Live API.
- Try the Live API in Google AI Studio .
- Для получения дополнительной информации о моделях Live API см. раздел Gemini 2.5 Flash Native Audio на странице «Модели».
- Больше примеров можно найти в руководствах Live API , Live API Tools и скрипте Live API Get Started .