Skip to content

Gemini 3.1 Flash Live Preview

gemini/gemini-3.1-flash-live-preview

Gemini 3.1 Flash Live, a March 2026 Live API preview for real-time audio-to-audio conversation with thinking, Search grounding and function calling. Legacy since Gemini 3.8 Live reached GA in September 2026; shutdown is set for November 17, 2026.

API
import WebSocket from "ws";
import { randomUUID } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";

// Mono PCM16 at 16 kHz, paced like microphone input.
const input = await readFile("recording.pcm");
const url = new URL("/v1/audio/conversations/stream", process.env.AUDIOLAB_API_URL);
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
const socket = new WebSocket(url, {
  headers: { Authorization: `Bearer ${process.env.AUDIOLAB_API_KEY}`, "Idempotency-Key": randomUUID() },
});
let timer, offset = 0, chunk = 0;
const output = [];
socket.on("open", () => socket.send(JSON.stringify({
  type: "session.start", model: "gemini/gemini-3.1-flash-live-preview", voice: "auto", max_seconds: 30,
})));
socket.on("message", raw => {
  const event = JSON.parse(raw.toString());
  if (event.type === "session.ready") timer = setInterval(() => {
    const frame = Buffer.alloc(640);
    if (offset < input.length) input.copy(frame, 0, offset, Math.min(offset + 640, input.length));
    offset += 640;
    if (socket.readyState === WebSocket.OPEN) socket.send(frame);
  }, 20);
  if (event.type === "output_audio.delta") {
    output.push(Buffer.from(event.delta, "base64"));
  }
  if (event.type === "output_audio.done") { clearInterval(timer); socket.send(JSON.stringify({ type: "session.finish" })); }
  if (event.type === "session.completed" || event.type === "error") console.log(event);
});
socket.on("close", () => {
  clearInterval(timer);
  void writeFile("response.pcm", Buffer.concat(output)).catch(console.error); // 24 kHz PCM16.
});
socket.on("error", console.error);
Input Price
$2.55 / 1M tokens
Output Price
$10.20 / 1M tokens
Input
Audio
Output
Audio

Capabilities

Explore what Gemini 3.1 Flash Live Preview supports, then use the API section for a request tailored to this model.

StreamRealtimeDuplexAudio inputAudio outputToolsPreview

Languages

Multilingual

Model Information

Product
Conversational
Release Date
Mar 26, 2026
Data Policy
Configurable
Region
Global
Input
Audio
Output
Audio
Provider Documentation

Playground

Try Gemini 3.1 Flash Live Preview by Google Gemini. Requests use the selected workspace’s credits and API pricing.

Gemini 3.1 Flash Live PreviewCredits —
Gemini 3.1 Flash Live Preview
This model uses a dedicated input format. Explore its API example or open the supported playground.

Providers

Compare available endpoints, pricing, and context limits for Gemini 3.1 Flash Live Preview.

ProviderContextOutputInput PriceOutput PriceEndpoint
Google GeminiNot specifiedAudio$2.55 / 1M tokens$10.20 / 1M tokens
gemini/gemini-3.1-flash-live-preview:gemini

Prices are catalog rates. Your workspace’s estimate and endpoint pricing determine the final charge.

Input and Output Limits

Formats and limits AudioLab enforces on each request.

LimitValue
Max seconds300
Input sample rate16000
Output formatpcm16

Provider Notes

Continuous voice conversations with native turn detection, interruptions and transcript events. Up to five minutes per funded session. Use /v1/audio/conversations/stream.

Status

Current catalog availability. Your workspace’s access is checked separately before a request runs.

Getting Started

Use your workspace API key and the exact model identifier below. Set the API URL to the endpoint shown in your workspace and keep credentials on your server.

API
import WebSocket from "ws";
import { randomUUID } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";

// Mono PCM16 at 16 kHz, paced like microphone input.
const input = await readFile("recording.pcm");
const url = new URL("/v1/audio/conversations/stream", process.env.AUDIOLAB_API_URL);
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
const socket = new WebSocket(url, {
  headers: { Authorization: `Bearer ${process.env.AUDIOLAB_API_KEY}`, "Idempotency-Key": randomUUID() },
});
let timer, offset = 0, chunk = 0;
const output = [];
socket.on("open", () => socket.send(JSON.stringify({
  type: "session.start", model: "gemini/gemini-3.1-flash-live-preview", voice: "auto", max_seconds: 30,
})));
socket.on("message", raw => {
  const event = JSON.parse(raw.toString());
  if (event.type === "session.ready") timer = setInterval(() => {
    const frame = Buffer.alloc(640);
    if (offset < input.length) input.copy(frame, 0, offset, Math.min(offset + 640, input.length));
    offset += 640;
    if (socket.readyState === WebSocket.OPEN) socket.send(frame);
  }, 20);
  if (event.type === "output_audio.delta") {
    output.push(Buffer.from(event.delta, "base64"));
  }
  if (event.type === "output_audio.done") { clearInterval(timer); socket.send(JSON.stringify({ type: "session.finish" })); }
  if (event.type === "session.completed" || event.type === "error") console.log(event);
});
socket.on("close", () => {
  clearInterval(timer);
  void writeFile("response.pcm", Buffer.concat(output)).catch(console.error); // 24 kHz PCM16.
});
socket.on("error", console.error);
Read the Endpoint Reference

Request Parameters

Available parameters depend on the provider and request format. The endpoint reference explains accepted values and required fields.

ParameterDetails
modelgemini/gemini-3.1-flash-live-preview — Required model identifier.
voiceView Accepted Values
instructionsView Accepted Values
max_secondsView Accepted Values
input_audioView Accepted Values

Input and Output Limits

Formats and limits AudioLab enforces on each request.

LimitValue
Max seconds300
Input sample rate16000
Output formatpcm16

Similar Models

Explore more conversational and compare their capabilities.

ModelContextInput PriceOutput Price
Gemini 3.5 Live TranslateGoogle GeminiNot specified$2.975 / 1M tokens$17.85 / 1M tokens
Gemini 2.5 Flash Native Audio (12-2025)Google GeminiNot specified$2.55 / 1M tokens$10.20 / 1M tokens
Grok Voice LatestxAINot specified$0.0425 / minute—
GPT Realtime 2.1OpenAINot specified$27.20 / 1M tokens$54.40 / 1M tokens
GPT Realtime 2.1 MiniOpenAINot specified$8.50 / 1M tokens$17.00 / 1M tokens
GPT Realtime 2OpenAINot specified$27.20 / 1M tokens$54.40 / 1M tokens
View All Conversational