curl --request POST \
--url https://router.requesty.ai/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"instructions": "Speak in a warm, friendly tone.",
"response_format": "mp3",
"speed": 1,
"stream_format": "<string>"
}
'import requests
url = "https://router.requesty.ai/v1/audio/speech"
payload = {
"model": "openai/gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"instructions": "Speak in a warm, friendly tone.",
"response_format": "mp3",
"speed": 1,
"stream_format": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-4o-mini-tts',
input: 'The quick brown fox jumped over the lazy dog.',
voice: 'alloy',
instructions: 'Speak in a warm, friendly tone.',
response_format: 'mp3',
speed: 1,
stream_format: '<string>'
})
};
fetch('https://router.requesty.ai/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://router.requesty.ai/v1/audio/speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'openai/gpt-4o-mini-tts',
'input' => 'The quick brown fox jumped over the lazy dog.',
'voice' => 'alloy',
'instructions' => 'Speak in a warm, friendly tone.',
'response_format' => 'mp3',
'speed' => 1,
'stream_format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://router.requesty.ai/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://router.requesty.ai/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router.requesty.ai/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}Create Speech
Synthesizes audio from input text using a text-to-speech model. By default the response is a binary audio stream in the requested format. When stream_format is sse, the response is a Server-Sent Events stream of speech.audio.delta and speech.audio.done events with base64-encoded audio chunks.
curl --request POST \
--url https://router.requesty.ai/v1/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai/gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"instructions": "Speak in a warm, friendly tone.",
"response_format": "mp3",
"speed": 1,
"stream_format": "<string>"
}
'import requests
url = "https://router.requesty.ai/v1/audio/speech"
payload = {
"model": "openai/gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"instructions": "Speak in a warm, friendly tone.",
"response_format": "mp3",
"speed": 1,
"stream_format": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'openai/gpt-4o-mini-tts',
input: 'The quick brown fox jumped over the lazy dog.',
voice: 'alloy',
instructions: 'Speak in a warm, friendly tone.',
response_format: 'mp3',
speed: 1,
stream_format: '<string>'
})
};
fetch('https://router.requesty.ai/v1/audio/speech', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://router.requesty.ai/v1/audio/speech",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'openai/gpt-4o-mini-tts',
'input' => 'The quick brown fox jumped over the lazy dog.',
'voice' => 'alloy',
'instructions' => 'Speak in a warm, friendly tone.',
'response_format' => 'mp3',
'speed' => 1,
'stream_format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://router.requesty.ai/v1/audio/speech"
payload := strings.NewReader("{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://router.requesty.ai/v1/audio/speech")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://router.requesty.ai/v1/audio/speech")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"openai/gpt-4o-mini-tts\",\n \"input\": \"The quick brown fox jumped over the lazy dog.\",\n \"voice\": \"alloy\",\n \"instructions\": \"Speak in a warm, friendly tone.\",\n \"response_format\": \"mp3\",\n \"speed\": 1,\n \"stream_format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body"<string>"{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}{
"error": {
"origin": "router",
"message": "<string>"
}
}Sample generated with openai/gpt-4o-mini-tts and voice="alloy".
Base URL
https://router.requesty.ai/v1/audio/speech
Authentication
Include your Requesty API key in the request headers:Authorization: Bearer YOUR_REQUESTY_API_KEY
Example Request
curl https://router.requesty.ai/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
--output speech.mp3 \
-d '{
"model": "openai/gpt-4o-mini-tts",
"input": "The quick brown fox jumped over the lazy dog.",
"voice": "alloy",
"response_format": "mp3"
}'
speech.mp3.
OpenAI SDK
The endpoint is fully compatible with the OpenAI SDK. Just point the client at Requesty’s base URL:from openai import OpenAI
client = OpenAI(
base_url="https://router.requesty.ai/v1",
api_key="YOUR_REQUESTY_API_KEY",
)
with client.audio.speech.with_streaming_response.create(
model="openai/gpt-4o-mini-tts",
input="The quick brown fox jumped over the lazy dog.",
voice="alloy",
response_format="mp3",
) as response:
response.stream_to_file("speech.mp3")
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({
baseURL: "https://router.requesty.ai/v1",
apiKey: process.env.REQUESTY_API_KEY,
});
const response = await client.audio.speech.create({
model: "openai/gpt-4o-mini-tts",
input: "The quick brown fox jumped over the lazy dog.",
voice: "alloy",
response_format: "mp3",
});
const buffer = Buffer.from(await response.arrayBuffer());
await fs.promises.writeFile("speech.mp3", buffer);
Supported Models
Browse the full catalog on the Speech model library. Today the available speech models are all from OpenAI:| Model | Best for | Notes |
|---|---|---|
openai/gpt-4o-mini-tts | Most use cases | Highest quality. Supports instructions and SSE streaming. |
openai/tts-1 | Real time, low latency | Lightweight, no instructions, no SSE. |
openai/tts-1-hd | Higher fidelity offline use | No instructions, no SSE. |
openai/gpt-4o-mini-tts-2025-12-15) are also available when you need a stable model version.
Voices
The following voices are available across the supported models. Audio previews are on the OpenAI text to speech guide.alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse
Voice Steering with instructions
Use instructions to steer tone, accent, pacing, and emotion. Only openai/gpt-4o-mini-tts supports this field. It is ignored by openai/tts-1 and openai/tts-1-hd.
curl https://router.requesty.ai/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
--output greeting.mp3 \
-d '{
"model": "openai/gpt-4o-mini-tts",
"input": "Welcome aboard. Sit back and enjoy the flight.",
"voice": "nova",
"instructions": "Speak in a calm, reassuring flight attendant voice."
}'
Output Formats
Setresponse_format to control the audio container of the returned bytes.
| Format | Content-Type | Notes |
|---|---|---|
mp3 (default) | audio/mpeg | Compressed. Good for storage and general playback. |
opus | audio/opus | Compressed, very low latency. Good for streaming. |
aac | audio/aac | Compressed, broad device compatibility. |
flac | audio/flac | Lossless compression. |
wav | audio/wav | Uncompressed. Easy to decode. |
pcm | audio/pcm | Raw 24 kHz, 16 bit, mono PCM samples. Lowest latency for real time pipelines. |
Streaming with Server-Sent Events
Setstream_format to sse to receive a Server-Sent Events stream of speech.audio.delta events with base64 encoded audio chunks, terminated by a speech.audio.done event with usage information. Only openai/gpt-4o-mini-tts supports SSE.
stream_format is optional and most clients should omit it. Without it, every supported model returns the raw audio bytes in the requested response_format. Set stream_format to sse only with openai/gpt-4o-mini-tts to opt in to the SSE event stream. Setting sse with openai/tts-1 or openai/tts-1-hd, or audio with openai/gpt-4o-mini-tts, returns a 400.curl https://router.requesty.ai/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_REQUESTY_API_KEY" \
-N \
-d '{
"model": "openai/gpt-4o-mini-tts",
"input": "Streaming speech, chunk by chunk.",
"voice": "alloy",
"stream_format": "sse"
}'
event: speech.audio.delta
data: {"type":"speech.audio.delta","audio":"<base64 audio chunk>"}
event: speech.audio.done
data: {"type":"speech.audio.done","usage":{"input_tokens":12,"output_tokens":48,"total_tokens":60}}
data: [DONE]
delta.audio field with base64 and concatenate the bytes to get the full audio payload.
Speed
Usespeed to scale playback (0.25 to 4.0, default 1.0).
{
"model": "openai/gpt-4o-mini-tts",
"input": "Reading at one and a half times speed.",
"voice": "alloy",
"speed": 1.5
}
Pricing
Speech models are priced per character of input for character billed models, and per token for token billed models. The exact rate per model is on the Speech model library. Charges appear in your usage dashboard immediately after the request completes.Error Handling
The API returns standard HTTP status codes:200Success400Bad Request (invalid parameters, unsupportedresponse_format, or unsupportedstream_formatfor the chosen model)401Unauthorized (invalid API key)404Model not found or not approved for your organization429Rate limited500Internal Server Error
client.audio.speech.create() method directly.Authorizations
API key for authentication
Body
The text-to-speech model to use, prefixed with the provider slug. Currently only OpenAI models are supported.
"openai/gpt-4o-mini-tts"
The text to synthesize into speech. Maximum length is 4096 characters.
4096"The quick brown fox jumped over the lazy dog."
The voice to use when generating the audio.
alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse "alloy"
Additional steering for the voice (tone, accent, pacing). Supported by openai/gpt-4o-mini-tts only. Ignored by openai/tts-1 and openai/tts-1-hd.
"Speak in a warm, friendly tone."
The audio container format for the synthesized output.
mp3, opus, aac, flac, wav, pcm "mp3"
Playback speed of the generated audio. 1.0 is normal speed.
0.25 <= x <= 41
Optional and not recommended for most clients. Omit this field to get the default response shape: raw audio bytes in the requested response_format. Set to sse only with openai/gpt-4o-mini-tts to receive a Server-Sent Events stream of speech.audio.delta and speech.audio.done events with base64-encoded audio chunks. The router rejects sse with openai/tts-1 or openai/tts-1-hd, and rejects audio with openai/gpt-4o-mini-tts.
Response
Audio bytes stream (when stream_format is audio) or Server-Sent Events stream (when stream_format is sse).
The response is of type file.
Was this page helpful?