Skip to main content

Audio speech (TTS)

Generate audio from text. OpenAI-compatible.

POST https://api.ecohash.com/v1/audio/speech

Headers

HeaderValue
AuthorizationBearer eco_YOUR_KEY
Content-Typeapplication/json

Request body

FieldTypeRequiredNotes
modelstringyesTTS model ID (e.g. kokoro-82m)
voicestringyesVoice identifier supported by the model
inputstringyesText to synthesize, up to 4000 characters
response_formatstringno"mp3" (default), "wav", or "opus"
speednumberno0.5–2.0 playback speed multiplier

Example request

curl https://api.ecohash.com/v1/audio/speech \
-H "Authorization: Bearer eco_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kokoro-82m",
"voice": "af_bella",
"input": "Hello from EcoLink."
}' \
--output hello.mp3

Response

The response body is the audio bytes directly, with Content-Type matching the requested format (audio/mpeg, audio/wav, or audio/ogg). Pipe directly to a file.

Errors

See Errors. Common: 401, 402, 404, 429.