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

# Text-to-Speech (SSE)

> Stream audio over Server-Sent Events for low time-to-first-audio. Identical body to `/tts/bytes`, except `output_format.container` must be `raw` (SSE cannot wrap a WAV/RIFF header). Each event's `data` is a JSON object: `chunk` events carry base64-encoded raw PCM; a final `done` event closes the stream.



## OpenAPI

````yaml api-reference/openapi.json POST /tts/sse
openapi: 3.1.0
info:
  title: Nineninesix TTS API
  description: >-
    Cartesia-compatible Text-to-Speech API for voice agents and real-time
    dialogue. Point the official Cartesia SDKs at this base URL and they just
    work.
  version: 0.3.0
  contact:
    name: Nineninesix Support
    email: ulan@nineninesix.ai
servers:
  - url: https://api.nineninesix.ai
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Speech
    description: Generate audio from text.
  - name: Voices
    description: List, fetch, and clone voices.
paths:
  /tts/sse:
    post:
      tags:
        - Speech
      summary: Text-to-Speech (SSE)
      description: >-
        Stream audio over Server-Sent Events for low time-to-first-audio.
        Identical body to `/tts/bytes`, except `output_format.container` must be
        `raw` (SSE cannot wrap a WAV/RIFF header). Each event's `data` is a JSON
        object: `chunk` events carry base64-encoded raw PCM; a final `done`
        event closes the stream.
      operationId: createSpeechSSE
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TTSRequestRaw'
            example:
              model_id: gepard-1.0
              transcript: Streaming speech, chunk by chunk.
              voice:
                mode: id
                id: a0e99841-438c-4a64-b679-ae501e7d6091
              output_format:
                container: raw
                encoding: pcm_s16le
                sample_rate: 22050
      responses:
        '200':
          description: A `text/event-stream` of `chunk` events followed by a `done` event.
          content:
            text/event-stream:
              schema:
                type: string
              example: |
                data: {"type":"chunk","data":"<base64 pcm>","context_id":"..."}

                data: {"type":"done","context_id":"..."}
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          $ref: '#/components/responses/UpstreamUnavailable'
components:
  schemas:
    TTSRequestRaw:
      allOf:
        - $ref: '#/components/schemas/TTSRequest'
      description: >-
        Same as TTSRequest, but `output_format.container` must be `raw`
        (streaming endpoints cannot emit a WAV header).
    TTSRequest:
      type: object
      required:
        - model_id
        - transcript
        - voice
        - output_format
      properties:
        model_id:
          type: string
          enum:
            - gepard-1.0
          description: The TTS model. Currently `gepard-1.0`.
        transcript:
          type: string
          description: The text to synthesize. Billed at 1 credit per character.
        voice:
          $ref: '#/components/schemas/VoiceSpecifier'
        output_format:
          $ref: '#/components/schemas/OutputFormat'
        language:
          type: string
          description: Optional language code (e.g. `en`).
          example: en
    Error:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code.
          example: payment_required
        message:
          type: string
          description: Human-readable description.
          example: insufficient credits
    VoiceSpecifier:
      type: object
      required:
        - mode
        - id
      properties:
        mode:
          type: string
          enum:
            - id
          description: Voice selection mode.
        id:
          type: string
          description: The voice ID.
          example: a0e99841-438c-4a64-b679-ae501e7d6091
    OutputFormat:
      type: object
      description: >-
        Output audio format. Each field is validated against a fixed set;
        anything outside these values returns 400 with no silent fallback.
      required:
        - container
        - encoding
        - sample_rate
      properties:
        container:
          type: string
          enum:
            - raw
            - wav
          description: >-
            `wav` is available on `/tts/bytes` only; streaming endpoints are
            `raw`-only.
        encoding:
          type: string
          enum:
            - pcm_s16le
            - pcm_mulaw
            - pcm_alaw
          description: '`pcm_mulaw`/`pcm_alaw` are 8-bit G.711 telephony codecs.'
        sample_rate:
          type: integer
          enum:
            - 8000
            - 16000
            - 22050
          description: >-
            The model is natively 22050 Hz; 8000/16000 are resampled
            server-side.
  responses:
    BadRequest:
      description: >-
        Malformed request or unsupported `output_format` (bad container,
        encoding, or sample rate).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: invalid_output_format
            message: unsupported sample_rate
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: unauthorized
            message: invalid API key
    PaymentRequired:
      description: Insufficient credits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: payment_required
            message: insufficient credits
    RateLimited:
      description: >-
        Per-org rate or concurrency limit reached. Honor the `Retry-After`
        header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: rate_limited
            message: requests/min limit exceeded for your tier
    UpstreamUnavailable:
      description: The synthesis backend errored. Any pre-charge is refunded automatically.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: upstream_unavailable
            message: synthesis backend error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Pass your API key as a Bearer token: `Authorization: Bearer sk_996_...`.'
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Alternatively, pass your API key in the `X-API-Key` header.

````