# 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. ## Tổng quan - **Điểm cuối**: `POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts` - **Mã mẫu**: `gemini-3-8-flash-tts` - **Danh mục**: Âm thanh AI - **Biến thể**: 3.8 Flash - **Nhóm**: gemini-tts - **Chi phí**: 0.015 tín dụng cho mỗi cuộc gọi (một số mô hình tính toán chi phí linh hoạt dựa trên thông số) ## Sử dụng API MuApi sử dụng mẫu **gửi rồi thăm dò ý kiến**: gửi công việc, nhận `request_id`, sau đó thăm dò điểm cuối dự đoán cho đến khi `trạng thái` là `hoàn thành`. Tùy chọn chuyển `?webhook=YOUR_URL` trong lệnh gọi gửi để nhận lệnh gọi lại POST khi công việc kết thúc (bỏ qua bỏ phiếu). **Xác thực**: gửi khóa MuApi của bạn trong tiêu đề `x-api-key`. Nhận một cái tại https://muapi.ai/access-keys. ### 1. Gửi tác vụ ```http POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts Content-Type: application/json x-api-key: YOUR_API_KEY ``` **Tối thiểu (chỉ bắt buộc):** ```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." } ] } ``` **Ví dụ đầy đủ (tất cả các thông số):** ```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 } ``` **Phản hồi:** ```json { "request_id": "abc123", "status": "processing" } ``` ### 2. Kiểm tra kết quả ```http GET https://api.muapi.ai/api/v1/predictions/{request_id}/result x-api-key: YOUR_API_KEY ``` Các giá trị `trạng thái` có thể có: `được xếp hàng`, `đang chờ`, `đang xử lý`, `đã hoàn thành`, `không thành công`, `đã hủy`. Thăm dò ý kiến ​​cứ sau 2-5 giây cho đến khi kết thúc. Khi `hoàn thành`, các URL kết quả nằm trong mảng `đầu ra`. **Phản hồi ví dụ khi `hoàn thành`:** ```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. Gửi tác vụ 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. Thăm dò cho đến khi hoàn thành 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) ``` ## Lược đồ đầu vào API chấp nhận các tham số đầu vào sau: - **`speakers`** (`array`, _required_): 。 ID 。 - **`speakers[].speaker_id`** (`string`, _required_): 。 "Speaker N" ( "Speaker 1")。 - **`speakers[].voice_name`** (`string`, _required_): Gemini 。 - Tùy chọn: `"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`, _required_): 。 - Mặc định: `"Neutral"` - Tùy chọn: `"Neutral"`, `"American (Gen)"`, `"American (Valley)"`, `"American (South)"`, `"British (RP)"`, `"British (Brixton)"`, `"Transatlantic"`, `"Australian"` - **`speakers[].style`** (`string`, _required_): 。 - Mặc định: `"Empathetic"` - Tùy chọn: `"Vocal Smile"`, `"Newscaster"`, `"Whisper"`, `"Empathetic"`, `"Promo/Hype"`, `"Deadpan"` - **`speakers[].pace`** (`string`, _required_): 。 - Mặc định: `"Natural"` - Tùy chọn: `"Natural"`, `"Rapid Fire"`, `"The Drift"`, `"Staccato"` - **`dialogue_turns`** (`array`, _required_): 。 speaker_id 。 [shouting] [whispers] 。 - **`dialogue_turns[].speaker_id`** (`string`, _required_): ID( "Speaker 1")。 - **`dialogue_turns[].text`** (`string`, _required_): 。。 10000 。 - **`scene`** (`string`, _optional_): scene description that sets the acoustic setting, e.g. "A quiet, warm room with a fireplace crackling softly." - Mặc định: `""` - **`sample_context`** (`string`, _optional_): overall tone/style, e.g. "Audiobook style narration. Tone is gentle and inviting." - Mặc định: `""` - **`temperature`** (`number`, _optional_): (0-2)。,。 - Mặc định: `1` - Phạm vi: `0` to `2` ## Lược đồ đầu ra Điểm cuối bỏ phiếu trả về các trường sau: - **`id`** (`string`): ID yêu cầu. - **`status`** (`string`): Một trong số `xếp hàng`, `đang chờ xử lý`, `đang xử lý`, `đã hoàn thành`, `không thành công`, `đã hủy`. - **`outputs`** (`array`): URL tới hình ảnh/video/âm thanh được tạo. Để trống cho đến khi `trạng thái` được` hoàn thành`. - **`urls.get`** (`string`): Tự liên kết để tìm nạp lại dự đoán này. - **`error`** (`string` | `null`): Thông báo lỗi nếu `trạng thái` là `không thành công`. - **`created_at`** (`string`): Dấu thời gian ISO-8601 về thời điểm yêu cầu được tạo. - **`has_nsfw_contents`** (`array of boolean`): Cờ phát hiện NSFW trên mỗi đầu ra. ## Webhooks (tùy chọn) Nối `?webhook=https://your-server/path` vào URL gửi. Khi công việc đạt đến trạng thái cuối, MuApi sẽ ĐĂNG hình dạng giống như phản hồi bỏ phiếu cho URL của bạn - không cần bỏ phiếu. ## Tích hợp đại lý MuApi gửi máy chủ MCP và CLI để các đại lý (Mã Claude, Con trỏ, tùy chỉnh) có thể gọi điểm cuối này mà không cần viết mã HTTP: ```bash # Cài đặt CLI npm install -g muapi-cli # Xác thực một lần muapi auth login # Hiển thị tất cả các mô hình MuApi dưới dạng công cụ MCP cho đại lý của bạn muapi mcp serve ``` Máy chủ MCP hiển thị các công cụ bao gồm việc gửi + thăm dò ý kiến cho mọi mô hình, bao gồm cả `gemini-3-8-flash-tts`. Xem `muapi --help` để biết các phím tắt dành riêng cho danh mục (`tạo hình ảnh muaapi`, `muapi video từ hình ảnh`, v.v.). ## Mô hình liên quan - [3.1 Flash](https://muapi.ai/vi/playground/gemini-3-1-flash-tts) - [2.5 Pro](https://muapi.ai/vi/playground/gemini-2-5-pro-tts) - [3.8 Flash Lite](https://muapi.ai/vi/playground/gemini-3-8-flash-lite-tts) - [3.8 Flash](https://muapi.ai/vi/playground/gemini-3-8-flash-tts) ## Tài nguyên - [Trang sân chơi](https://muapi.ai/vi/playground/gemini-3-8-flash-tts) - [Tham khảo API](https://muapi.ai/vi/playground/gemini-3-8-flash-tts/api) - [llms.txt toàn cầu](https://muapi.ai/vi/llms.txt)