Skip to main content
This quickstart opens one /v2/tts/ws session, sends text in token-sized deltas, and writes the returned binary audio to speech.wav.

Prerequisites

  • Node.js 18 or newer
  • A Bland API key
  • A BTTS_V2 or BTTS_V3 voice UUID from List Voices

1. Create the project

2. Save the script

Create realtime-tts.mjs:

3. Run it

The script waits for ready, streams token-sized text deltas under one context_id, sends end_of_turn, and closes only after utterance_end. That ordering prevents the final buffered words from being cancelled.

Connect an actual LLM stream

Replace the loop over TEXT with your model’s async token stream:
Send the tokens exactly as produced, including their spaces and punctuation. Bland handles input buffering and speech boundaries.

Next steps


Docs for agents: llms.txt