POST
/
api
/
v1
/
lightning-large
/
stream
curl --request POST \
  --url https://waves-api.smallest.ai/api/v1/lightning-large/stream \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "text": "<string>",
  "voice_id": "<string>",
  "add_wav_header": false,
  "sample_rate": 24000,
  "speed": 1,
  "language": "en",
  "consistency": 0.5,
  "similarity": 0,
  "enhancement": 1
}'
{
  "data": "event: chunk\ndata: <WAV_DATA>\ndone: false\n"
}

Overview

The Lightning-Large SSE API provides real-time text-to-speech streaming capabilities with high-quality 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. For an end-to-end example of how to use the Lightning-Large SSE API, check out Text to Speech (SSE) Example

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 <token>, where <token> is your auth token.

Body

application/json

Response

200
text/event-stream

Synthesized speech retrieved successfully.

The response is of type file.