# Sprachsynthese

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

## Authentication

- `FeloBearerAuth` (http bearer) — Felo-API-Schlüssel, gesendet als `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo-API-Schlüssel, gesendet als `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 — Erfolg liefert Audiobytes: MP3 als `audio/mpeg` oder rohes PCM als `audio/pcm`, kein WAV, JSON oder SSE. Vor Wiedergabe HTTP-Status und vollständige Übertragung prüfen. `--fail` verhindert HTTP-Fehlertexte in Audiodateien. Unvollständige Dateien nach Abbruch verwerfen. PCM-Parameter beim Kanal prüfen, nicht raten. STT nutzt `input_audio_second` oder Tokens, TTS `input_character`. Bei `speech_billing_unit` zählen `utf16_code_unit` und `unicode_code_point` Emojis unterschiedlich. Reservierungen sind keine Kostenobergrenze; die Abrechnung kann asynchron erfolgen. Fehlende Belege bedeuten nicht kostenlos. Beide APIs akzeptieren `X-Felo-Channel` und senden einmal an den ausgewählten Kanal. Automatische Wiederholungen nach Timeout oder Abbruch auch im SDK deaktivieren. `X-Request-Id` und verfügbare `X-Generation-Id` aufbewahren. Console Playground unterstützt Audio noch nicht. `configured_rates` nutzt eingefrorene Tarife und bestätigte Nutzung; `upstream_cost` nutzt bestätigte Anbieterkosten mit veröffentlichtem Aufschlag und Rabatt.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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