Audio Speech

POST/api/v1/audio/speech

Convert 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-key

Request body

ParameterTypeRequiredDescription
modelstringYestts-1 or tts-1-hd
inputstringYesThe text to synthesize. Maximum 4,096 characters.
voicestringYesVoice 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.mp3

JavaScript

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

ModelProviderQualityNotes
tts-1OpenAIStandardOptimized for speed and low latency
tts-1-hdOpenAIHigh definitionHigher quality audio, slightly slower

Available voices

alloy
echo
fable
onyx
nova
shimmer

Each 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.