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

# Gemini 3.1 Flash TTS Preview

> Create asynchronous text-to-speech tasks with gemini-3.1-flash-tts-preview via POST /v1/predictions.

## Prompt (`input.prompt`)

Required. Text to synthesize (max **32,000** characters). Supports expressive markup tags in the text:

| Tag                | Effect             |
| ------------------ | ------------------ |
| `[sigh]`           | Sigh               |
| `[laughing]`       | Laughter           |
| `[whispering]`     | Whisper            |
| `[shouting]`       | Shout              |
| `[extremely fast]` | Very fast delivery |

## Style instructions (`input.style_instructions`)

Optional (max **1,000** characters). Natural-language directions for tone, pace, accent, and emotion. Default: `Say the following.`

## Voice presets (`input.voice`)

Optional. Default **`Kore`**.

| `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` |

## Language (`input.language`)

Optional BCP-47 language code. Default **`en-US`**.

| Code     | Code     | Code     | Code     |
| -------- | -------- | -------- | -------- |
| `af-ZA`  | `am-ET`  | `ar-001` | `ar-EG`  |
| `az-AZ`  | `be-BY`  | `bg-BG`  | `bn-BD`  |
| `ca-ES`  | `ceb-PH` | `cmn-CN` | `cmn-tw` |
| `cs-CZ`  | `da-DK`  | `de-DE`  | `el-GR`  |
| `en-AU`  | `en-GB`  | `en-IN`  | `en-US`  |
| `es-419` | `es-ES`  | `es-MX`  | `et-EE`  |
| `eu-ES`  | `fa-IR`  | `fi-FI`  | `fil-PH` |
| `fr-CA`  | `fr-FR`  | `gl-ES`  | `gu-IN`  |
| `he-IL`  | `hi-IN`  | `hr-HR`  | `ht-HT`  |
| `hu-HU`  | `hy-AM`  | `id-ID`  | `is-IS`  |
| `it-IT`  | `ja-JP`  | `jv-JV`  | `ka-GE`  |
| `kn-IN`  | `ko-KR`  | `kok-IN` | `la-VA`  |
| `lb-LU`  | `lo-LA`  | `lt-LT`  | `lv-LV`  |
| `mai-IN` | `mg-MG`  | `mk-MK`  | `ml-IN`  |
| `mn-MN`  | `mr-IN`  | `ms-MY`  | `my-MM`  |
| `nb-NO`  | `ne-NP`  | `nl-NL`  | `nn-NO`  |
| `or-IN`  | `pa-IN`  | `pl-PL`  | `ps-AF`  |
| `pt-BR`  | `pt-PT`  | `ro-RO`  | `ru-RU`  |
| `sd-IN`  | `si-LK`  | `sk-SK`  | `sl-SI`  |
| `sq-AL`  | `sr-RS`  | `sv-SE`  | `sw-KE`  |
| `ta-IN`  | `te-IN`  | `th-TH`  | `tr-TR`  |
| `uk-UA`  | `ur-PK`  | `vi-VN`  |          |

## Output format (`input.output_format`)

Optional. Default **`mp3`**.

| Value      | Description    |
| ---------- | -------------- |
| `mp3`      | MP3 audio      |
| `wav`      | WAV audio      |
| `ogg_opus` | Ogg Opus audio |


## OpenAPI

````yaml en/api-reference/audio-series/google/gemini-3.1-flash-tts-preview-generate.json POST /v1/predictions
openapi: 3.1.0
info:
  title: Gemini 3.1 Flash TTS Preview
  version: 1.0.0
servers:
  - url: https://api.shuyou.ai
security:
  - bearerAuth: []
paths:
  /v1/predictions:
    post:
      tags:
        - Audio Generation
      summary: Gemini 3.1 Flash TTS Preview
      description: >-
        Gemini 3.1 Flash TTS Preview (`gemini-3.1-flash-tts-preview`) converts
        text to speech asynchronously via POST /v1/predictions. Poll [Get a
        prediction](/en/api-reference/task-management/get-prediction) using
        `data.task_id`, or configure top-level `webhook` for completion
        callbacks.
      operationId: createGemini31FlashTtsPreviewPrediction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Gemini31FlashTtsPreviewPredictionRequest'
            examples:
              text_to_speech:
                summary: Expressive TTS
                value:
                  model: gemini-3.1-flash-tts-preview
                  input:
                    prompt: 'Say cheerfully: Have a wonderful day!'
                    style_instructions: Say the following in a warm, upbeat tone.
                    voice: Kore
                    language: en-US
                    output_format: mp3
                  webhook: https://api.shuyou.ai/backend/api/callback
              text_to_speech_minimal:
                summary: Minimal request
                value:
                  model: gemini-3.1-flash-tts-preview
                  input:
                    prompt: Welcome to ShuYou AI documentation.
      responses:
        '200':
          description: Async task created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PredictionTaskResponse'
              example:
                data:
                  task_id: 2c4d50261173430290971a2395a3b607
                  task_status: processing
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient quota
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Model access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Gemini31FlashTtsPreviewPredictionRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Model ID. Use `gemini-3.1-flash-tts-preview` for this endpoint.
          enum:
            - gemini-3.1-flash-tts-preview
          default: gemini-3.1-flash-tts-preview
          example: gemini-3.1-flash-tts-preview
        input:
          $ref: '#/components/schemas/Gemini31FlashTtsPreviewInput'
        webhook:
          type: string
          format: uri
          description: >-
            Optional HTTPS callback URL when the task completes, fails, or is
            cancelled.
    PredictionTaskResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            task_id:
              type: string
              description: Async task ID. Use with Get a prediction or webhook correlation.
              example: 2c4d50261173430290971a2395a3b607
            task_status:
              type: string
              description: Current task status, e.g. `processing`.
              example: processing
          required:
            - task_id
            - task_status
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            type:
              type: string
    Gemini31FlashTtsPreviewInput:
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          maxLength: 32000
          description: >-
            The text to convert to speech. Supports markup tags like `[sigh]`,
            `[laughing]`, `[whispering]`, `[shouting]`, and `[extremely fast]`
            for expressive delivery.
          default: 'Say cheerfully: Have a wonderful day!'
          example: 'Say cheerfully: Have a wonderful day!'
        style_instructions:
          type: string
          maxLength: 1000
          description: >-
            Style instructions to control how the text is spoken. Use natural
            language to describe the desired tone, pace, accent, and emotion.
          default: Say the following.
          example: Say the following in a warm, upbeat tone.
        voice:
          type: string
          description: >-
            Voice preset for speech generation. See the voice table on this page
            for all supported values.
          default: Kore
          example: Kore
          enum:
            - 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
        language:
          type: string
          description: >-
            BCP-47 language code for speech output. See the language table on
            this page for supported codes. Default `en-US` (English US).
          default: en-US
          example: en-US
        output_format:
          type: string
          description: Audio output format.
          enum:
            - mp3
            - wav
            - ogg_opus
          default: mp3
          example: mp3
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: '`Authorization: Bearer YOUR_API_KEY`'

````