Audio speech (TTS)
Generate audio from text. OpenAI-compatible.
POST https://api.ecohash.com/v1/audio/speech
Headers
| Header | Value |
|---|---|
Authorization | Bearer eco_YOUR_KEY |
Content-Type | application/json |
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | TTS model ID (e.g. kokoro-82m) |
voice | string | yes | Voice identifier supported by the model |
input | string | yes | Text to synthesize, up to 4000 characters |
response_format | string | no | "mp3" (default), "wav", or "opus" |
speed | number | no | 0.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.