Generate speech and audio through a unified API. Currently supports Volcengine and Alibaba Bailian model families.
Endpoint and authentication
| Item | Value |
|---|---|
| Generation endpoint | POST https://routerbrain.ai/audio/v1/generations |
| Task query | GET https://routerbrain.ai/audio/v1/tasks/:task_id |
| Authentication | Authorization: Bearer <API-Key> |
| Content-Type | application/json |
The generation endpoint supports three modes:
- Synchronous:
stream: false, task: false - SSE streaming:
stream: true, task: false - Async task:
stream: false, task: true
stream and task cannot both be true. Whether a model supports streaming or async tasks depends on the model catalog.
Quick example
curl -X POST https://routerbrain.ai/audio/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{"model": "<audio-model>", "prompt": "Welcome to the audio generation service.", "voice": "<voice>", "stream": false, "task": false}'
{
"created": 1719000000000,
"data": [{ "url": "https://example.com/audio.mp3" }],
"usage": { "billing_method": "characters", "characters": 12 },
"task_id": null,
"task_status": null
}
Provider capabilities
| Provider | Capability | Billing | Streaming | Async task |
|---|---|---|---|---|
| Volcengine Audio Generation HTTP V3 | Audio generation | Per duration | No | No |
| Volcengine Unidirectional Streaming TTS | Speech synthesis | Per character | Yes | No |
| Volcengine Async Long-text TTS | Long-text speech | Per character | No | Yes |
| Alibaba Bailian CosyVoice/Qwen-Audio-TTS | Speech synthesis | Per character | Yes | No |
| Alibaba Bailian Qwen-TTS | Speech synthesis | Per character | Yes | No |
| Alibaba Bailian MiniMax TTS | Speech synthesis | Per character | Yes | No |
Billing methods:
- duration: Charged per output audio second. Unit:
credits/second. - characters: Charged per input character. Unit:
credits/character.
Query models and pricing
# List audio models
curl "https://routerbrain.ai/audio/v1/models?q=tts" \
-H 'Authorization: Bearer sk-xxxxxxxx'
# Query endpoint pricing for a specific model
curl "https://routerbrain.ai/audio/v1/models/<audio-model>/endpoints" \
-H 'Authorization: Bearer sk-xxxxxxxx'
Task status flow
pending -> running -> success
-> failed
-> cancelled