Google Gemini 3.8 Flash Text To Speech API Documentation
Playground
Try it on WaveSpeedAI!Gemini 3.8 Flash Text-to-Speech generates expressive speech from text with configurable voice and delivery-style controls for narration, dialogue, localization, virtual assistants, and voice production workflows. Ready-to-use REST inference API, best performance, no coldstarts, affordable pricing.
Features
Gemini 3.8 Flash Text-to-Speech generates expressive speech from text with 30 preset voices and natural-language control over delivery. Use style instructions to guide tone, pacing, accent, and emotion without embedding delivery directions into the spoken text.
The endpoint supports both standard single-speaker narration and API-based two-speaker dialogue, making it suitable for voiceovers, conversations, character dialogue, narration, and other speech-generation workflows.
Why Choose This?
-
Expressive text-to-speech
Generate natural speech from text with control over tone, pacing, accent, and emotional delivery. -
30 preset voices
Choose from a broad set of built-in voices for different narration and character styles. -
Natural-language style control
Describe how the speech should be delivered throughstyle_instructions. -
Single-speaker narration
Generate voiceovers, narration, explanations, and other single-speaker speech. -
Per-turn delivery control
Dialogue turns can include their ownstyle_instructionsfor different emotions or speaking styles. -
WAV output
Receive the generated speech as a downloadable WAV audio file.
Parameters
| Parameter | Required | Description |
|---|---|---|
| text | Conditional | Text to speak for single-speaker generation. Supports up to 8000 characters. Omit when using dialogue mode. |
| voice | No | Preset voice for single-speaker speech. Default: Kore. |
| style_instructions | No | Optional natural-language instructions for tone, pacing, accent, emotion, or other delivery characteristics. Supports up to 2000 characters. |
| speakers | Conditional | Define exactly 2 speakers with distinct speaker_id values and their selected voices. |
| turns | Conditional | Each turn contains a speaker_id, text, and optional style_instructions. |
How to Use
Single-Speaker Speech
- Enter the text — Provide the content you want spoken.
- Choose a voice optional — Select one of the available preset voices or keep the default
Kore. - Add style instructions optional — Describe the desired tone, pacing, accent, emotion, or delivery.
- Submit — Generate the speech and retrieve the WAV audio.
Two-Speaker Dialogue
- Configure two speakers — Define exactly two distinct
speaker_idvalues and assign a voice to each. - Create ordered turns — Add each speaker’s dialogue in the order it should be spoken.
- Add per-turn style optional — Give individual turns their own delivery instructions when needed.
- Add global style optional — Use
style_instructionsfor overall delivery guidance. - Submit — Generate the complete two-speaker dialogue as audio.
Pricing
| Billable Characters | Price |
|---|---|
| 100 | $0.05 |
| 1,000 | $0.05 |
| 5,000 | $0.25 |
For single-speaker generation, billable characters include:
textstyle_instructions
For dialogue generation, billable characters include:
- Text from all
turns - Per-turn
style_instructions - Global
style_instructions
Best Use Cases
- Narration and voiceovers — Generate expressive speech for videos, presentations, explainers, and other media.
- Two-speaker conversations — Create API-driven dialogue between two configured voices.
- Character dialogue — Give different speakers distinct voices and delivery styles.
- Audiobook and storytelling workflows — Control pacing, emotion, and narration style through natural-language instructions.
- Educational content — Generate clear spoken explanations, lessons, and instructional audio.
- Localized voice content — Guide accent, tone, and delivery through style instructions.
- Conversational prototypes — Create spoken interactions for assistants, characters, demos, and dialogue experiences.
Pro Tips
- Keep the spoken content in
textorturnsand put delivery directions instyle_instructions. - Use short, specific style instructions for more consistent delivery.
- Describe concrete characteristics such as pace, emotional tone, energy, or accent instead of vague style requests.
- In dialogue mode, make sure every
speaker_idused inturnshas been configured inspeakers. - Use per-turn style instructions when a speaker’s emotion or delivery changes during the conversation.
- Keep the total request within the
8192-token input limit. - Inline vocal events such as
<laugh>or<sigh>can be used when they are part of the intended performance.
Related Models
- Gemini 3.8 Flash Lite Text-to-Speech — Generate speech with the lighter Gemini 3.8 Flash Lite text-to-speech endpoint.
- Gemini 3.8 Flash Text-to-Speech — Generate expressive single-speaker or two-speaker speech with preset voices and natural-language delivery control.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
set -euo pipefail
export WAVESPEED_API_KEY="your-api-key"
REQUEST_BODY=$(cat <<'JSON'
{
"voice": "Kore"
}
JSON
)
# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
-X POST "https://api.wavespeed.ai/api/v3/google/gemini-3.8-flash/text-to-speech" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}")
TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
printf 'Submission response did not contain a prediction id
' >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"
# 2. Poll until the prediction finishes.
while true; do
RESPONSE=$(curl --silent --show-error --fail-with-body \
"${RESULT_URL}" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}")
RESULT=$(printf '%s' "${RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')
case "${STATUS}" in
completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted) printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneParameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| text | string | No | - | - | Text to speak. For dialogue, leave text empty and provide speakers and turns. Delivery directions belong in style_instructions. |
| voice | string | No | Kore | 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 | Prebuilt voice for single-speaker speech. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Task status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses. |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<string | object> | Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model. |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Status: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |