# Sintesis suara

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

## Authentication

- `FeloBearerAuth` (http bearer) — Kunci API Felo dikirim sebagai `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Kunci API Felo dikirim sebagai `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 — Hasil sukses berupa byte audio: MP3 `audio/mpeg` atau PCM mentah `audio/pcm`, bukan WAV, JSON atau SSE. Periksa status HTTP dan transfer lengkap sebelum memutar. `--fail` mencegah isi kesalahan HTTP tersimpan sebagai audio. Buang berkas parsial setelah koneksi terputus. Pastikan parameter PCM kanal, jangan menebak. STT memakai `input_audio_second` atau token; TTS memakai `input_character`. `speech_billing_unit` berupa `utf16_code_unit` dan `unicode_code_point` menghitung emoji berbeda. Reservasi bukan batas biaya; penyelesaian bisa asinkron. Bukti yang hilang bukan berarti gratis. Keduanya menerima `X-Felo-Channel` dan mengirim sekali ke kanal terpilih. Nonaktifkan percobaan ulang otomatis termasuk SDK setelah timeout atau putus koneksi. Simpan `X-Request-Id` dan `X-Generation-Id` jika tersedia. Console Playground belum mendukung audio. `configured_rates` memakai tarif beku dan penggunaan terverifikasi; `upstream_cost` memakai biaya penyedia terverifikasi dengan markup dan diskon terbit.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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