# API Reference: TTS

## POST `/speech`

**Summary:** Generate speech from text

**Description:** Generate speech from text

#### Parameters

| Name | In | Required | Type | Description |
|------|----|----------|------|-------------|
| `stream` | query | No | boolean | If true, returns a streamed audio response. Otherwise, returns a complete file. |
| `as_wav` | query | No | boolean | If true, returns WAV format audio. If false, returns raw PCM audio data. Only applies when stream is true. |
| `provider_name` | query | No | string | Optional session-level override for the TTS provider |
| `x-user-id` | header | No | anyOf |  |

#### Request Body

**Required:** Yes

- **Media Type:** `application/json`
- **Schema:** `SpeechRequest` (Define in Models)

#### Responses

| Status Code | Description |
|-------------|-------------|
| `200` | Audio bytes in WAV or PCM format, either as a complete file or a stream. |
| `422` | Validation Error |

#### Example Usage

```bash
curl -X 'POST' \
  'http://localhost:8000/api/v1/speech?stream=<stream>&as_wav=<as_wav>&provider_name=<provider_name>' \
  -H 'accept: application/json' \
  -H 'X-User-ID: <your_user_id>' \
  -H 'Content-Type: application/json' \
  -d '{}'
```

---

## GET `/speech/voices`

**Summary:** List available TTS voices

**Description:** List available TTS voices

#### Parameters

| Name | In | Required | Type | Description |
|------|----|----------|------|-------------|
| `provider` | query | No | string | Optional provider name |
| `api_key` | query | No | string | Optional API key override |
| `x-user-id` | header | No | anyOf |  |

#### Responses

| Status Code | Description |
|-------------|-------------|
| `200` | A list of voice names |
| `422` | Validation Error |

#### Example Usage

```bash
curl -X 'GET' \
  'http://localhost:8000/api/v1/speech/voices?provider=<provider>&api_key=<api_key>' \
  -H 'accept: application/json' \
  -H 'X-User-ID: <your_user_id>'
```

---

