> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unifically.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini 3.1 Flash TTS

> Generate speech with Google's Gemini 3.1 Flash TTS model — 30 voices, two-speaker dialogue, style instructions, and 70+ languages. See parameters, voices, and API examples.

Google's newest and most expressive text-to-speech model.

## Model

```
google/gemini-3.1-flash-tts
```

## Parameters

| Parameter         | Type   | Required | Default | Description                                                                                                       |
| ----------------- | ------ | -------- | ------- | ----------------------------------------------------------------------------------------------------------------- |
| `input`           | string | Yes\*    | -       | Text to speak. Language is auto-detected (70+ languages). \*Provide exactly one of `input`, `text`, or `dialogue` |
| `text`            | string | No       | -       | Alias for `input`                                                                                                 |
| `dialogue`        | array  | No       | -       | Dialogue lines as `[{"text", "voice", "speaker"?}, ...]` — see [Multi-Speaker Dialogue](#multi-speaker-dialogue)  |
| `voice`           | string | No       | `alloy` | Voice name — a Gemini voice or an OpenAI-style alias (see [Voices](#voices))                                      |
| `response_format` | string | No       | `mp3`   | Output container: `mp3`, `wav`, `pcm`, `opus`, `aac`, `flac`                                                      |
| `speed`           | number | No       | `1.0`   | Playback speed multiplier, `0.25`–`4.0`                                                                           |
| `instructions`    | string | No       | -       | Style directions the voice follows but does not read, e.g. `"speak like a sports commentator"`                    |
| `language`        | string | No       | auto    | BCP-47 code to pin the output language (see [Languages](#languages))                                              |
| `speakers`        | array  | No       | -       | Two-speaker dialogue config (see [Multi-Speaker Dialogue](#multi-speaker-dialogue)). When set, `voice` is ignored |

## Audio Tags

This model understands **inline audio tags** written directly inside `input` for line-level delivery control:

```json theme={null}
{ "input": "[whispering] I have a secret. [excited] And you will love it!" }
```

Common tags: `[whispering]`, `[excited]`, `[laughing]`, `[sighs]`, `[sarcastic]`, `[calm]`. Tags are performed, not spoken.

## Multi-Speaker Dialogue

Generate a conversation between **up to 2 voices** in one request. Two equivalent forms are accepted.

**Form 1 — `dialogue` array.** Each line carries its own voice; lines are spoken in order:

```json theme={null}
{
  "dialogue": [
    { "text": "Did the deploy finish?", "voice": "onyx", "speaker": "Joe" },
    { "text": "Yes, all green — we are live!", "voice": "nova", "speaker": "Jane" },
    { "text": "Great news.", "voice": "onyx", "speaker": "Joe" }
  ]
}
```

`speaker` is optional — lines sharing a voice are treated as the same speaker automatically. If every line uses the same voice, the result is ordinary single-voice speech.

**Form 2 — script plus `speakers` map.** Write the script in `input` with speaker names, and map each name to a voice:

```json theme={null}
{
  "input": "Joe: Did the deploy finish? Jane: Yes, all green — we are live!",
  "speakers": [
    { "speaker": "Joe", "voice": "onyx" },
    { "speaker": "Jane", "voice": "Leda" }
  ]
}
```

Speaker names must match the names used in `input` exactly. Both forms are limited to 2 distinct voices — a third voice is rejected with a `400`.

## Voices

30 prebuilt voices. Use either the Gemini name or the OpenAI-style alias in `voice` and `speakers[].voice`:

| Voice           | Style         | OpenAI alias |
| --------------- | ------------- | ------------ |
| `Achernar`      | Soft          | -            |
| `Achird`        | Friendly      | -            |
| `Algenib`       | Gravelly      | -            |
| `Algieba`       | Smooth        | -            |
| `Alnilam`       | Firm          | -            |
| `Aoede`         | Breezy        | `fable`      |
| `Autonoe`       | Bright        | -            |
| `Callirrhoe`    | Easy-going    | `sage`       |
| `Charon`        | Informative   | `onyx`       |
| `Despina`       | Smooth        | -            |
| `Enceladus`     | Breathy       | -            |
| `Erinome`       | Clear         | -            |
| `Fenrir`        | Excitable     | `ash`        |
| `Gacrux`        | Mature        | -            |
| `Iapetus`       | Clear         | -            |
| `Kore`          | Firm          | `alloy`      |
| `Laomedeia`     | Upbeat        | -            |
| `Leda`          | Youthful      | `nova`       |
| `Orus`          | Firm          | `verse`      |
| `Puck`          | Upbeat        | `echo`       |
| `Pulcherrima`   | Forward       | -            |
| `Rasalgethi`    | Informative   | -            |
| `Sadachbia`     | Lively        | -            |
| `Sadaltager`    | Knowledgeable | -            |
| `Schedar`       | Even          | -            |
| `Sulafat`       | Warm          | `coral`      |
| `Umbriel`       | Easy-going    | `ballad`     |
| `Vindemiatrix`  | Gentle        | -            |
| `Zephyr`        | Bright        | `shimmer`    |
| `Zubenelgenubi` | Casual        | -            |

## Languages

Language is **auto-detected** from `input` (70+ languages). Set `language` only to force a specific locale:

| Code    | Language            |
| ------- | ------------------- |
| `ar-EG` | Arabic (Egyptian)   |
| `bn-BD` | Bengali             |
| `de-DE` | German              |
| `en-IN` | English (India)     |
| `en-US` | English (US)        |
| `es-US` | Spanish (US)        |
| `fr-FR` | French              |
| `hi-IN` | Hindi               |
| `id-ID` | Indonesian          |
| `it-IT` | Italian             |
| `ja-JP` | Japanese            |
| `ko-KR` | Korean              |
| `mr-IN` | Marathi             |
| `nl-NL` | Dutch               |
| `pl-PL` | Polish              |
| `pt-BR` | Portuguese (Brazil) |
| `ro-RO` | Romanian            |
| `ru-RU` | Russian             |
| `ta-IN` | Tamil               |
| `te-IN` | Telugu              |
| `th-TH` | Thai                |
| `tr-TR` | Turkish             |
| `uk-UA` | Ukrainian           |
| `vi-VN` | Vietnamese          |

## Output Formats

| Format | Description                |
| ------ | -------------------------- |
| `mp3`  | MP3 (default)              |
| `wav`  | WAV, 24kHz 16-bit          |
| `pcm`  | Raw PCM, 24kHz 16-bit mono |
| `opus` | Opus in an Ogg container   |
| `aac`  | AAC (ADTS)                 |
| `flac` | FLAC lossless              |

## Resources

List voices and languages from the [Resources API](/api-reference/resources):

```
GET /v1/resources/google/tts/voices
GET /v1/resources/google/tts/languages
```

## Example

```bash theme={null}
curl -X POST https://api.unifically.com/v1/tasks \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "google/gemini-3.1-flash-tts",
    "input": {
      "input": "Welcome back! Your order has shipped and arrives tomorrow.",
      "voice": "nova",
      "response_format": "mp3",
      "instructions": "Speak cheerfully, like a friendly support agent."
    }
  }'
```

## Response

```json theme={null}
{
  "code": 200,
  "success": true,
  "data": {
    "task_id": "abc123def456",
    "status": "processing"
  }
}
```

## Completed Response

Poll `GET /v1/tasks/{task_id}` until `status` is `completed`:

```json theme={null}
{
  "code": 200,
  "success": true,
  "data": {
    "task_id": "abc123def456",
    "status": "completed",
    "output": {
      "audio_url": "https://files.unifically.com/audio/abc123.mp3"
    }
  }
}
```
