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

# TTS (Text to Speech) (Beta)

> Generate TTS audio from text using the specified voice and format.

## Voice Mapping

`voice` is normalized by provider with an internal alias map:

* `openai`: common voices (for example `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `cedar`, `marin`).
* `google` (AI Studio / Gemini TTS): canonical prebuilt voices:
  `Zephyr`, `Puck`, `Charon`, `Kore`, `Fenrir`, `Leda`, `Orus`, `Aoede`, `Callirrhoe`, `Autonoe`, `Enceladus`, `Iapetus`, `Umbriel`, `Algieba`, `Despina`, `Erinome`, `Algenib`, `Rasalgethi`, `Laomedeia`, `Achernar`, `Alnilam`, `Schedar`, `Gacrux`, `Pulcherrima`, `Achird`, `Zubenelgenubi`, `Vindemiatrix`, `Sadachbia`, `Sadaltager`, `Sulafat`.
* `elevenlabs`: common public starter voices are mapped (for example `rachel`, `domi`, `bella`, `antoni`, `elli`, `josh`, `arnold`, `adam`, `sam`).

If a provided `voice` is not valid for the routed provider/model mapping, the request returns `400 invalid_request_error` with `param: "voice"`.

## Provider Overrides

You can still pass provider-native voice settings:

* ElevenLabs: `config.elevenlabs.voice_id` / `config.elevenlabs.voice` / `config.elevenlabs.voiceName`
* Google: `config.google.voice_name` / `config.google.voiceName`

Top-level `voice` should be your default for portability.

## Voice Samples

* OpenAI: [openai.fm](https://www.openai.fm/)
* Google TTS voice examples: [Gemini text-to-speech docs](https://ai.google.dev/gemini-api/docs/speech-generation#voices)
* ElevenLabs voice library: [ElevenLabs Voice Library](https://elevenlabs.io/voice-library)


## OpenAPI

````yaml POST /audio/speech
openapi: 3.0.3
info:
  title: AI Stats Gateway API
  description: >-
    A gateway API for accessing various AI models with OpenAI-compatible
    endpoints.
  version: 1.0.0
  contact:
    name: AI Stats
    url: https://docs.ai-stats.phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core AI Stats Gateway operations.
paths:
  /audio/speech:
    post:
      tags:
        - Gateway
      summary: Generate speech
      description: Generates audio from the input text.
      operationId: createSpeech
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AudioSpeechRequest'
      responses:
        '200':
          description: Audio file
          content:
            audio/mpeg:
              schema:
                type: string
                format: binary
components:
  schemas:
    AudioSpeechRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
        input:
          type: string
        voice:
          type: string
        format:
          type: string
          enum:
            - mp3
            - wav
            - ogg
            - aac
        provider:
          $ref: '#/components/schemas/ProviderRoutingOptions'
    ProviderRoutingOptions:
      type: object
      description: Provider routing preferences for gateway selection.
      properties:
        order:
          type: array
          items:
            type: string
        only:
          type: array
          items:
            type: string
        ignore:
          type: array
          items:
            type: string
        include_alpha:
          type: boolean
          description: Include alpha providers in routing (off by default).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token authentication

````