# Gemini 3.1 Flash TTS > Turn text into expressive, directable speech in 30 voices — describe the delivery in plain language and get back a 24 kHz WAV. ## Overview - **Endpoint**: `https://queue.modelrunner.run/google/gemini-3.1-flash-tts` - **Model ID**: `google/gemini-3.1-flash-tts` - **Category**: sound - **Kind**: inference - **Tags**: google, gemini, gemini-3.1, text-to-speech, tts, voice, speech, audio, narration, voice-over, expressive, controllable ## Pricing - **Price**: $0.0006 per output second ## Request Lifecycle This model runs on the ModelRunner **asynchronous queue API** — a single POST does not return the output. Every call requires an `Authorization: Key $MODEL_RUNNER_KEY` header. Run three steps: 1. **Submit** — `POST https://queue.modelrunner.run/google/gemini-3.1-flash-tts` with a JSON body holding the input fields at the top level. The body may also include a reserved top-level `metadata` object — a flat string map (max 16 keys, key ≤64 / value ≤512 chars) stored on the request for your own tagging. It is never sent to the model; filter your request history with `GET https://queue.modelrunner.run/requests?metadata=` (exact key=value matches, AND-ed). The response carries request handles only (no output yet): ```json { "status": "IN_QUEUE", "request_id": "<21-char id>", "status_url": "https://queue.modelrunner.run/google/gemini-3.1-flash-tts/requests//status", "response_url": "https://queue.modelrunner.run/google/gemini-3.1-flash-tts/requests/", "cancel_url": "https://queue.modelrunner.run/google/gemini-3.1-flash-tts/requests//cancel" } ``` 2. **Poll status** — `GET ` until `status` is `COMPLETED`. Possible values are `IN_QUEUE`, `IN_PROGRESS`, `COMPLETED`, `FAILED`, `CANCELLED`. A `FAILED` request responds with HTTP 400 and an `error` field. 3. **Read result** — `GET `. Returns the finished request, including the generated `output`: ```json { "id": "", "status": "COMPLETED", "output": ..., "input": ... } ``` The JavaScript and Python SDKs below perform steps 2–3 for you. In any language without an SDK (Swift, Go, Kotlin, etc.) you must implement the polling loop and the final result fetch yourself — see the cURL example for the full flow. ### Input Schema - **`voice`** (`Voice`, _optional_): Prebuilt voice to speak in. Each has a distinct character, e.g. Kore (firm), Puck (upbeat), Aoede (breezy), Charon (informative), Sulafat (warm), Enceladus (breathy). - Default: `"Kore"` - Options: `"Achernar"`, `"Achird"`, `"Algenib"`, `"Algieba"`, `"Alnilam"`, `"Aoede"`, `"Autonoe"`, `"Callirrhoe"`, `"Charon"`, `"Despina"`, `"Enceladus"`, `"Erinome"`, `"Fenrir"`, `"Gacrux"`, `"Iapetus"`, `"Kore"`, `"Laomedeia"`, `"Leda"`, `"Orus"`, `"Puck"`, `"Pulcherrima"`, `"Rasalgethi"`, `"Sadachbia"`, `"Sadaltager"`, `"Schedar"`, `"Sulafat"`, `"Umbriel"`, `"Vindemiatrix"`, `"Zephyr"`, `"Zubenelgenubi"` - **`prompt`** (`string`, _required_): Style direction plus the words to speak, as '{style instruction}: {text}' — e.g. 'Say the following in a warm, curious way: OK, so... tell me about this AI thing.' Direction controls accent, pace, tone and emotion. Inline audio tags such as \[laughs\] or \[sigh\] are supported. Combined direction and text must be under ~8,000 bytes; audio beyond ~655 seconds is truncated. - **`language_code`** (`LanguageCode`, _optional_): Locale for the delivery. Any prebuilt voice can be paired with any of these locales. - Default: `"en-us"` - Options: `"ar-eg"`, `"bn-bd"`, `"de-de"`, `"en-in"`, `"en-us"`, `"es-es"`, `"fr-fr"`, `"hi-in"`, `"id-id"`, `"it-it"`, `"ja-jp"`, `"ko-kr"`, `"mr-in"`, `"nl-nl"`, `"pl-pl"`, `"pt-br"`, `"ro-ro"`, `"ru-ru"`, `"ta-in"`, `"te-in"`, `"th-th"`, `"tr-tr"`, `"uk-ua"`, `"vi-vn"` ### Output Schema _No `Output` schema properties are available._ ## Default Example **Input** ```json { "voice": "Sulafat", "prompt": "Read the following as a calm, warm audiobook narrator — unhurried, low, with a slight pause before the last clause: The harbour was still asleep when she cast off, and the only sound was the halyard tapping against the mast.", "language_code": "en-us" } ``` **Output** ```json "https://media.modelrunner.ai/R7eiqH7BjCDBUXq4xGrKI.wav" ``` ## Usage Examples ### cURL The queue API is asynchronous: submit the request, poll `status_url` until it is `COMPLETED`, then read the result from `response_url`. Requires `jq`. ```bash # 1. Submit the request (returns request handles, not the output) SUBMIT=$(curl --silent --request POST \ --url https://queue.modelrunner.run/google/gemini-3.1-flash-tts \ --header "Authorization: Key $MODEL_RUNNER_KEY" \ --header "Content-Type: application/json" \ --data '{ "voice": "Sulafat", "prompt": "Read the following as a calm, warm audiobook narrator — unhurried, low, with a slight pause before the last clause: The harbour was still asleep when she cast off, and the only sound was the halyard tapping against the mast.", "language_code": "en-us" }') STATUS_URL=$(echo "$SUBMIT" | jq -r '.status_url') RESPONSE_URL=$(echo "$SUBMIT" | jq -r '.response_url') # 2. Poll until the request leaves the queue / in-progress state while true; do STATUS=$(curl --silent --url "$STATUS_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" | jq -r '.status') echo "Status: $STATUS" case "$STATUS" in COMPLETED) break ;; FAILED|CANCELLED) echo "Request $STATUS"; exit 1 ;; esac sleep 1 done # 3. Read the finished request, including the generated output curl --silent --url "$RESPONSE_URL" \ --header "Authorization: Key $MODEL_RUNNER_KEY" ``` ### JavaScript ```javascript import { modelrunner } from "@modelrunner/client"; const result = await modelrunner.subscribe("google/gemini-3.1-flash-tts", { input: { "voice": "Sulafat", "prompt": "Read the following as a calm, warm audiobook narrator — unhurried, low, with a slight pause before the last clause: The harbour was still asleep when she cast off, and the only sound was the halyard tapping against the mast.", "language_code": "en-us" } }); console.log(result.data); ``` ### Python ```python import asyncio import modelrunner_ai async def main(): response = await modelrunner_ai.submit_async( "google/gemini-3.1-flash-tts", arguments={ "voice": "Sulafat", "prompt": "Read the following as a calm, warm audiobook narrator — unhurried, low, with a slight pause before the last clause: The harbour was still asleep when she cast off, and the only sound was the halyard tapping against the mast.", "language_code": "en-us" } ) result = await response.get() print(result["output"]) asyncio.run(main()) ``` ## Additional Resources - [Playground](https://modelrunner.ai/models/google/gemini-3.1-flash-tts) - [OpenAPI Schema](https://modelrunner.ai/models/google/gemini-3.1-flash-tts/openapi.json) - [LLM Instructions](https://modelrunner.ai/models/google/gemini-3.1-flash-tts/llms.txt)