Streaming text to speech API

From a free key to hearing audio: one script you can copy, run and adapt.

Streaming means the first audio arrives while the rest of the sentence is still being generated. Below: a free key, one script, and the sentence playing back. How fast and how much it costs is on the voice agent page.

1. Get a free key

Get a free key  100,000 characters every month, no card. Create a key on your account page, then put it in your shell:

export SPEAKVORA_KEY=your_key_here

2. Run this

Save it as stream.py and run python3 stream.py. Python 3.8 or newer, no packages to install.

import json, os, time, urllib.request, wave KEY = os.environ["SPEAKVORA_KEY"] # your key from https://speakvora.com/account API = "https://speakvora.com/api/v1" def post(url, body, headers): req = urllib.request.Request(url, json.dumps(body).encode(), {"content-type": "application/json", **headers}, method="POST") return urllib.request.urlopen(req, timeout=60) # 1. Ask for a stream. The answer holds a one-use token, the stream address and the exact body to send next. with post(API + "/speak", {"text": "Your order is ready for pickup.", "voice": "ph_zoey", "lang": "en", "stream": True}, {"x-api-key": KEY}) as r: job = json.load(r) if not job.get("stream_url"): # the line was already made, or no stream was available: use the finished clip instead raise SystemExit("Not streamed (%s). Finished clip: %s" % (job.get("stream_unavailable_reason"), job.get("url"))) # 2. Read the stream: raw 16-bit mono PCM at 24 kHz, sent as it is generated. start, first, pcm = time.time(), None, bytearray() with post(job["stream_url"], job["request"]["body"], {"authorization": "Bearer " + job["token"]}) as r: while True: chunk = r.read(4800) if not chunk: break if first is None: first = time.time() - start pcm += chunk # to play while it arrives, write each chunk to your audio output here instead # 3. Save it as a WAV file and play it. with wave.open("hello.wav", "wb") as w: w.setnchannels(1); w.setsampwidth(2); w.setframerate(24000) w.writeframes(bytes(pcm)) print("first audio after %.0f ms, %.1f seconds of speech saved to hello.wav" % (first * 1000, len(pcm) / 48000))

It prints first audio after N ms, N seconds of speech saved to hello.wav, with your own numbers. Play the file with afplay hello.wav (macOS), aplay hello.wav (Linux) or by double-clicking it (Windows). The first number includes the network from where you run it, so it will be higher than our measured figures.

This script is in our test suite, where it runs against a local stand-in for the two calls it makes.

What the script does

  1. POST /api/v1/speak with "stream": true returns a one-use token, a stream_url and the exact body to send next.
  2. It posts that body to the stream_url with the token and reads raw PCM as it arrives.
  3. It writes the PCM into a WAV file. To play while it arrives, hand each chunk to your audio output instead of collecting it.

If it does not work

  • 401 unauthorized: the key is missing or wrong. Check SPEAKVORA_KEY.
  • 402 free_allowance_used: this month's 100,000 free characters are used. They renew on the 1st, or add a card.
  • Not streamed (stored_clip): that exact sentence was already made, so you get its finished clip link instead of a stream. Change the text to hear a fresh stream.
  • Anything else: errors, retries and rate limits.

When to stream and when not to

  • Stream live conversation, where every reply is new text.
  • Prepare ahead greetings, menus and notifications that repeat: /v1/prepare once, then /v1/speak returns the stored clip.

Where the speed figure comes from: it is our own vendor-run test (November 21, 2026), not an independent benchmark. The rerunnable method and the raw data are in the public tts-latency-benchmark repository, and every price we compare is in the open TTS price index. Speed figures that other vendors publish, for example Deepgram or Cartesia, use different methods and are not directly comparable with ours.

Next: quick start with curl · speed, price and limits for voice agents · how far 100,000 free characters go · add speech to a web app.

Questions

What is a streaming text to speech API?

An API that sends audio back while it is still being generated, so playback starts after the first chunk instead of after the whole reply. It matters for voice agents and phone calls, where a long pause before speech feels like a dropped call.

Does streaming work on the free plan?

Yes. Every account gets 100,000 characters free each month with no card, and the Phonon and Pocket voices stream on free and paid accounts. A free account runs one stream at a time, on our own server.

What format is the audio?

Raw 16-bit mono PCM at 24 kHz, sent sentence by sentence over one chunked response. Save it as a WAV file as the script above does, or send it straight to a speaker, a phone call or a WebRTC track.

What is not supported?

No SSML and no viseme marks. Japanese is not available on the streaming lane. There is no uptime or latency guarantee yet.

Part of our text to speech API guide: voices, price, speed and code samples.