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

# Create speech

> OpenAI-compatible text-to-speech. Returns the generated audio as binary. Billed per second of generated audio.



## OpenAPI

````yaml POST /v1/audio/speech
openapi: 3.1.0
info:
  title: Kubox API
  description: >-
    OpenAI-compatible AI endpoints on sovereign Australian infrastructure.
    Authenticate with your `kbx_live_…` API key as a Bearer token. This
    reference is generated from the gateway source code.
  version: 1.0.0
servers:
  - url: https://api.kubox.ai
    description: Kubox cloud
security:
  - bearerAuth: []
paths:
  /v1/audio/speech:
    post:
      summary: Create speech (text-to-speech)
      description: >-
        OpenAI-compatible text-to-speech. Returns the generated audio as binary.
        Billed per second of generated audio.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: true
              properties:
                model:
                  type: string
                  description: A text-to-speech model id from `GET /v1/models`.
                input:
                  type: string
                  minLength: 1
                  description: The text to speak.
      responses:
        '200':
          description: The generated audio.
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: invalid_request_error
                  code: invalid_request
                  message: Invalid request body.
        '401':
          description: Incorrect API key provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: invalid_request_error
                  code: invalid_api_key
                  message: Incorrect API key provided.
        '402':
          description: Insufficient credits. Top up to continue.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: insufficient_quota
                  code: insufficient_balance
                  message: Insufficient credits. Top up to continue.
        '404':
          description: The model `<id>` does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: invalid_request_error
                  code: model_not_found
                  message: The model `<id>` does not exist.
        '502':
          description: The provider rejected the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  type: api_error
                  code: upstream_error
                  message: The provider rejected the request.
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your Kubox API key (`kbx_live_…`) from the console.

````