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

# Text to speech

> OpenAI-compatible TTS endpoint backed by Kokoro. Returns raw audio bytes.




## OpenAPI

````yaml POST /v1/audio/speech
openapi: 3.0.3
info:
  title: Tera API
  description: >
    OpenAI-compatible inference API. Existing OpenAI SDKs work without
    modification —

    point them at `https://api.tera.gw` with your Tera API key.
  version: 1.0.0
servers:
  - url: https://api.tera.gw
    description: Production
security:
  - bearerAuth: []
tags:
  - name: chat
    description: Chat completions
  - name: completions
    description: Text completions
  - name: models
    description: Model catalog
  - name: audio
    description: Text-to-speech
paths:
  /v1/audio/speech:
    post:
      tags:
        - audio
      summary: Generate speech audio
      description: >
        OpenAI-compatible TTS endpoint backed by Kokoro. Returns raw audio
        bytes.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SpeechRequest'
      responses:
        '200':
          description: Audio bytes (WAV by default).
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    SpeechRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          example: hexgrad/Kokoro-82M
        input:
          type: string
          description: Text to synthesize.
        voice:
          type: string
          description: Kokoro voice id.
          example: af_bella
        response_format:
          type: string
          enum:
            - wav
            - mp3
          default: wav
        speed:
          type: number
          minimum: 0.25
          maximum: 4
          default: 1
        lang_code:
          type: string
          description: BCP-47 language code, e.g. `en-US`.
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Malformed request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Model not found or not deployed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sk-tera-...

````