# Generate speech audio

`POST /v1/audio/speech`



Base URL: `https://api.simplellm.eu`. Authenticate using `Authorization: Bearer $SIMPLELLM_API_KEY`.

## Request body

Content-Type: `application/json`

| Field | Type | Required | Meaning |
| --- | --- | --- | --- |
| `model` | `string` | No | Default: `"tts-1"`. |
| `input` | `string` | Yes | At most 4096 UTF-8 bytes (not Unicode characters). |
| `voice` | `string` | No | Default: `"alloy"`. Values: `alloy`, `echo`, `fable`, `onyx`, `nova`, `shimmer`. |
| `response_format` | `string` | No | Default: `"mp3"`. Values: `mp3`, `opus`, `aac`, `flac`, `wav`, `pcm`. |
| `speed` | `number` | No | Default: `1`. Minimum: 0.25. Maximum: 4. |

Nested required fields are required only when their containing object is supplied. Extra chat parameters may be provider-specific; acceptance does not guarantee model support.

## Example request

~~~bash
curl --fail-with-body https://api.simplellm.eu/v1/audio/speech \
  -H "Authorization: Bearer $SIMPLELLM_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "tts-1",
  "input": "Hello from SimpleLLM.",
  "voice": "alloy",
  "response_format": "mp3"
}' \
  --output speech.mp3
~~~

## Responses

### HTTP 200

Audio bytes in the requested format.

Content-Type: `audio/mpeg`

Response type: `string`.

Content-Type: `audio/opus`

Response type: `string`.

Content-Type: `audio/aac`

Response type: `string`.

Content-Type: `audio/flac`

Response type: `string`.

Content-Type: `audio/wav`

Response type: `string`.

Content-Type: `audio/pcm`

Response type: `string`.

## Error handling

Errors can occur in authentication, billing, routing or the upstream service; not every status applies to every route.

| Status | Meaning |
| --- | --- |
| 400 | Invalid request |
| 401 | Invalid credentials |
| 402 | Insufficient credits |
| 403 | Access denied |
| 404 | Model or resource not found |
| 429 | Rate or capacity limit |
| 500 | Internal error |
| 502 | Routing or upstream error |
| 503 | Temporarily unavailable |
| 504 | Deployment timeout |

See [Troubleshooting](/docs/errors.html) for response examples and [Rate limits & retries](/docs/limits.html) for retry rules.

## Machine-readable schema

[Download OpenAPI JSON](/openapi.json). Operation ID: `createSpeech`.
