# Synteza mowy

**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` — Produkcja

## Authentication

- `FeloBearerAuth` (http bearer) — Klucz API Felo przesyłany jako `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Klucz API Felo przesyłany jako `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 — Sukces zwraca bajty audio: MP3 jako `audio/mpeg` lub surowe PCM jako `audio/pcm`, nie WAV, JSON ani SSE. Przed odtworzeniem sprawdź status HTTP i pełny transfer. `--fail` zapobiega zapisowi błędu HTTP jako audio. Odrzuć plik częściowy po przerwaniu. Sprawdź parametry PCM kanału, nie zgaduj. STT używa `input_audio_second` lub tokenów; TTS używa `input_character`. `speech_billing_unit`: `utf16_code_unit` i `unicode_code_point` inaczej liczą emoji. Rezerwacja nie jest limitem wydatków; rozliczenie może być asynchroniczne. Brak dowodów nie oznacza braku opłat. Oba API przyjmują `X-Felo-Channel` i wysyłają raz do wybranego kanału. Wyłącz automatyczne ponawianie także w SDK po timeout lub rozłączeniu; zachowaj `X-Request-Id` i dostępne `X-Generation-Id`. Console Playground nie obsługuje jeszcze audio. `configured_rates` używa zamrożonych stawek i potwierdzonego zużycia; `upstream_cost` — potwierdzonego kosztu dostawcy z opublikowaną marżą i rabatem.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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