# Síntese 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` — Produção

## Authentication

- `FeloBearerAuth` (http bearer) — Chave de API da Felo enviada como `Authorization: Bearer <key>`.
- `FeloApiKey` (apiKey in header `X-API-Key`) — Chave de API da 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 — O sucesso retorna bytes: MP3 em `audio/mpeg` ou PCM bruto em `audio/pcm`, não WAV, JSON ou SSE. Verifique o status HTTP e o fim da transferência antes de reproduzir. `--fail` evita salvar erros HTTP no áudio. Descarte arquivos parciais após desconexão. Consulte os parâmetros PCM do canal; não os deduza. STT usa `input_audio_second` ou tokens; TTS usa `input_character`. Em `speech_billing_unit`, `utf16_code_unit` e `unicode_code_point` contam emojis de forma diferente. A reserva não é teto de gastos e a liquidação pode ser assíncrona; falta de evidência não significa custo zero. Ambos aceitam `X-Felo-Channel` e enviam uma única vez ao canal escolhido. Desative novas tentativas automáticas, inclusive do SDK, após timeout ou desconexão. Guarde `X-Request-Id` e, quando disponível, `X-Generation-Id`. O Console Playground ainda não oferece áudio. `configured_rates` usa tarifas congeladas e uso verificado; `upstream_cost` usa custo verificado do provedor com acréscimo e desconto publicados.

**audio/mpeg**

Schema: string, (binary)

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

**audio/pcm**

Schema: string, (binary)

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