# Síntesis de voz

**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` — Producción

## Authentication

- `FeloBearerAuth` (http bearer) — Clave de API de Felo enviada como `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Clave de API de Felo enviada como `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 — El éxito devuelve bytes de audio: MP3 como `audio/mpeg` o PCM sin cabecera como `audio/pcm`, no WAV, JSON ni SSE. Compruebe el estado HTTP y la transferencia completa antes de reproducir. `--fail` evita guardar errores HTTP como audio. Descarte archivos parciales tras una desconexión. Consulte los parámetros PCM del canal; no los suponga. STT usa `input_audio_second` o tokens; TTS usa `input_character`. En `speech_billing_unit`, `utf16_code_unit` y `unicode_code_point` cuentan emoji de forma distinta. La reserva no es un límite de gasto; la liquidación puede ser asíncrona. La falta de pruebas no significa coste cero. Ambos aceptan `X-Felo-Channel` y envían una vez al canal elegido. Desactive reintentos automáticos, también del SDK, tras timeout o desconexión. Conserve `X-Request-Id` y el `X-Generation-Id` disponible. Console Playground aún no admite audio. `configured_rates` usa tarifas congeladas y uso verificado; `upstream_cost` usa el coste verificado del proveedor con el recargo y descuento publicados.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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