[Integrations](https://spiral.ai/integrations) › [Codex](https://spiral.ai/integrations/codex) › [Gemini 3.1 Flash TTS](https://spiral.ai/integrations/codex/gemini-3-1-flash-tts)

# How to Use Gemini 3.1 Flash TTS in Codex

Gemini 3.1 Flash TTS turns finished scripts into expressive narration and dialogue. Its square-bracket audio tags let you change delivery at specific points in the script.

|  |  |
| --- | --- |
| Model | Gemini 3.1 Flash TTS |
| Available through | fal |
| Category | Audio |
| Price | Each item in `prompt` adds $0.065. |
| Returns | audio |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with Gemini 3.1 Flash TTS in Codex

- Read this project's README and draft a 120-word spoken introduction for a new contributor. Use Gemini 3.1 Flash TTS to narrate it in a patient, conversational tone, keeping code snippets out of the spoken script.
- Read the latest changelog entry and write a 100-word customer-facing release recap. Use Gemini 3.1 Flash TTS for a clear, matter-of-fact reading, and show me the script alongside the recording.
- Find the onboarding instructions in this project and turn the first task into a short narrated tutorial. Use Gemini 3.1 Flash TTS with a measured delivery, and write commands as pronounceable words in the script.
- Use the project's FAQ to write a six-turn exchange between a curious new user and a patient instructor. Generate the dialogue with Gemini 3.1 Flash TTS using distinct voices and clearly labeled speaker turns.
- Review the game's menu text in this project and select five short descriptions for spoken guidance. Use Gemini 3.1 Flash TTS to generate each description separately with the same calm delivery brief.

## How to set up Gemini 3.1 Flash TTS in Codex

Pick the way that suits you. Each takes about two minutes.

### Use Spiral's MCP server

1. **Add the hosted server**

```bash
codex mcp add spiral --url https://api.spiral.ai/mcp
```

2. **Sign in**: Codex opens the browser: sign in to Spiral and click Authorize. No API key. `codex mcp list` then shows Spiral.

```bash
codex mcp login spiral
```

### Use the Spiral skill

1. **Send Codex this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run Gemini 3.1 Flash TTS**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "fal",
    "model": "fal-ai/gemini-3.1-flash-tts",
    "input": {
      "prompt": "I can'\''t believe it worked! [laughing] After all those hours of debugging [sigh] it was just a missing semicolon."
    }
  }'
```

Then paste one of the prompts above: Codex finds Gemini 3.1 Flash TTS on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/codex

## Gemini 3.1 Flash TTS tools and prices

- [Gemini 3.1 Flash Tts](https://spiral.ai/tools/fal/fal-ai/gemini-3.1-flash-tts) (fal): $0.065 per 1,000 characters of `prompt`. Rounded up to the next 1,000 characters, minimum 1,000.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| style_instructions |  | — | Optional style and delivery instructions prepended to the prompt. Controls expressiveness, accent, pace, tone, and emotional expression using natural language. Use this to separate style control from the text content. Examples: 'Speak warmly and slowly', 'Read this as a dramatic newscast', 'Use a British accent with a cheerful tone', 'Whisper mysteriously'. |
| voice | Achernar, Achird, Algenib, Algieba, Alnilam, Aoede, Autonoe, Callirrhoe, Charon, Despina, Enceladus, Erinome, Fenrir, Gacrux, Iapetus, Kore, Laomedeia, Leda, Orus, Pulcherrima, Puck, Rasalgethi, Sadachbia, Sadaltager, Schedar, Sulafat, Umbriel, Vindemiatrix, Zephyr, Zubenelgenubi | Kore | Voice preset for single-speaker synthesis. 30 distinct voices are available. Ignored when speakers is set. Popular choices: Kore (strong, firm female), Puck (upbeat, lively male), Charon (calm, professional male), Zephyr (bright, clear female), Aoede (warm, melodic female). |
| language_code | Arabic (Egypt), Bangla (Bangladesh), Dutch (Netherlands), English (India), English (US), French (France), German (Germany), Hindi (India), Indonesian (Indonesia), Italian (Italy), Japanese (Japan), Korean (South Korea), Marathi (India), Polish (Poland), Portuguese (Brazil), Romanian (Romania), Russian (Russia), Spanish (Spain), Tamil (India), Telugu (India), Thai (Thailand), Turkish (Turkey), Ukrainian (Ukraine), Vietnamese (Vietnam), Afrikaans (South Africa), Albanian (Albania), Amharic (Ethiopia), Arabic (World), Armenian (Armenia), Azerbaijani (Azerbaijan), Basque (Spain), Belarusian (Belarus), Bulgarian (Bulgaria), Burmese (Myanmar), Catalan (Spain), Cebuano (Philippines), Chinese Mandarin (China), Chinese Mandarin (Taiwan), Croatian (Croatia), Czech (Czech Republic), Danish (Denmark), English (Australia), English (UK), Estonian (Estonia), Filipino (Philippines), Finnish (Finland), French (Canada), Galician (Spain), Georgian (Georgia), Greek (Greece), Gujarati (India), Haitian Creole (Haiti), Hebrew (Israel), Hungarian (Hungary), Icelandic (Iceland), Javanese (Java), Kannada (India), Konkani (India), Lao (Laos), Latin (Vatican City), Latvian (Latvia), Lithuanian (Lithuania), Luxembourgish (Luxembourg), Macedonian (North Macedonia), Maithili (India), Malagasy (Madagascar), Malay (Malaysia), Malayalam (India), Mongolian (Mongolia), Nepali (Nepal), Norwegian Bokmal (Norway), Norwegian Nynorsk (Norway), Odia (India), Pashto (Afghanistan), Persian (Iran), Portuguese (Portugal), Punjabi (India), Serbian (Serbia), Sindhi (India), Sinhala (Sri Lanka), Slovak (Slovakia), Slovenian (Slovenia), Spanish (Latin America), Spanish (Mexico), Swahili (Kenya), Swedish (Sweden), Urdu (Pakistan) | — | Language for multilingual synthesis. When set, steers the model to speak in the specified language. If not set, the model auto-detects the language from the text. |
| speakers |  | — | Multi-speaker voice configuration. When set, enables multi-speaker synthesis where different parts of the text are spoken by different voices. Each speaker needs a voice and a speaker_id (alias) that matches prefixes in the prompt. |
| temperature | 0 to 2 | 1 | Controls the randomness of the speech output. Higher values produce more creative and varied delivery, while lower values make the output more predictable and focused. |
| output_format | wav, mp3, ogg_opus | mp3 | Audio output format. mp3: compressed, small file size (recommended). wav: uncompressed PCM wrapped in WAV (24 kHz, 16-bit mono). ogg_opus: Ogg container with Opus codec, good quality-to-size ratio. |

## What can you do with Gemini 3.1 Flash TTS in Codex?

Turn project documentation into narrated walkthroughs, tutorials, and spoken release summaries. Have the coding agent prepare a concise script from the relevant files, then direct its delivery with Gemini 3.1 Flash TTS.

### Product walkthrough narration

Turn a short walkthrough script into spoken guidance. Give the narrator a measured delivery and review how product names and button labels sound.

### Two-person explainers

Write an exchange between a curious host and a knowledgeable guest. Use distinct delivery directions to make questions and answers easy to follow.

### Language lesson listening practice

Voice a prepared dialogue in the language being taught. Produce a deliberate reading for learners and a conversational reading for comparison.

### Short story performances

Narrate a short scene with a clear overall mood. Place delivery cues at a reveal or a whispered line, then listen for directions that were accidentally spoken.

### Spoken service notices

Create recordings from approved maintenance, delivery, or appointment notices. Direct a calm tone and review every date, time, and reference number.

### Read-aloud articles

Produce narrated editions of edited articles or newsletters. Break longer pieces at section boundaries and check each recording against its script.

### Game menu guidance

Voice written menu descriptions and tutorial instructions. Keep directions concise and use a consistent delivery brief across the recordings.

### Training lesson narration

Turn approved lesson text into spoken instruction. Use a patient delivery for explanations and create separate recordings for each topic.

## Overview

- [fal](https://spiral.ai/providers/fal)
- [All Codex guides](https://spiral.ai/integrations/codex)

## Gemini 3.1 Flash TTS in other agents

- [Amp](https://spiral.ai/integrations/amp/gemini-3-1-flash-tts)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/gemini-3-1-flash-tts)
- [Claude](https://spiral.ai/integrations/claude-desktop/gemini-3-1-flash-tts)
- [Claude Code](https://spiral.ai/integrations/claude-code/gemini-3-1-flash-tts)
- [Cline](https://spiral.ai/integrations/cline/gemini-3-1-flash-tts)
- [Cursor](https://spiral.ai/integrations/cursor/gemini-3-1-flash-tts)
- [Devin](https://spiral.ai/integrations/devin/gemini-3-1-flash-tts)
- [dots](https://spiral.ai/integrations/dots/gemini-3-1-flash-tts)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/gemini-3-1-flash-tts)
- [Gemini](https://spiral.ai/integrations/gemini/gemini-3-1-flash-tts)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/gemini-3-1-flash-tts)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/gemini-3-1-flash-tts)
- [goose](https://spiral.ai/integrations/goose/gemini-3-1-flash-tts)
- [Grok](https://spiral.ai/integrations/grok/gemini-3-1-flash-tts)
- [Grok Build](https://spiral.ai/integrations/grok-build/gemini-3-1-flash-tts)
- [Hermes](https://spiral.ai/integrations/hermes/gemini-3-1-flash-tts)
- [Instinct](https://spiral.ai/integrations/instinct/gemini-3-1-flash-tts)
- [Manus](https://spiral.ai/integrations/manus/gemini-3-1-flash-tts)
- [Muse](https://spiral.ai/integrations/muse/gemini-3-1-flash-tts)
- [Muse Code](https://spiral.ai/integrations/muse-code/gemini-3-1-flash-tts)
- [n8n](https://spiral.ai/integrations/n8n/gemini-3-1-flash-tts)
- [Notion](https://spiral.ai/integrations/notion/gemini-3-1-flash-tts)
- [OpenClaw](https://spiral.ai/integrations/openclaw/gemini-3-1-flash-tts)
- [opencode](https://spiral.ai/integrations/opencode/gemini-3-1-flash-tts)
- [Perplexity](https://spiral.ai/integrations/perplexity/gemini-3-1-flash-tts)
- [Raycast](https://spiral.ai/integrations/raycast/gemini-3-1-flash-tts)
- [VS Code](https://spiral.ai/integrations/vscode/gemini-3-1-flash-tts)
- [Windsurf](https://spiral.ai/integrations/windsurf/gemini-3-1-flash-tts)
- [Zapier](https://spiral.ai/integrations/zapier/gemini-3-1-flash-tts)

## More Codex guides

- [Gemini 2.5 Pro Preview TTS](https://spiral.ai/integrations/codex/gemini-2-5-pro-preview-tts)
- [Gemini 3.8 Flash TTS](https://spiral.ai/integrations/codex/gemini-3-8-flash-tts)
- [Gemini 2.5 Flash TTS](https://spiral.ai/integrations/codex/gemini-2-5-flash-tts)
- [Gemini 3.8 Flash-Lite TTS](https://spiral.ai/integrations/codex/gemini-3-8-flash-lite-tts)
- [GPT-4o mini Transcribe](https://spiral.ai/integrations/codex/gpt-4o-mini-transcribe)
- [Grok Voice](https://spiral.ai/integrations/codex/grok-voice)

## Questions about Gemini 3.1 Flash TTS in Codex

**Can Codex use Gemini 3.1 Flash TTS?**

Yes. Add Spiral to Codex as an MCP server, and Codex can find and run Gemini 3.1 Flash TTS like any built-in tool.

**How much does Gemini 3.1 Flash TTS cost in Codex?**

Each item in `prompt` adds $0.065. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Codex plan is separate.

**Do I need a fal account to use Gemini 3.1 Flash TTS in Codex?**

No. Spiral runs Gemini 3.1 Flash TTS on its own fal account. You sign in to Spiral once and never paste a key.

**How long does it take to set up Gemini 3.1 Flash TTS in Codex?**

About two minutes: add the hosted server, then sign in.

**Does Codex wait while Gemini 3.1 Flash TTS runs?**

Gemini 3.1 Flash TTS runs in the background. Codex starts the run, checks on it and gives you the audio when it's ready.

**What is Gemini 3.1 Flash TTS good at?**

Use it to turn a finished script into narration or dialogue with deliberate delivery. It suits explainers, story excerpts, training lessons, and spoken announcements where you want to direct how the words sound.

**Can Gemini 3.1 Flash TTS generate dialogue?**

Yes, it supports native multi-speaker dialogue. Write clearly labeled turns and give each speaker a distinct delivery direction, such as an inquisitive host and a measured instructor.

**How many languages does Gemini 3.1 Flash TTS support?**

Google documents support for more than 70 languages. For localized narration, prepare the translated script first and have a fluent listener review the generated speech.

**How do I direct the delivery?**

Describe the overall delivery in natural language, then place square-bracket audio tags where a local change should happen. For example, put [whispers] immediately before a quiet line.

**How long can a Gemini 3.1 Flash TTS script be?**

Google lists an 8,192-token input limit and a 16,384-token output limit for the preview model. Treat these as token limits rather than a guaranteed recording length; divide longer material into sections and check that each recording reaches its final sentence.

