> ## Documentation Index
> Fetch the complete documentation index at: https://docs.breezeblue.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Stream text to speech

> Stream synthesized audio as it is generated.



## OpenAPI

````yaml /openapi.json post /v1/text-to-speech/{voice_id}/stream
openapi: 3.1.0
info:
  title: Breeze Developer API
  description: >-
    Breeze Developer API for models, voices, text-to-speech, history, balance,
    usage, and browser-managed API keys.
  version: 1.0.0
servers:
  - url: https://api.breeze.blue
security: []
tags:
  - name: Models
    description: Supported TTS models.
  - name: Text to Speech
    description: Text-to-speech synthesis and instruction rewriting.
  - name: Voices
    description: Saved voices and voice settings.
  - name: Voice Previews
    description: Create, audition, and save temporary voice previews.
  - name: Account
    description: Balance, usage, and API keys.
  - name: History
    description: Generated audio history.
paths:
  /v1/text-to-speech/{voice_id}/stream:
    post:
      tags:
        - Text to Speech
      summary: Stream text to speech
      description: Stream synthesized audio as it is generated.
      operationId: tts_stream
      parameters:
        - name: voice_id
          in: path
          required: true
          schema:
            title: Voice Id
            type: string
          description: >-
            Voice identifier to synthesize. Use GET /v1/voices to discover
            available IDs.
        - name: output_format
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Output Format
            default: mp3
          description: 'Streaming output encoding. Supported values: mp3, pcm. Default: mp3.'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TtsRequest'
      responses:
        '200':
          description: >-
            Streaming audio bytes. The history-item-id header identifies the
            persisted generation.
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
            audio/pcm:
              schema:
                type: string
                format: binary
          headers:
            history-item-id:
              description: History item ID for the generated audio.
              schema:
                type: string
            x-breeze-api-key-id:
              description: >-
                Public API key identifier used to authenticate the request, when
                an API key was used.
              schema:
                type: string
        '400':
          description: HTTP 400 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: HTTP 401 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: HTTP 403 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: HTTP 404 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: HTTP 422 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '429':
          description: HTTP 429 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: HTTP 503 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: HTTP 504 error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl \
              --request POST \
              --url "https://api.breeze.blue/v1/text-to-speech/voc_xeh3w54cqvnp/stream" \
              --header "xi-api-key: $BREEZE_API_KEY" \
              --header "Content-Type: application/json" \
              --data '{
              "text": "I can’t believe you brought him here!",
              "model_id": "bluebell-v1-en",
              "language_code": "en",
              "instructions": "Say it softly and emotionally, with a hurt, disappointed tone, as if bringing him here broke your trust.",
              "voice_settings": {
                "guidance_scale": 4.0
              }
            }'
        - lang: Python
          label: Python SDK
          source: |-
            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="I can’t believe you brought him here!",
                instructions="Say it softly and emotionally, with a hurt, disappointed tone, as if bringing him here broke your trust.",
                model_id="bluebell-v1-en",
                voice_settings={"guidance_scale": 4.0},
            )
            stream(audio)
        - lang: TypeScript
          label: TypeScript SDK
          source: |-
            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: "I can’t believe you brought him here!",
                instructions: "Say it softly and emotionally, with a hurt, disappointed tone, as if bringing him here broke your trust.",
                modelId: "bluebell-v1-en",
                voiceSettings: { guidanceScale: 4.0 },
              },
            );
            await stream(audio);
components:
  schemas:
    TtsRequest:
      properties:
        text:
          type: string
          minLength: 1
          title: Text
          description: Text to synthesize.
        model_id:
          anyOf:
            - type: string
              maxLength: 120
              minLength: 1
            - type: 'null'
          title: Model Id
          description: Optional model identifier to use for synthesis.
        language_code:
          anyOf:
            - type: string
              maxLength: 16
            - type: 'null'
          title: Language Code
          description: Optional BCP-47 style language hint such as en.
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: Optional performance instructions for the generation.
        voice_settings:
          anyOf:
            - $ref: '#/components/schemas/VoiceSettingsPayload'
            - type: 'null'
          description: Optional per-request voice settings override.
      additionalProperties: false
      type: object
      required:
        - text
      title: TtsRequest
    ErrorResponse:
      properties:
        ok:
          default: false
          title: Ok
          type: boolean
        code:
          title: Code
          type: string
        detail:
          title: Detail
          type: string
        error:
          title: Error
          type: string
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          title: Meta
      required:
        - code
        - detail
        - error
      title: ErrorResponse
      type: object
    ValidationErrorResponse:
      properties:
        ok:
          default: false
          title: Ok
          type: boolean
        code:
          title: Code
          type: string
        detail:
          title: Detail
          type: string
        error:
          title: Error
          type: string
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      required:
        - code
        - detail
        - error
      title: ValidationErrorResponse
      type: object
    VoiceSettingsPayload:
      properties:
        guidance_scale:
          anyOf:
            - type: number
              maximum: 10
              minimum: 1
            - type: 'null'
          title: Guidance Scale
          description: 'Generation guidance strength. Accepted range: 1.0 to 10.0.'
          default: 1
      additionalProperties: false
      type: object
      title: VoiceSettingsPayload
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: xi-api-key
      description: Breeze Developer API key.

````