Google Gemini 3.8 Flash Text To Speech API Documentation

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 through style_instructions.

  • Single-speaker narration
    Generate voiceovers, narration, explanations, and other single-speaker speech.

  • Per-turn delivery control
    Dialogue turns can include their own style_instructions for different emotions or speaking styles.

  • WAV output
    Receive the generated speech as a downloadable WAV audio file.


Parameters

ParameterRequiredDescription
textConditionalText to speak for single-speaker generation. Supports up to 8000 characters. Omit when using dialogue mode.
voiceNoPreset voice for single-speaker speech. Default: Kore.
style_instructionsNoOptional natural-language instructions for tone, pacing, accent, emotion, or other delivery characteristics. Supports up to 2000 characters.
speakersConditionalDefine exactly 2 speakers with distinct speaker_id values and their selected voices.
turnsConditionalEach turn contains a speaker_id, text, and optional style_instructions.

How to Use

Single-Speaker Speech

  1. Enter the text — Provide the content you want spoken.
  2. Choose a voice optional — Select one of the available preset voices or keep the default Kore.
  3. Add style instructions optional — Describe the desired tone, pacing, accent, emotion, or delivery.
  4. Submit — Generate the speech and retrieve the WAV audio.

Two-Speaker Dialogue

  1. Configure two speakers — Define exactly two distinct speaker_id values and assign a voice to each.
  2. Create ordered turns — Add each speaker’s dialogue in the order it should be spoken.
  3. Add per-turn style optional — Give individual turns their own delivery instructions when needed.
  4. Add global style optional — Use style_instructions for overall delivery guidance.
  5. Submit — Generate the complete two-speaker dialogue as audio.

Pricing

Billable CharactersPrice
100$0.05
1,000$0.05
5,000$0.25

For single-speaker generation, billable characters include:

  • text
  • style_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 text or turns and put delivery directions in style_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_id used in turns has been configured in speakers.
  • 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.

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
done

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
textstringNo--Text to speak. For dialogue, leave text empty and provide speakers and turns. Delivery directions belong in style_instructions.
voicestringNoKoreAchernar, 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, ZubenelgenubiPrebuilt voice for single-speaker speech.

Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayOutput values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.statusstringTask status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses.
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction
data.modelstringModel ID used for the prediction
data.outputsarray<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.urlsobjectObject containing related API endpoints
data.statusstringStatus: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses
data.created_atstringISO timestamp of when the request was created
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2026 WaveSpeedAI. All rights reserved.