POST
https://api.breeze.blue/v1/text-to-speech/{voice_id}/streamStream text to speech
Stream synthesized audio as it is generated.
Authentication
API key: Send your Breeze Developer API key with the xi-api-key header.
Headers
| Field | Type | Description |
|---|---|---|
xi-api-keyrequired | string | Your Breeze Developer API key. See authentication. |
content-typerequired | string | application/json |
Path parameters
| Field | Type | Description |
|---|---|---|
voice_idrequired | string | Voice identifier to synthesize. Use GET /v1/voices to discover available IDs. |
Query parameters
| Field | Type | Description |
|---|---|---|
output_format | stringdefault: mp3 | Streaming output encoding. Supported values: mp3, pcm. Default: mp3. |
Request body
| Field | Type | Description |
|---|---|---|
textrequired | string | Text to synthesize. |
model_id | string | model_id request field for TtsRequest. |
language_code | string | language_code request field for TtsRequest. |
instructions | string | instructions request field for TtsRequest. |
voice_settings | object | voice_settings request field for TtsRequest. |
voice_settings.guidance_scale | number | voice_settings.guidance_scale request field for VoiceSettingsPayload. |
Example request
python
from breeze_blue import stream
import os
from breeze_blue import BreezeBlue
client = BreezeBlue(api_key=os.environ["BREEZE_API_KEY"])
audio = client.text_to_speech.stream(
voice_id="voc_xeh3w54cqvnp",
text="Streaming preview from Breeze Blue.",
model_id="bluebell-v1-en",
voice_settings={"guidance_scale": 1.2},
)
stream(audio)
typescript
import { stream } from "@breeze.blue/sdk/node";
import { BreezeBlueClient } from "@breeze.blue/sdk";
const client = new BreezeBlueClient({
apiKey: process.env.BREEZE_API_KEY!,
});
const audio = await client.textToSpeech.stream(
"voc_xeh3w54cqvnp",
{
text: "Streaming preview from Breeze Blue.",
modelId: "bluebell-v1-en",
voiceSettings: { guidanceScale: 1.2 },
},
);
await stream(audio);
curl
curl -X POST "https://api.breeze.blue/v1/text-to-speech/voc_xeh3w54cqvnp/stream" \
-H "xi-api-key: $BREEZE_API_KEY" \
-H "content-type: application/json" \
--data '{
"model_id": "bluebell-v1-en",
"text": "Streaming preview from Breeze Blue.",
"voice_settings": {
"guidance_scale": 1.2
}
}'
from breeze_blue import stream
import os
from breeze_blue import BreezeBlue
client = BreezeBlue(api_key=os.environ["BREEZE_API_KEY"])
audio = client.text_to_speech.stream(
voice_id="voc_xeh3w54cqvnp",
text="Streaming preview from Breeze Blue.",
model_id="bluebell-v1-en",
voice_settings={"guidance_scale": 1.2},
)
stream(audio)Response
Streaming audio bytes. The history-item-id header identifies the persisted generation.
Content types: audio/mpeg, audio/pcm
Response headers:
history-item-id: History item ID for the generated audio.x-breeze-api-key-id: Public API key identifier used to authenticate the request, when an API key was used.
Binary audio/mpeg, audio/pcm response bodyErrors
VALIDATION_ERROR— The request body failed schema validation.BAD_REQUEST— The request body or query parameter is not valid for this endpoint.RESOURCE_NOT_FOUND— The voice_id does not exist or is not accessible.GENERATION_CONCURRENCY_EXCEEDED— Your plan's concurrent generation limit was reached. Please retry shortly.GENERATION_CAPACITY_EXCEEDED— Generation capacity is temporarily exhausted.UPSTREAM_GENERATION_ERROR— The downstream generation service failed.UPSTREAM_TIMEOUT— The downstream generation service timed out.
See the full list on errors.
Notes
- Use voice_settings.guidance_scale to adjust how strongly generation follows the prompt and reference voice.