Publishing
Your Firebase AI voice feature stops working when the preview speech model shuts down on November 17
Cataloged November 16, 2026 · Firebase
Symptom
The rest of the app still loads. The voice feature stops when the preview speech model shuts down. The code that calls it still compiles. This applies to an app that calls Firebase AI Logic with gemini-3.1-flash-tts-preview. If the app does not call that model, this card does not apply. The Firebase release notes for November 11, 2026 say Firebase AI Logic supports the latest stable Gemini TTS models gemini-3.8-flash-tts and gemini-3.8-flash-lite-tts for text-to-speech, through the Gemini Developer API or the Agent Platform Gemini API (formerly Vertex AI). Those notes say: "The preview model gemini-3.1-flash-tts-preview will shut down on November 17, 2026. If your app uses this legacy model, see the migration guide to update your model name, prompt format, and audio handling before that date." The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says gemini-3.1-flash-tts-preview will shut down on November 17, 2026. Migrate to gemini-3.8-flash-tts or gemini-3.8-flash-lite-tts before that date to avoid service disruption. Both new models use the same request structure. Those notes say to update the model name, the prompt format, and the audio handling before that date. That section says the new models keep each TextPart's text as the verbatim spoken transcript, and style goes in SpeechMetadata style on that part. The migration checklist on that page says to remove those prefixes and blocks, including a line such as "Say cheerfully:", "so the model doesn't read them aloud". The same section says the legacy model ignored system instructions, temperature, top-P, and top-K, and the new models reject them with a 400 INVALID_ARGUMENT error. Those pages describe the shutdown as service disruption.
Root cause
The call still names gemini-3.1-flash-tts-preview, and the prompt and the audio handling were written for that preview model. The Firebase release notes for November 11, 2026 say that preview model will shut down on November 17, 2026, and they point to the migration guide to update the model name, the prompt format, and the audio handling before that date. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says to migrate to gemini-3.8-flash-tts or gemini-3.8-flash-lite-tts before that date to avoid service disruption. Both new models use the same request structure. That section says the legacy model took the delivery style inside the prompt text, for example "Say cheerfully: ...", [Audio Profile], and [Director's Notes]. The new models take that style in SpeechMetadata style on each TextPart, and the TextPart text stays the verbatim spoken transcript. The checklist says to remove those prefixes and blocks "so the model doesn't read them aloud". For more than one speaker, that section says the legacy model used one text string with inline "Speaker: ..." prefixes. The new models use one TextPart per dialogue turn, with speechMetadata set to speaker and style. For vocal tags, that section says the legacy model used square brackets, such as [sigh] and [laughs]. The new models use angle brackets, such as <sigh>, <laugh>, and <short pause>. For audio, that section says the legacy unary response was headerless raw 16-bit PCM, audio/pcm, 24 kHz, mono. The new models return a complete WAV file, audio/wav, 16-bit PCM, 24 kHz, mono, with a 44-byte RIFF header. Streaming stays headerless raw 16-bit PCM, audio/l16. The November 11 notes say the same split: unary requests, generateContent, return a complete WAV file, audio/wav, and streaming requests, generateContentStream, return headerless raw 16-bit PCM chunks, audio/l16. The checklist says to remove any code that manually prepends a WAV header to unary responses, or to skip the 44-byte header when the code feeds raw PCM into a low-level buffer API such as Android's AudioTrack or Unity's AudioClip. That section says the legacy model ignored system instructions, temperature, top-P, and top-K. The new models reject them with a 400 INVALID_ARGUMENT error. The checklist says to remove temperature, topP, topK, candidateCount, presencePenalty, frequencyPenalty, and systemInstruction from the TTS GenerativeModel configuration. The checklist also says to upgrade to the latest Firebase AI Logic SDK and to update the model name. That page recommends Firebase Remote Config or server prompt templates so the model name can be changed without releasing a new app version. The official web example on that page, for firebase/ai, calls getGenerativeModel(ai, { model: "gemini-3.8-flash-tts", generationConfig: { responseModalities: [ResponseModality.AUDIO], speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: "Kore" } } } } }) and sets the prompt to [{ type: "text", text: "Have a wonderful day!", speechMetadata: { style: "cheerful and friendly" } }]. result.response.inlineDataParts()[0].inlineData.data is the WAV audio, base64.
Before and after
The style moves out of the spoken text. The before call names gemini-3.1-flash-tts-preview and still sets temperature. The before prompt is "Say cheerfully: Have a wonderful day! [laughs]", so the style and the square-bracket tag sit in the words the model speaks. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says the legacy model took style in the prompt, for example "Say cheerfully: ...", and vocal tags in square brackets such as [laughs]. 0.7 is not a value that page publishes. It only marks a temperature field. That section says the new models reject temperature with a 400 INVALID_ARGUMENT error, and the checklist says to remove it. The after call names gemini-3.8-flash-tts and drops temperature. The spoken text is "Have a wonderful day! <laugh>", and the style sits in speechMetadata.style as "cheerful". That page's new vocal-tag examples include <laugh>. wavHeader and rawPcm are not names from that page. They stand for code that prepends a WAV header to unary audio, which the checklist says to remove. The after line reads result.response.inlineDataParts()[0].inlineData.data and does not add a header. The official web example on that page says that value is the WAV audio. That example also sets speechConfig.voiceConfig.prebuiltVoiceConfig.voiceName to "Kore" and uses style "cheerful and friendly" with the text "Have a wonderful day!". This pair keeps the voice this project already set, and it uses the style word from the before prompt.
Before
const model = getGenerativeModel(ai, {
model: "gemini-3.1-flash-tts-preview",
generationConfig: {
temperature: 0.7,
responseModalities: [ResponseModality.AUDIO],
},
});
const prompt = "Say cheerfully: Have a wonderful day! [laughs]";
const audio = wavHeader + rawPcm;After
const model = getGenerativeModel(ai, {
model: "gemini-3.8-flash-tts",
generationConfig: {
responseModalities: [ResponseModality.AUDIO],
},
});
const prompt = [
{
type: "text",
text: "Have a wonderful day! <laugh>",
speechMetadata: { style: "cheerful" },
},
];
const wav = result.response.inlineDataParts()[0].inlineData.data;Fix prompt
In this project only. Do not scan or test anyone else's app. Do not open anyone else's Firebase project. Do not print keys, tokens, passwords, or environment variable values. When you mention a variable, print the name only.
1. Find every Firebase AI Logic speech call in this project. Search for gemini-3.1-flash-tts-preview, getGenerativeModel, firebase/ai, responseModalities, and ResponseModality.AUDIO. If this project does not call gemini-3.1-flash-tts-preview, say so and stop. Do not edit other models.
2. For each hit, give the file and the line. Include a model name stored in Firebase Remote Config or in a server prompt template in this project. Do not print keys or env values.
3. Change the model string from gemini-3.1-flash-tts-preview to gemini-3.8-flash-tts. If I say this call should use the lite model, use gemini-3.8-flash-lite-tts instead. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says both new models use the same request structure, and to migrate to one of them before November 17, 2026 to avoid service disruption. The Firebase release notes for November 11, 2026 say those two models are the latest stable Gemini TTS models, through the Gemini Developer API or the Agent Platform Gemini API (formerly Vertex AI). Show me the diff.
4. Move delivery style out of the spoken text and into speechMetadata.style on each text part. Remove prefixes and blocks such as "Say cheerfully:", [Audio Profile], and [Director's Notes]. Leave the TextPart text as the verbatim spoken transcript. That section says the legacy model took style in the prompt text, and the new models take it in SpeechMetadata style. The checklist says to remove those prefixes and blocks "so the model doesn't read them aloud". Use the style words that were already in this project's prompt. Do not invent a style string. The official web example on that page uses speechMetadata: { style: "cheerful and friendly" } with text "Have a wonderful day!". Show me the diff.
5. Change the vocal tags that page names. [sigh] becomes <sigh>. [laughs] becomes <laugh>. A short pause becomes <short pause>. That section says the legacy model used square brackets, such as [sigh] and [laughs], and the new models use angle brackets, such as <sigh>, <laugh>, and <short pause>. If a square-bracket tag in this project is not one of those examples, show me the tag and do not invent a replacement. Show me the diff.
6. Where one string contains inline "Speaker:" prefixes, split it into one TextPart per dialogue turn. Set speechMetadata to speaker and style on each turn. That section says the legacy model used one text string with inline "Speaker: ..." prefixes, and the new models use one TextPart per turn. If this project has a single speaker and no "Speaker:" prefix, do not split the prompt. Show me the diff.
7. Remove temperature, topP, topK, candidateCount, presencePenalty, frequencyPenalty, and systemInstruction from the TTS GenerativeModel configuration. Also remove top-P and top-K where this project spells them that way. That section says the legacy model ignored system instructions, temperature, top-P, and top-K, and the new models reject them with a 400 INVALID_ARGUMENT error. The checklist names those fields. Do not remove them from a model call that is not this TTS call. Show me the diff.
8. Remove code that prepends a WAV header to unary generateContent audio. That section says the new unary response is already a complete WAV file, audio/wav, 16-bit PCM, 24 kHz, mono, with a 44-byte RIFF header. The November 11 notes say generateContent returns a complete WAV file, audio/wav. Play that WAV directly. If this project feeds raw PCM into Android's AudioTrack or Unity's AudioClip, skip the 44-byte header, as that checklist says. Leave generateContentStream as headerless raw 16-bit PCM chunks, audio/l16. The November 11 notes say streaming returns that format. Do not add a WAV header to those chunks. Show me the diff.
9. Upgrade the Firebase AI Logic SDK this project already uses to the latest release. The checklist says to upgrade to the latest Firebase AI Logic SDK. Do not invent a version number. If you cannot tell which package provides firebase/ai in this project, say so and do not edit package.json. Do not upgrade unrelated packages. Show me the diff only if you change a version.
10. Read the model name from Firebase Remote Config or from a server prompt template when this project already has one. That page recommends Remote Config or server prompt templates so the model name can be changed without releasing a new app version. Do not invent a parameter name. If this project has neither, say so, leave the model string from step 3 in place, and tell me that page's recommendation. Do not change the Firebase console. Show me the diff only if you wire a name this project already stores.
11. Show me the diffs. Tell me to trigger this project's own voice feature once and confirm it plays, and confirm it does not read the style words aloud. Do not call an app I do not own.
Do not print keys. Do not edit unrelated files.Paste this into the coding tool that has your own project open.
2-minute self-check
These steps are for an app you own. Do not run them against someone else's project.
- In your own code, search for gemini-3.1-flash-tts-preview. The Firebase release notes for November 11, 2026 say that preview model will shut down on November 17, 2026. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says to migrate to gemini-3.8-flash-tts or gemini-3.8-flash-lite-tts before that date to avoid service disruption. Do not search a repository you do not own.
- In your own speech prompts, search for "Say cheerfully", for a square bracket in the spoken text, for temperature on the TTS model config, and for a helper that prepends a WAV header to generateContent audio. That section says the legacy model took style in the prompt, for example "Say cheerfully: ...", and vocal tags in square brackets such as [sigh] and [laughs]. It says the new models reject temperature with a 400 INVALID_ARGUMENT error, and that a unary response is already a complete WAV file. Do not search a repository you do not own.
- Trigger your own voice feature once after the change. Confirm it plays, and confirm it does not read the style words aloud. The migration checklist on that page says to remove style prefixes and blocks "so the model doesn't read them aloud". Do not call an app you do not own, and do not paste an API key.
Common questions
What happens if I do nothing before November 17?
The preview model shuts down. The Firebase release notes for November 11, 2026 say: "The preview model gemini-3.1-flash-tts-preview will shut down on November 17, 2026. If your app uses this legacy model, see the migration guide to update your model name, prompt format, and audio handling before that date." The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says to migrate to gemini-3.8-flash-tts or gemini-3.8-flash-lite-tts before that date to avoid service disruption.
Why does my app now say "cheerfully" out loud?
The style is still inside the spoken text. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says the legacy model took style in the prompt, for example "Say cheerfully: ...", [Audio Profile], and [Director's Notes]. The new models keep TextPart text as the verbatim spoken transcript, and style goes in SpeechMetadata style on each TextPart. The checklist says to remove those prefixes and blocks "so the model doesn't read them aloud".
Why do I get a 400 after I switch the model name?
The old generation settings are still on the TTS call. The Firebase docs page "Generate speech (TTS)", section "Migrate from gemini-3.1-flash-tts-preview", says the legacy model ignored system instructions, temperature, top-P, and top-K. The new models reject them with a 400 INVALID_ARGUMENT error. The checklist says to remove temperature, topP, topK, candidateCount, presencePenalty, frequencyPenalty, and systemInstruction from the TTS GenerativeModel configuration.