# 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. ## Przegląd - **Punkt końcowy**: `POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts` - **Identyfikator modelu**: `gemini-3-8-flash-tts` - **Kategoria**: Dźwięk AI - **Wariant**: 3.8 Flash - **Rodzina**: gemini-tts - **Koszt**: 0.015 kredytów na połączenie (niektóre modele obliczają koszt dynamicznie na podstawie parametrów) ## Użycie API MuApi używa wzorca **prześlij, a następnie odpytuj**: prześlij zadanie, pobierz `request_id`, następnie odpytuj punkt końcowy przewidywań, aż `status` zostanie ukończony. Opcjonalnie przekaż `?webhook=TWÓJ_URL` w wywołaniu wysyłania, aby otrzymać wywołanie zwrotne POST po zakończeniu zadania (pomiń odpytywanie). **Uwierzytelnianie**: wyślij swój klucz MuApi w nagłówku `x-api-key`. Kup jeden w https://muapi.ai/access-keys. ### 1. Prześlij ofertę pracy ```http POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts Content-Type: application/json x-api-key: YOUR_API_KEY ``` **Minimalne (tylko wymagane):** ```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." } ] } ``` **Pełny przykład (wszystkie parametry):** ```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 } ``` **Odpowiedź:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. Sonda o wynik ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` Możliwe wartości „statusu”: „w kolejce”, „oczekuje”, „przetwarzanie”, „ukończone”, „nie powiodło się”, „anulowane”. Odpytuj co 2-5 sekund aż do terminala. Po zakończeniu wynikowe adresy URL znajdują się w tablicy „outputs”. **Przykładowa odpowiedź po „ukończeniu”:** ```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": [] } ``` ### ZWIŃ ```bash 1. Prześlij 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. Ankieta do zakończenia 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 ``` ### Pyton ```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) ``` ## Schemat wejściowy API akceptuje następujące parametry wejściowe: - **`speakers`** (`array`, _required_): . Identyfikator . - **`speakers[].speaker_id`** (`string`, _required_): . „Głośnik N” („Głośnik 1”). - **`speakers[].voice_name`** (`string`, _required_): Bliźnięta. - Opcje: `"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_): dla przepływów pracy żądań/ankiet i zdarzeń wysyłanych przez serwer - Domyślne: `"Neutral"` - Opcje: `"Neutral"`, `"American (Gen)"`, `"American (Valley)"`, `"American (South)"`, `"British (RP)"`, `"British (Brixton)"`, `"Transatlantic"`, `"Australian"` - **`speakers[].style`** (`string`, _required_): dla przepływów pracy żądań/ankiet i zdarzeń wysyłanych przez serwer - Domyślne: `"Empathetic"` - Opcje: `"Vocal Smile"`, `"Newscaster"`, `"Whisper"`, `"Empathetic"`, `"Promo/Hype"`, `"Deadpan"` - **`speakers[].pace`** (`string`, _required_): dla przepływów pracy żądań/ankiet i zdarzeń wysyłanych przez serwer - Domyślne: `"Natural"` - Opcje: `"Natural"`, `"Rapid Fire"`, `"The Drift"`, `"Staccato"` - **`dialogue_turns`** (`array`, _required_): . identyfikator_głośnika. [krzyczy] [szepcze] . - **`dialogue_turns[].speaker_id`** (`string`, _required_): ID („Głośnik 1”). - **`dialogue_turns[].text`** (`string`, _required_): . kompatybilny z. 10000 . - **`scene`** (`string`, _optional_): Optional scene description that sets the acoustic setting, e.g. "A quiet, warm room with a fireplace crackling softly." - Domyślne: `""` - **`sample_context`** (`string`, _optional_): Optional overall tone/style, e.g. "Audiobook style narration. Tone is gentle and inviting." - Domyślne: `""` - **`temperature`** (`number`, _optional_): (0-2) . , . - Domyślne: `1` - Zasięg: `0` to `2` ## Schemat wyjściowy Punkt końcowy odpytywania zwraca następujące pola: - **`id`** (`string`): Identyfikator żądania. - **`status`** (`string`): Jedna z opcji: „w kolejce”, „oczekująca”, „przetwarzana”, „ukończona”, „nie powiodła się”, „anulowana”. - **`outputs`** (`array`): Adresy URL wygenerowanych obrazów/filmów/audio. Puste, dopóki „status” nie zostanie „ukończony”. - **`urls.get`** (`string`): Self-link, aby ponownie pobrać tę prognozę. - **`error`** (`string` | `null`): Komunikat o błędzie, jeśli „status” to „niepowodzenie”. - **`created_at`** (`string`): Sygnatura czasowa ISO-8601 określająca moment utworzenia żądania. - **`has_nsfw_contents`** (`array of boolean`): Flagi wykrywania NSFW na wyjściu. ## Webhooki (opcjonalnie) Dołącz „?webhook=https://twój-serwer/ścieżka” do adresu URL przesyłania. Gdy zadanie osiągnie stan końcowy, MuApi wyśle ​​ten sam kształt, co odpowiedź na odpytywanie na Twój adres URL – bez konieczności odpytywania. ## Integracja agenta MuApi dostarcza serwer MCP i CLI, dzięki czemu agenci (Kod Claude, Kursor, niestandardowy) mogą wywoływać ten punkt końcowy bez pisania kodu HTTP: ```bash # Zainstaluj interfejs wiersza polecenia npm install -g muapi-cli # Authenticate once muapi auth login # Pokaż swojemu agentowi wszystkie modele MuApi jako narzędzia MCP muapi mcp serve ``` Serwer MCP udostępnia narzędzia, które obejmują przesyłanie i ankietę dla każdego modelu, w tym `gemini-3-8-flash-tts`. Zobacz `muapi --help`, aby zapoznać się ze skrótami specyficznymi dla kategorii („generowanie obrazu muapi”, „muapi wideo z obrazu” itp.). ## Powiązane modele - [3.1 Flash](https://muapi.ai/pl/playground/gemini-3-1-flash-tts) - [2.5 Pro](https://muapi.ai/pl/playground/gemini-2-5-pro-tts) - [3.8 Flash Lite](https://muapi.ai/pl/playground/gemini-3-8-flash-lite-tts) - [3.8 Flash](https://muapi.ai/pl/playground/gemini-3-8-flash-tts) ## Zasoby - [Strona placu zabaw](https://muapi.ai/pl/playground/gemini-3-8-flash-tts) - [Dokumentacja API](https://muapi.ai/pl/playground/gemini-3-8-flash-tts/api) - [Globalny plik llms.txt](https://muapi.ai/pl/llms.txt)