Text-to-speech
Synthesize speech from text. The endpoint returns raw audio bytes — pipe them to a file, an HTTP response, or an <audio> element. Deepgram Aura voices and ElevenLabs voices are both supported.
Synthesize speech
/v1/audio/speechauth · sk-echoReturns binary audio (typically MP3). No JSON envelope — write the response body straight to a file or stream it.
from openai import OpenAI
client = OpenAI(
base_url="https://api.echotokens.me/v1",
api_key="sk-echo-...",
)
with client.audio.speech.with_streaming_response.create(
model="deepgram_aura_2",
voice="aura-2-arcas-en",
input="Welcome to echotokens. One endpoint for every media model.",
) as resp:
resp.stream_to_file("welcome.mp3")Parameters
- parameter
modeltypestringrequiredrequiredTTS model id. See the catalog below. - parameter
inputtypestringrequiredrequiredText to convert. Deepgram caps at 2000 chars per request; ElevenLabs at 5000. - parameter
voicetypestringrequiredoptionalVoice id (e.g. aura-2-arcas-en for Deepgram, or an ElevenLabs voice id). - parameter
languagetypestring (ISO 639-1)requiredoptionalOptional. Hint for the synthesizer when the input is non-English.
The response is the audio file body. The X-USD-Charged-Cents response header carries the same cost_usd_cents value you'd see in JSON-bodied endpoints.
Picking a voice
Two TTS providers are available — Deepgram Aura 2 (six built-in voices) and ElevenLabs (custom voice library). Use the model + voice id combo to switch.
catalog auto-syncs from the upstream every 6h · canonical pricing at /pricing
All Aura voices use model="deepgram_aura_2" — the voice field selects the persona.
ElevenLabs
ElevenLabs models — eleven_multilingual_v2 and eleven_flash_v2_5 — are also supported. The voice field takes an ElevenLabs voice id directly:
client.audio.speech.create(
model="eleven_multilingual_v2",
voice="JBFqnCBsd6RMkjVDRZzb", # George, an ElevenLabs voice
input="Hello from echotokens.",
)For ElevenLabs voices not catalogued in our portal (the voice studio picker shows the ones we know), you can still pass any valid voice id directly. The request goes through; if the upstream rejects the id, you'll get a clean 400 back. See /docs/errors for the error envelope shape.
Picking a language
For TTS, language is usually inferred from the script and the voice. Pass language only when you need to override that inference — e.g. an English-trained voice reading a Spanish phrase.
The portal's TTS studio includes a searchable ISO 639-1 dropdown so you don't have to remember codes.
Type a script, pick a voice, hear the result. Switch to Transcribe mode to do speech-to-text instead.