# 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. ## 概要 - **エンドポイント**: `POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts` - **モデルID**: `gemini-3-8-flash-tts` - **カテゴリー**: AI音声 - **バリアント**: 3.8 Flash - **ファミリー**: gemini-tts - **費用**: 1回あたり 0.015 クレジット(パラメータにより動的計算されるモデルもあります) ## API利用方法 MuApiは**送信後ポーリング(submit-then-poll)**パターンを採用しています。タスクを送信して`request_id`を取得し、ステータスが`completed`になるまで予測エンドポイントをポーリングします。送信時に`?webhook=YOUR_URL`を指定すると完了時にPOSTコールバックを受け取れます(ポーリング不要)。 **認証**: `x-api-key`ヘッダーにMuApiキーを送信してください。取得先: https://muapi.ai/access-keys ### 1. タスクの送信 ```http POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts Content-Type: application/json x-api-key: YOUR_API_KEY ``` **最小構成(必須パラメータのみ):** ```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." } ] } ``` **完全な例(全パラメータ):** ```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 } ``` **レスポンス:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. 結果のポーリング ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` 指定可能な`status`値: `queued`, `pending`, `processing`, `completed`, `failed`, `cancelled`。完了するまで2〜5秒ごとにポーリングしてください。`completed`になると`outputs`配列に生成URLが格納されます。 **`completed`時のレスポンス例:** ```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. 送信 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. 完了までポーリング 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) ``` ## 入力スキーマ APIは以下の入力パラメータを受け付けます: - **`speakers`** (`array`, _必須_): 音声合成で使用する話者または声のキャラクター識別子。 - **`speakers[].speaker_id`** (`string`, _必須_): 出力ファイルの保存形式(例:mp4、png、jpg、webpなど)。 - **`speakers[].voice_name`** (`string`, _必須_): 音声合成で使用する話者または声のキャラクター識別子。 - 選択肢: `"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 natural-language description of the persona, e.g. "A warm and soothing narrator". - **`speakers[].accent`** (`string`, _必須_): 生成プロセスを適切に制御するためのパラメータ設定(Speaking accent.)。 - デフォルト: `"Neutral"` - 選択肢: `"Neutral"`, `"American (Gen)"`, `"American (Valley)"`, `"American (South)"`, `"British (RP)"`, `"British (Brixton)"`, `"Transatlantic"`, `"Australian"` - **`speakers[].style`** (`string`, _必須_): 生成プロセスを適切に制御するためのパラメータ設定(Emotional delivery style.)。 - デフォルト: `"Empathetic"` - 選択肢: `"Vocal Smile"`, `"Newscaster"`, `"Whisper"`, `"Empathetic"`, `"Promo/Hype"`, `"Deadpan"` - **`speakers[].pace`** (`string`, _必須_): 生成プロセスを適切に制御するためのパラメータ設定(Speaking pace.)。 - デフォルト: `"Natural"` - 選択肢: `"Natural"`, `"Rapid Fire"`, `"The Drift"`, `"Staccato"` - **`dialogue_turns`** (`array`, _必須_): 音声合成で使用する話者または声のキャラクター識別子。 - **`dialogue_turns[].speaker_id`** (`string`, _必須_): 音声合成で使用する話者または声のキャラクター識別子。 - **`dialogue_turns[].text`** (`string`, _必須_): 生成プロセスを適切に制御するためのパラメータ設定(The line to speak. Supports inline tone tags. Max )。 - **`scene`** (`string`, _任意_): Optional scene description that sets the acoustic setting, e.g. "A quiet, warm room with a fireplace crackling softly." - デフォルト: `""` - **`sample_context`** (`string`, _任意_): Optional overall tone/style, e.g. "Audiobook style narration. Tone is gentle and inviting." - デフォルト: `""` - **`temperature`** (`number`, _任意_): サンプリングのランダム性を制御する温度パラメータ。高い値ほど創造的な出力になります。 - デフォルト: `1` - 範囲: `0` to `2` ## 出力スキーマ ポーリングエンドポイントは以下のフィールドを返します: - **`id`** (`string`): リクエストID。 - **`status`** (`string`): `queued`, `pending`, `processing`, `completed`, `failed`, `cancelled`のいずれか。 - **`outputs`** (`array`): 生成された画像・動画・音声のURL。`status`が`completed`になるまでは空配列です。 - **`urls.get`** (`string`): この予測結果を再取得するためのセルフリンク。 - **`error`** (`string` | `null`): `status`が`failed`の場合のエラーメッセージ。 - **`created_at`** (`string`): リクエスト作成日時のISO-8601タイムスタンプ。 - **`has_nsfw_contents`** (`array of boolean`): 出力ごとのNSFW検出フラグ。 ## Webhook(任意) 送信先URLに`?webhook=https://your-server/path`を追加してください。タスクが完了状態に達すると、MuApiはポーリングレスポンスと同じ形式を対象URLにPOST送信します(ポーリング不要)。 ## エージェント連携 MuApiはMCPサーバーとCLIを提供しており、エージェント(Claude Code、Cursor、カスタムエージェント等)がHTTPコードを書かずにこのエンドポイントを呼び出せます: ```bash # CLIのインストール npm install -g muapi-cli # 初回認証 muapi auth login # すべてのMuApiモデルをMCPツールとしてエージェントに公開 muapi mcp serve ``` MCPサーバーは`gemini-3-8-flash-tts`を含むすべてのモデルの送信+ポーリングをラップしたツールを公開します。カテゴリー別のショートカットについては`muapi --help`を参照してください(`muapi image generate`、`muapi video from-image`など)。 ## 関連モデル - [3.1 Flash](https://muapi.ai/ja/playground/gemini-3-1-flash-tts) - [2.5 Pro](https://muapi.ai/ja/playground/gemini-2-5-pro-tts) - [3.8 Flash Lite](https://muapi.ai/ja/playground/gemini-3-8-flash-lite-tts) - [3.8 Flash](https://muapi.ai/ja/playground/gemini-3-8-flash-tts) ## リソース - [Playgroundページ](https://muapi.ai/ja/playground/gemini-3-8-flash-tts) - [APIリファレンス](https://muapi.ai/ja/playground/gemini-3-8-flash-tts/api) - [全体llms.txt](https://muapi.ai/ja/llms.txt)