# Sintesi vocale

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

## Authentication

- `FeloBearerAuth` (http bearer) — Chiave API Felo inviata come `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Chiave API Felo inviata come `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 — Il successo restituisce byte audio: MP3 in `audio/mpeg` o PCM grezzo in `audio/pcm`, non WAV, JSON o SSE. Controlla stato HTTP e trasferimento completo prima di riprodurre. `--fail` evita di salvare errori HTTP nel file audio. Elimina i file incompleti dopo una disconnessione. Verifica i parametri PCM del canale senza indovinarli. STT usa `input_audio_second` o token; TTS usa `input_character`. In `speech_billing_unit`, `utf16_code_unit` e `unicode_code_point` contano gli emoji diversamente. La prenotazione non è un tetto di spesa; la liquidazione può essere asincrona. Prove mancanti non significano costo zero. Entrambi accettano `X-Felo-Channel` e inviano una sola volta al canale scelto. Disattiva i tentativi automatici anche dell'SDK dopo timeout o disconnessione. Conserva `X-Request-Id` e l'eventuale `X-Generation-Id`. Console Playground non supporta ancora l'audio. `configured_rates` usa tariffe congelate e utilizzo verificato; `upstream_cost` usa il costo verificato del fornitore con ricarico e sconto pubblicati.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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