Text-to-Speech API: OpenAI Compatible Endpoint for Easy Migration

March 21, 2026

If you're using OpenAI's text-to-speech API, you can switch to TTS.ai with minimal code changes. Our OpenAI-compatible endpoint uses the same request format, so migration takes minutes — and you get access to 20+ models instead of just one.

The Endpoint

TTS.ai offers an OpenAI-compatible endpoint at:

POST https://tts.ai/v1/audio/speech

It accepts the same payload format as OpenAI's API:

curl https://tts.ai/v1/audio/speech \
  -H "Authorization: Bearer sk-tts-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tts-1",
    "voice": "alloy",
    "input": "Hello from TTS.ai!"
  }' \
  --output speech.mp3

Migrating from OpenAI

If you're using the OpenAI Python SDK, just change the base URL:

from openai import OpenAI

client = OpenAI(
    api_key="sk-tts-YOUR_KEY",
    base_url="https://tts.ai/v1"
)

response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="Hello from TTS.ai!"
)
response.stream_to_file("speech.mp3")

The model="tts-1" maps to Kokoro by default. You can also specify any TTS.ai model directly:

response = client.audio.speech.create(
    model="kokoro",
    voice="af_bella",
    input="Hello from TTS.ai!"
)

Why Switch?

  • More models — 20+ TTS models vs. OpenAI's single model. Compare quality and find the best voice for your use case.
  • Voice cloning — Clone any voice from a short audio sample. OpenAI doesn't offer this.
  • Open source models — Most models are Apache 2.0 or MIT licensed. No vendor lock-in.
  • Lower cost — Competitive pricing with a generous free tier (15,000 characters on signup).
  • More voices — Hundreds of voices across multiple languages and styles.

Supported Parameters

ParameterOpenAITTS.ai
modeltts-1, tts-1-hdAny model name (kokoro, chatterbox, dia, etc.)
voicealloy, echo, fable, onyx, nova, shimmerAny voice ID from our catalog
inputText stringText string
response_formatmp3, opus, aac, flacmp3, wav, flac, ogg
speed0.25 to 4.0Model-dependent

Get Your API Key

Sign up at TTS.ai API to get your API key. Free tier includes 15,000 characters — enough to test your migration thoroughly before committing.


Вы гатовыя паспрабаваць TTS.ai?

Падпісацца бясплатна