Gemini Live API enables low-latency, real-time voice and vision interactions with Gemini. It processes continuous streams of audio, images, and text to deliver immediate, human-like spoken responses over a stateful, bidirectional WebSocket connection — a very different model from a one-shot generateContent call.

In this codelab you'll wire Gemini Live API into a Flutter app through Firebase AI Logic and the firebase_ai package — the official Firebase AI Logic plugin for Flutter, built and maintained by the Flutter team with community contributions. Rather than hand-writing every line, you'll also see how to brief an AI coding agent to generate the feature for you, then review and harden what it produces.

This codelab walks through ten steps, from an empty Flutter project to a reviewed, working Live Mode feature:

Run the following in your terminal to initialize a fresh Flutter project template:

flutter create my_app

This generates the full directory structure, standard iOS/Android runner projects, and essential configuration files for your app.

---

  1. Navigate to console.firebase.google.com in your web browser.
  2. Click Add project to create a new Firebase project.
  3. Follow the on-screen prompts to set up project details and, optionally, enable Google Analytics.

    ---

  1. Install the Firebase CLI. Visit the Firebase CLI docs, select your OS, and follow the install instructions.
  2. Activate the FlutterFire CLI globally, so you can configure Firebase across your Flutter projects:
    dart pub global activate flutterfire_cli
  3. Log in to Firebase, using the Google account that hosts your Firebase project:
    firebase login

    ---

  1. In the Firebase Console, go to Project Overview.
  2. Click the Add App button to add a new app, then select the Flutter logo.
  3. The console shows clear instructions to configure the Firebase CLI — since you already installed and activated it in Step 3, you can proceed directly.

    ---

Open lib/main.dart and add the following code inside main(), before runApp:

await Firebase.initializeApp(
    options: DefaultFirebaseOptions.currentPlatform,
);

---

  1. In the Firebase Console, open your project.
  2. In the left panel, look for AI Services.
  3. Select AI Logic, choose your preferred API (Gemini Developer API or Agent Platform Gemini API), and enable it.

    Ref: console.firebase.google.com

    ---

For local development, you can temporarily unenforce App Check so your API calls aren't blocked while you're still wiring things up:

  1. In the Firebase Console, go to Security → App Check.
  2. Select the APIs tab, then choose Firebase AI Logic.
  3. Click Show Details → Setup, then choose Unenforce.
  4. Select App tab, select the Web app, click Register
  5. Select 3 vertical dots button on the Web App, select Manage Debug Token
  6. Enter a fixed UUID token here, then save

    ---

Act as a senior Flutter developer with expertise in both Flutter and Firebase integration. Your task is to add a new Live Mode screen into this project, which allows user to talk freely to Gemini. Use package flutter_chat_ui to create the simple chat UI. Use package firebase_ai as the main AI package, select GoogleAI as our main AI option, and use LiveGenerativeModel to handle the chat. The model should be 'gemini-3.8-live'. Use package 'record' for audio recording, package flutter_soloud for PCM audio output streaming. The UI should have a mic icon for user to mute mic as they wish, however mic is enable by default. The chat UI components to display messages from user and model, which are from inputTranscription and outputTranscription respectively. No TextField input needed. When the app launches, create a new LiveSession to start the chat. When LiveSession is connected successfully, send a TextContent to AI model to ask it to greet the user. AppCheck is compulsory, use package firebase_app_check to activate AppCheck for this project. Debug token is <input your Debug token here>

Swap GoogleAI for agentPlatform in the prompt if you enabled the Agent Platform Gemini API instead, in Step 6.

To generate your debug token, open Firebase Console => Security => App Check, select tab Apps, select your targeted app, click on vertical 3 dots button, select Manage Debug Token, and generate your token there.

---

Before you run what the agent generated, verify the key configurations, API mappings, and package selections it chose:

  1. Model name — check the docs for the correct model name; at the time of writing, gemini-3.8-live is suggested.
  2. AI Logic API selection:
    • Gemini Developer API → use FirebaseAI.googleAI()
    • Agent Platform Gemini API → use FirebaseAI.agentPlatform()
  3. Audio input — to enable audio-to-audio chat, add voice input and voice output functionality and handle the audio streaming from server. Suggest to use record package for audio input.
  4. Audio output — consider using flutter_soloud for streaming audio output.
  5. Output modality — must always be set to audio.
  6. Text output — include the output transcript in your config to receive text output alongside audio.
  7. Sending content — always send with turnComplete: true.
  8. App Check token - Set debugToken using the previous UUID Token
  9. Stereo vs. mono detection — don't infer channel count from the platform (e.g. Platform.isIOS / Platform.isAndroid); read it from the actual recorder/stream config (e.g. the RecordConfig's numChannels, or the input device's reported channel count) so the code stays correct even when a device or package default changes.

    ---

A quick troubleshooting checklist for the issues most teams hit first when wiring up Live API:

  1. Wrong FirebaseAI API — make sure you're calling the API that's actually enabled in your Firebase project (see Step 9).
  2. No text content output - Use text from outputTranscription, remember to set outputAudioTranscription in LiveGenerationConfig when initialise liveGenerativeModel.
  3. Retrieve input transcript - When voice chat with model, you can request input transcipt by setting inputAudioTranscription in LiveGenerationConfig when initialise liveGenerativeModel.
  4. Output modality - Audio output only, but it's up to you to use the audio or only use the text from outputTranscript
  5. Voice echo (model replies to itself) — set your audio source and audio manager mode to communication mode.
  6. Background noise — set the noise suppression config with noiseSuppress: true and autoGain: true.
  7. Language selection — set your preferred language on connect, in BCP-47 format (e.g. vi-VN, ja-JP, en-US).
  8. Voice selection — choose a voice from the Gemini Live API docs and update the voice name in SpeechConfig.

    ---

You've now walked through the full path from an empty Flutter project to a working Live Mode screen powered by Gemini Live API via Firebase AI Logic: setting up Firebase, wiring in firebase_ai, briefing an AI coding agent with a focused prompt, and reviewing its output against a concrete checklist before shipping.

From here, try extending the Live Mode screen with video input, or tune the SpeechConfig and noise-suppression settings for your target environment and language.