Skip to main content
Live character products often receive one language-model response over several seconds. You can begin speaking before the whole response is available by dividing each turn into three semantic segments:
  1. Preamble — a short acknowledgement that can play immediately.
  2. First sentence — the first complete sentence from the model response.
  3. Remainder — the rest of the response, split only at natural sentence boundaries.
Keep the queue bounded. If a newer user message makes an old remainder irrelevant, cancel that old work instead of letting it occupy generation capacity.

Concurrency budget

Studio and Developer API generations share the account’s concurrent-generation limit. Starter accounts have six concurrent generations, so a character application should normally use an application-side semaphore of 5. The spare slot leaves room for Studio activity, cancellation overlap, and another product flow. One logical reply split into three simultaneous requests consumes three slots. A second reply can therefore reach the six-slot account limit before the first reply finishes. When that happens, Breeze returns 429 GENERATION_CONCURRENCY_EXCEEDED with Retry-After; it does not queue the request on your behalf.

Retry policy

  • Retry 429 after the delay in Retry-After, adding a small amount of jitter.
  • Retry transient 502, 503, and 504 responses with bounded exponential backoff.
  • Do not retry 400 or 422 without changing the request.
  • Set a maximum attempt count and discard remainders that have lost their playback value.
  • Log the Breeze request or trace ID, HTTP status, and stable error code. Do not log API keys or full private dialogue text.

Python example

TypeScript example

The TypeScript example uses the small async-mutex package. You can replace it with any bounded semaphore already used by your application.

Language handling

language_code is optional for breeze-tts-2. Short English and Chinese text, including Hi and OK, is resolved without requiring the field. When your character has a fixed language, explicitly send language_code: "en" or language_code: "zh" to make intent unambiguous. Multilingual preview models remain conservative and can ask for an explicit language when a short input cannot be identified reliably.

Choosing HTTP or realtime WebSocket

Use HTTP streaming when you already have a complete preamble or sentence and want independent encoded streams. Use the realtime text-to-speech WebSocket when text arrives incrementally and you want one persistent synthesis connection with turn cancellation and barge-in.

Rate limits

Review account concurrency, Retry-After, and realtime session limits.