# Синтез мовлення

**API:** Model API

**Endpoint:** `POST /api/v1/audio/speech`

**Tags:** Audio

Use model to select the speech generation model. Channel selection is unavailable for speech generation requests.

## Base URL

- `https://openapi.felo.ai` — Продакшн

## Authentication

- `FeloBearerAuth` (http bearer) — API-ключ Felo, надісланий як `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — API-ключ Felo, надісланий як `X-API-Key: <key>`.

## Request body

Required: **yes**

### application/json

Schema:

```json
{
  "type": "object",
  "required": [
    "model",
    "input"
  ],
  "additionalProperties": false,
  "properties": {
    "model": {
      "type": "string",
      "maxLength": 256
    },
    "input": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    },
    "voice": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "description": "Optional non-blank voice ID. The upstream model determines whether a voice is required and which IDs it accepts. Catalog voices are examples."
    },
    "response_format": {
      "type": "string",
      "enum": [
        "pcm",
        "mp3"
      ],
      "default": "pcm"
    },
    "speed": {
      "type": "number",
      "default": 1,
      "description": "Currently only 1 is supported."
    }
  }
}
```

## Responses

### 200 — Успіх повертає аудіобайти: MP3 як `audio/mpeg` або сирий PCM як `audio/pcm`, не WAV, JSON чи SSE. Перед відтворенням перевірте HTTP-статус і завершення передачі. `--fail` запобігає запису HTTP-помилок в аудіофайл. Після обриву відкиньте неповний файл. Перевірте параметри PCM каналу, не вгадуйте. STT використовує `input_audio_second` або токени; TTS — `input_character`. У `speech_billing_unit` одиниці `utf16_code_unit` та `unicode_code_point` рахують emoji по-різному. Резерв не є лімітом витрат; розрахунок може бути асинхронним. Брак доказів не означає безкоштовність. Обидва API приймають `X-Felo-Channel` і надсилають один раз до вибраного каналу. Вимкніть автоматичні повтори, зокрема SDK, після таймауту чи обриву; збережіть `X-Request-Id` і доступний `X-Generation-Id`. Console Playground поки не підтримує аудіо. `configured_rates` використовує зафіксовані тарифи й підтверджений обсяг; `upstream_cost` — перевірену вартість постачальника з опублікованими націнкою та знижкою.

**audio/mpeg**

Schema: string, (binary)

```json
{
  "type": "string",
  "format": "binary"
}
```

**audio/pcm**

Schema: string, (binary)

```json
{
  "type": "string",
  "format": "binary"
}
```
