# Gemini 3.8 Flash TTS > Generate expressive multi-speaker speech with Gemini 3.8 Flash TTS. Studio-grade voice fidelity and long-form stability. Try free, pay per use. ## Panoramica - **Endpoint**: `POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts` - **ID modello**: `gemini-3-8-flash-tts` - **Categoria**: Audio AI - **Variante**: 3.8 Flash - **Famiglia**: gemini-tts - **Costo**: 0.015 crediti per chiamata (alcuni modelli calcolano il costo dinamicamente in base ai parametri) ## Utilizzo dell'API MuApi utilizza un modello **submit-then-poll**: invia un lavoro, ottieni un `request_id`, quindi esegui il polling dell'endpoint delle previsioni finché lo `status` non è `completed`. Facoltativamente, passa `?webhook=YOUR_URL` sulla chiamata di invio per ricevere una richiamata POST al termine del lavoro (salta il polling). **Autenticazione**: invia la tua chiave MuApi nell'intestazione `x-api-key`. Prendine uno alle https://muapi.ai/access-keys. ### 1. Invia attività ```http POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts Content-Type: application/json x-api-key: YOUR_API_KEY ``` **Minimo (solo obbligatorio):** ```json { "speakers": [ { "speaker_id": "Speaker 1", "voice_name": "Fenrir", "audio_profile": "A stern and weary gatekeeper", "accent": "British (RP)", "style": "Deadpan", "pace": "Natural" }, { "speaker_id": "Speaker 2", "voice_name": "Puck", "audio_profile": "A determined and courageous traveler seeking answers.", "accent": "American (Gen)", "style": "Empathetic", "pace": "Staccato" } ], "dialogue_turns": [ { "speaker_id": "Speaker 1", "text": "[shouting] Halt, traveler! The northern pass is sealed by order of the council." }, { "speaker_id": "Speaker 2", "text": "[determination] I carry a message for the elder. Step aside, or I will force my way through." }, { "speaker_id": "Speaker 1", "text": "[caution] No one passes. [pensive] The elder is... he's no longer receiving visitors." }, { "speaker_id": "Speaker 2", "text": "It's too late. [whispers] The shadow... it reached him first. [urgency] You need to leave. [shouting] Now." } ] } ``` **Esempio completo (tutti i parametri):** ```json { "speakers": [ { "speaker_id": "Speaker 1", "voice_name": "Fenrir", "audio_profile": "A stern and weary gatekeeper", "accent": "British (RP)", "style": "Deadpan", "pace": "Natural" }, { "speaker_id": "Speaker 2", "voice_name": "Puck", "audio_profile": "A determined and courageous traveler seeking answers.", "accent": "American (Gen)", "style": "Empathetic", "pace": "Staccato" } ], "dialogue_turns": [ { "speaker_id": "Speaker 1", "text": "[shouting] Halt, traveler! The northern pass is sealed by order of the council." }, { "speaker_id": "Speaker 2", "text": "[determination] I carry a message for the elder. Step aside, or I will force my way through." }, { "speaker_id": "Speaker 1", "text": "[caution] No one passes. [pensive] The elder is... he's no longer receiving visitors." }, { "speaker_id": "Speaker 2", "text": "It's too late. [whispers] The shadow... it reached him first. [urgency] You need to leave. [shouting] Now." } ], "scene": "", "sample_context": "", "temperature": 1 } ``` **Risposta:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. Controlla risultato ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` Possibili valori di "status": "queued", "pending", "processing", "completed", "failed", "cancelled". Sondaggio ogni 2-5 secondi fino al terminale. Una volta "completato", gli URL dei risultati si trovano nell'array "outputs". **Esempio di risposta al completamento:** ```json { "id": "abc123", "status": "completed", "outputs": [ "https://cdn.muapi.ai/.../output.png" ], "urls": { "get": "https://api.muapi.ai/api/v1/predictions/abc123/result" }, "created_at": "2026-05-08T12:34:56Z", "has_nsfw_contents": [] } ``` ### cURL ```bash 1. Invia attività REQUEST_ID=$(curl -s -X POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts \ -H "x-api-key: $MUAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"speakers":[{"speaker_id":"Speaker 1","voice_name":"Fenrir","audio_profile":"A stern and weary gatekeeper","accent":"British (RP)","style":"Deadpan","pace":"Natural"},{"speaker_id":"Speaker 2","voice_name":"Puck","audio_profile":"A determined and courageous traveler seeking answers.","accent":"American (Gen)","style":"Empathetic","pace":"Staccato"}],"dialogue_turns":[{"speaker_id":"Speaker 1","text":"[shouting] Halt, traveler! The northern pass is sealed by order of the council."},{"speaker_id":"Speaker 2","text":"[determination] I carry a message for the elder. Step aside, or I will force my way through."},{"speaker_id":"Speaker 1","text":"[caution] No one passes. [pensive] The elder is... he's no longer receiving visitors."},{"speaker_id":"Speaker 2","text":"It's too late. [whispers] The shadow... it reached him first. [urgency] You need to leave. [shouting] Now."}]}' | jq -r .request_id) 2. Controlla fino al completamento while :; do RESP=$(curl -s https://api.muapi.ai/api/v1/predictions/$REQUEST_ID/result -H "x-api-key: $MUAPI_API_KEY") STATUS=$(echo "$RESP" | jq -r .status) [ "$STATUS" = "completed" ] && echo "$RESP" | jq .outputs && break [ "$STATUS" = "failed" ] && echo "$RESP" && exit 1 sleep 3 done ``` ### Python ```python import os, time, requests API = "https://api.muapi.ai/api/v1" headers = {"x-api-key": os.environ["MUAPI_API_KEY"]} r = requests.post(f"{API}/gemini-3-8-flash-tts", headers=headers, json={"speakers":[{"speaker_id":"Speaker 1","voice_name":"Fenrir","audio_profile":"A stern and weary gatekeeper","accent":"British (RP)","style":"Deadpan","pace":"Natural"},{"speaker_id":"Speaker 2","voice_name":"Puck","audio_profile":"A determined and courageous traveler seeking answers.","accent":"American (Gen)","style":"Empathetic","pace":"Staccato"}],"dialogue_turns":[{"speaker_id":"Speaker 1","text":"[shouting] Halt, traveler! The northern pass is sealed by order of the council."},{"speaker_id":"Speaker 2","text":"[determination] I carry a message for the elder. Step aside, or I will force my way through."},{"speaker_id":"Speaker 1","text":"[caution] No one passes. [pensive] The elder is... he's no longer receiving visitors."},{"speaker_id":"Speaker 2","text":"It's too late. [whispers] The shadow... it reached him first. [urgency] You need to leave. [shouting] Now."}]}) request_id = r.json()["request_id"] while True: res = requests.get(f"{API}/predictions/{request_id}/result", headers=headers).json() if res["status"] == "completed": print(res["outputs"]); break if res["status"] == "failed": raise RuntimeError(res.get("error")); time.sleep(3) ``` ## Schema di input L'API accetta i seguenti parametri di input: - **`speakers`** (`array`, _required_): . ID . - **`speakers[].speaker_id`** (`string`, _required_): . "Altoparlante N" ("Altoparlante 1"). - **`speakers[].voice_name`** (`string`, _required_): Gemelli. - Opzioni: `"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"` - **`speakers[].audio_profile`** (`string`, _optional_): Optional natural-language description of the persona, e.g. "A warm and soothing narrator". - **`speakers[].accent`** (`string`, _required_): . - Predefinito: `"Neutral"` - Opzioni: `"Neutral"`, `"American (Gen)"`, `"American (Valley)"`, `"American (South)"`, `"British (RP)"`, `"British (Brixton)"`, `"Transatlantic"`, `"Australian"` - **`speakers[].style`** (`string`, _required_): . - Predefinito: `"Empathetic"` - Opzioni: `"Vocal Smile"`, `"Newscaster"`, `"Whisper"`, `"Empathetic"`, `"Promo/Hype"`, `"Deadpan"` - **`speakers[].pace`** (`string`, _required_): . - Predefinito: `"Natural"` - Opzioni: `"Natural"`, `"Rapid Fire"`, `"The Drift"`, `"Staccato"` - **`dialogue_turns`** (`array`, _required_): . id_altoparlante. [gridando] [sussurrando] . - **`dialogue_turns[].speaker_id`** (`string`, _required_): ID ("Altoparlante 1") . - **`dialogue_turns[].text`** (`string`, _required_): . compatibile con. 10000 . - **`scene`** (`string`, _optional_): Optional scene description that sets the acoustic setting, e.g. "A quiet, warm room with a fireplace crackling softly." - Predefinito: `""` - **`sample_context`** (`string`, _optional_): Optional overall tone/style, e.g. "Audiobook style narration. Tone is gentle and inviting." - Predefinito: `""` - **`temperature`** (`number`, _optional_): (0-2) . , . - Predefinito: `1` - Gamma: `0` to `2` ## Schema di uscita L'endpoint del polling restituisce i seguenti campi: - **`id`** (`string`): L'ID della richiesta. - **`status`** (`string`): Uno tra "in coda", "in sospeso", "in elaborazione", "completato", "non riuscito", "annullato". - **`outputs`** (`array`): URL alle immagini/video/audio generati. Vuoto finché lo "stato" non è "completato". - **`urls.get`** (`string`): Collegamento automatico per recuperare questa previsione. - **`error`** (`string` | `null`): Messaggio di errore se lo "status" è "failed". - **`created_at`** (`string`): Timestamp ISO-8601 di quando è stata creata la richiesta. - **`has_nsfw_contents`** (`array of boolean`): Flag di rilevamento NSFW per uscita. ## Webhook (facoltativo) Aggiungi `?webhook=https://your-server/path` all'URL di invio. Quando il lavoro raggiunge uno stato terminale, MuApi pubblicherà la stessa forma della risposta al polling al tuo URL, senza bisogno di polling. ## Integrazione dell'agente MuApi fornisce un server MCP e una CLI in modo che gli agenti (Claude Code, Cursor, personalizzato) possano chiamare questo endpoint senza scrivere codice HTTP: ```bash # Installa la CLI npm install -g muapi-cli # Autenticati una volta muapi auth login # Esponi tutti i modelli MuApi come strumenti MCP al tuo agente muapi mcp serve ``` Il server MCP espone strumenti che racchiudono invio e sondaggio per ogni modello, incluso "gemini-3-8-flash-tts". Vedi `muapi --help` per le scorciatoie specifiche della categoria ("muapi image generate`, `muapi video from-image`, ecc.). ## Modelli correlati - [3.1 Flash](https://muapi.ai/it/playground/gemini-3-1-flash-tts) - [2.5 Pro](https://muapi.ai/it/playground/gemini-2-5-pro-tts) - [3.8 Flash Lite](https://muapi.ai/it/playground/gemini-3-8-flash-lite-tts) - [3.8 Flash](https://muapi.ai/it/playground/gemini-3-8-flash-tts) ## Risorse - [Pagina del parco giochi](https://muapi.ai/it/playground/gemini-3-8-flash-tts) - [Riferimento API](https://muapi.ai/it/playground/gemini-3-8-flash-tts/api) - [Global llms.txt](https://muapi.ai/it/llms.txt)