API reference · API
Create speech (OpenAI wire format)
POST/v1/audio/speechAPI key
Served on the terms a completion is: the key's chat scope and policy, the account's credits with a hold at the worst case, and one metered usage row settled at what the upstream measured. A model with no published price, or one priced in a unit the endpoint does not report, is refused on house money with 503 pricing_unavailable and served on your own provider key. With no provider configured the answer is 503 upstream_unavailable. No fallback chain and no x402: a media request names one model and needs a key. The charge is the input's characters at the model's published per character rate, known before the first byte and settled then. openai/gpt-4o-mini-tts and OpenRouter models priced by the audio they generate are unmeterable (the endpoint reports no usage) and are served on your own key only.
Request body
application/json, required
| Field | Type | What it is |
|---|---|---|
| modelrequired | string | A speech model: openai/tts-1 or openai/tts-1-hd on the native adapter, or an OpenRouter model with output_modalities speech that is priced per character. At most 200 characters. |
| inputrequired | string | At most 4096 characters. Billed per character, counted as Unicode code points. At most 4096 characters. |
| voice | string | Required by OpenAI; available voices vary by model. At most 100 characters. |
| response_format | string | mp3 by default. OpenRouter models answer mp3 or pcm only. One of "mp3", "opus", "aac", "flac", "wav", "pcm". |
| speed | number | From 0.25 to 4. |
| instructions | string | OpenAI only; named in x-antimatter-adjusted when the model is served elsewhere. At most 4096 characters. |
| stream_format | string | audio only; sse is refused. The audio streams through as it is produced either way. One of "audio", "sse". |
Example
{
"model": "antimatter/auto",
"input": "Say hello in five words."
}Answer 200
The audio, streamed.
Headers: x-antimatter-upstream, x-antimatter-model, x-antimatter-request-id, x-antimatter-byok, x-antimatter-adjusted, x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-reset
The answer's fields are not named in the document.
Errors
- 400OpenAI shaped error.
- 401OpenAI shaped error.
- 402OpenAI shaped error.
- 403OpenAI shaped error.
- 404OpenAI shaped error.
- 413OpenAI shaped error.
- 429OpenAI shaped error.
- 502OpenAI shaped error.
- 503OpenAI shaped error.
- 504OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.