# Sintesis pertuturan

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

## Authentication

- `FeloBearerAuth` (http bearer) — Kunci API Felo dihantar sebagai `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Kunci API Felo dihantar 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 — Kejayaan memulangkan bait audio: MP3 `audio/mpeg` atau PCM mentah `audio/pcm`, bukan WAV, JSON atau SSE. Semak status HTTP dan pemindahan lengkap sebelum main semula. `--fail` menghalang ralat HTTP disimpan sebagai audio. Buang fail separa selepas sambungan terputus. Sahkan parameter PCM saluran, jangan meneka. STT menggunakan `input_audio_second` atau token; TTS menggunakan `input_character`. Dalam `speech_billing_unit`, `utf16_code_unit` dan `unicode_code_point` mengira emoji secara berbeza. Tempahan bukan had perbelanjaan; penyelesaian boleh tak segerak. Ketiadaan bukti bukan bermaksud percuma. Kedua-duanya menerima `X-Felo-Channel` dan menghantar sekali ke saluran dipilih. Matikan cubaan semula automatik termasuk SDK selepas tamat masa atau terputus. Simpan `X-Request-Id` dan `X-Generation-Id` jika ada. Console Playground belum menyokong audio. `configured_rates` menggunakan kadar dibekukan dan penggunaan disahkan; `upstream_cost` menggunakan kos pembekal disahkan dengan tokokan dan diskaun diterbitkan.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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