Skip to main content
POST
/
api
/
v1
/
lightning-v3.1
/
stream
Stream speech from text (Lightning V3.1)
curl --request POST \
  --url https://waves-api.smallest.ai/api/v1/lightning-v3.1/stream \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "<string>",
  "voice_id": "<string>",
  "sample_rate": 44100,
  "speed": 1,
  "language": "en",
  "output_format": "pcm",
  "pronunciation_dicts": [
    "<string>"
  ]
}
'
{
  "data": "event: chunk\ndata: <WAV_DATA>\ndone: false\n"
}

Overview

The Lightning v3.1 SSE API provides real-time text-to-speech streaming capabilities with natural, expressive voice synthesis. This API uses Server-Sent Events (SSE) to deliver audio chunks as they’re generated, enabling low-latency audio playback without waiting for the entire audio file to process. Lightning v3.1 is a 44 kHz model that produces natural, expressive, and realistic speech, with support for voice cloning.

When to Use

  • Interactive Applications: Perfect for chatbots, virtual assistants, and other applications requiring immediate voice responses
  • Long-Form Content: Efficiently stream audio for articles, stories, or other long-form content without buffering delays
  • Voice User Interfaces: Create natural-sounding voice interfaces with minimal perceived latency
  • Accessibility Solutions: Provide real-time audio versions of written content for users with visual impairments

How It Works

  1. Make a POST Request: Send your text and voice settings to the API endpoint
  2. Receive Audio Chunks: The API processes your text and streams audio back as base64-encoded chunks with 1024 byte size
  3. Process the Stream: Handle the SSE events to decode and play audio chunks sequentially
  4. End of Stream: The API sends a completion event when all audio has been delivered

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <api_key>, where <api_key> is your api key.

Body

application/json
text
string
required

The text to convert to speech.

voice_id
string
required

The voice identifier to use for speech generation.

sample_rate
enum<integer>
default:44100

The sample rate for the generated audio.

Available options:
8000,
16000,
24000,
44100
speed
number
default:1

The speed of the generated speech.

Required range: 0.5 <= x <= 2
language
enum<string>
default:en

Language code for speech synthesis (en, hi, ta, es, etc.).

Available options:
en,
hi,
ta,
es
output_format
enum<string>
default:pcm

The format of the output audio.

Available options:
pcm,
mp3,
wav,
mulaw
pronunciation_dicts
string[]

The IDs of the pronunciation dictionaries to use for speech generation.

The ID of the pronunciation dictionary to use for speech generation.

Response

Synthesized speech retrieved successfully.