# 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. ## Visão geral - **Ponto final**: `POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts` - **ID do modelo**: `gemini-3-8-flash-tts` - **Categoria**: Áudio por IA - **Variante**: 3.8 Flash - **Família**: gemini-tts - **Custo**: 0.015 créditos por chamada (alguns modelos calculam o custo dinamicamente com base em parâmetros) ## Uso de API MuApi usa um padrão **submit-then-poll**: envie um trabalho, obtenha um `request_id` e, em seguida, pesquise o endpoint de previsões até que o `status` seja `concluído`. Opcionalmente, passe `?webhook=YOUR_URL` na chamada de envio para receber um retorno de chamada POST quando o trabalho terminar (ignorar a pesquisa). **Autenticação**: envie sua chave MuApi no cabeçalho `x-api-key`. Obtenha um em https://muapi.ai/access-keys. ### 1. Envie um trabalho ```http POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts Content-Type: application/json x-api-key: YOUR_API_KEY ``` **Mínimo (somente obrigatório):** ```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." } ] } ``` **Exemplo completo (todos os parâmetros):** ```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 } ``` **Resposta:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. Enquete para o resultado ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` Possíveis valores de `status`: `queued`, `pending`, `processing`, `completed`, `failed`, `cancelled`. Pesquise a cada 2-5 segundos até o terminal. Quando `concluído`, os URLs de resultado estarão na matriz `outputs`. **Exemplo de resposta quando `concluído`:** ```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. Enviar 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. Consultar até a conclusão 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) ``` ## Esquema de entrada A API aceita os seguintes parâmetros de entrada: - **`speakers`** (`array`, _obrigatório_): . EU IA . - **`speakers[].speaker_id`** (`string`, _obrigatório_): . "Alto-falante N" ("Alto-falante 1"). - **`speakers[].voice_name`** (`string`, _obrigatório_): Gêmeos. - Opções: `"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`, _opcional_): Optional natural-language description of the persona, e.g. "A warm and soothing narrator". - **`speakers[].accent`** (`string`, _obrigatório_): . - Padrão: `"Neutral"` - Opções: `"Neutral"`, `"American (Gen)"`, `"American (Valley)"`, `"American (South)"`, `"British (RP)"`, `"British (Brixton)"`, `"Transatlantic"`, `"Australian"` - **`speakers[].style`** (`string`, _obrigatório_): . - Padrão: `"Empathetic"` - Opções: `"Vocal Smile"`, `"Newscaster"`, `"Whisper"`, `"Empathetic"`, `"Promo/Hype"`, `"Deadpan"` - **`speakers[].pace`** (`string`, _obrigatório_): . - Padrão: `"Natural"` - Opções: `"Natural"`, `"Rapid Fire"`, `"The Drift"`, `"Staccato"` - **`dialogue_turns`** (`array`, _obrigatório_): . alto-falante_id. [gritando] [sussurrando] . - **`dialogue_turns[].speaker_id`** (`string`, _obrigatório_): ID("Alto-falante 1"). - **`dialogue_turns[].text`** (`string`, _obrigatório_): . compatível com. 10.000. - **`scene`** (`string`, _opcional_): Optional scene description that sets the acoustic setting, e.g. "A quiet, warm room with a fireplace crackling softly." - Padrão: `""` - **`sample_context`** (`string`, _opcional_): Optional overall tone/style, e.g. "Audiobook style narration. Tone is gentle and inviting." - Padrão: `""` - **`temperature`** (`number`, _opcional_): (0-2) . , . - Padrão: `1` - Intervalo: `0` to `2` ## Esquema de saída O endpoint de consulta retorna os seguintes campos: - **`id`** (`string`): O ID da solicitação. - **`status`** (`string`): Um entre `queued`, `pending`, `processing`, `completed`, `failed`, `cancelled`. - **`outputs`** (`array`): URLs para imagens/vídeos/áudio gerados. Vazio até que `status` seja `completed`. - **`urls.get`** (`string`): Auto-link para buscar novamente esta previsão. - **`error`** (`string` | `null`): Mensagem de erro se `status` for `failed`. - **`created_at`** (`string`): Carimbo de data/hora ISO-8601 de quando a solicitação foi criada. - **`has_nsfw_contents`** (`array of boolean`): Sinalizadores de detecção NSFW por saída. ## Webhooks (opcional) Anexe `?webhook=https://your-server/path` ao URL de envio. Quando a tarefa atingir um estado terminal, o MuApi enviará uma solicitação POST com o mesmo formato da resposta de consulta ao seu URL – sem necessidade de consulta manual. ## Integração de Agente O MuApi fornece um servidor MCP e CLI para que agentes (Claude Code, Cursor, personalizados) possam chamar este endpoint sem escrever código HTTP: ```bash # Instalar a CLI npm install -g muapi-cli # Autenticar uma vez muapi auth login # Exponha todos os modelos Muapi como ferramentas MCP para seu agente muapi mcp serve ``` O servidor MCP expõe ferramentas que envolvem envio + pesquisa para cada modelo, incluindo `gemini-3-8-flash-tts`. Veja `muapi --help` para atalhos específicos da categoria (`muapi image generate`, `muapi video from-image`, etc.). ## Modelos Relacionados - [3.1 Flash](https://muapi.ai/pt/playground/gemini-3-1-flash-tts) - [2.5 Pro](https://muapi.ai/pt/playground/gemini-2-5-pro-tts) - [3.8 Flash Lite](https://muapi.ai/pt/playground/gemini-3-8-flash-lite-tts) - [3.8 Flash](https://muapi.ai/pt/playground/gemini-3-8-flash-tts) ## Recursos - [Página do Playground](https://muapi.ai/pt/playground/gemini-3-8-flash-tts) - [Referência de API](https://muapi.ai/pt/playground/gemini-3-8-flash-tts/api) - [Llms.txt global](https://muapi.ai/pt/llms.txt)