Audio Speech
POST
/api/v1/audio/speechConvert text to speech using OpenAI's TTS models via the Meridian proxy. Returns an audio file in the response body.
Authentication
Pass your Meridian proxy key as a Bearer token:
Header
Authorization: Bearer sk-mrd-your-proxy-keyRequest body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | tts-1 or tts-1-hd |
input | string | Yes | The text to synthesize. Maximum 4,096 characters. |
voice | string | Yes | Voice to use: alloy, echo, fable, onyx, nova, or shimmer |
Response
Returns the audio file as a binary response with Content-Type: audio/mpeg. Save the response body directly as an .mp3 file.
Examples
curl
curl
curl -X POST https://your-meridian.vercel.app/api/v1/audio/speech \
-H "Authorization: Bearer sk-mrd-your-proxy-key" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1-hd",
"input": "Meridian is an open-source LLM API gateway.",
"voice": "nova"
}' \
--output speech.mp3JavaScript
JavaScript (Node.js)
import { writeFile } from "fs/promises";
const response = await fetch(
"https://your-meridian.vercel.app/api/v1/audio/speech",
{
method: "POST",
headers: {
"Authorization": "Bearer sk-mrd-your-proxy-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "tts-1-hd",
input: "Meridian is an open-source LLM API gateway.",
voice: "nova",
}),
}
);
const buffer = Buffer.from(await response.arrayBuffer());
await writeFile("speech.mp3", buffer);
console.log("Saved to speech.mp3");Python
Python (requests)
import requests
response = requests.post(
"https://your-meridian.vercel.app/api/v1/audio/speech",
headers={
"Authorization": "Bearer sk-mrd-your-proxy-key",
"Content-Type": "application/json",
},
json={
"model": "tts-1-hd",
"input": "Meridian is an open-source LLM API gateway.",
"voice": "nova",
},
)
with open("speech.mp3", "wb") as f:
f.write(response.content)
print("Saved to speech.mp3")Supported models
| Model | Provider | Quality | Notes |
|---|---|---|---|
tts-1 | OpenAI | Standard | Optimized for speed and low latency |
tts-1-hd | OpenAI | High definition | Higher quality audio, slightly slower |
Available voices
alloyechofableonyxnovashimmerEach voice has a distinct character. Experiment with different voices to find the best fit for your use case. Preview voices on the OpenAI TTS guide.