When stream: false, task: true, the endpoint creates an async task and returns a task_id immediately. Poll GET /audio/v1/tasks/:task_id for results.
Task creation response
{
"created": 1719000000000,
"data": [],
"usage": null,
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"task_status": "pending"
}
Query task status
curl https://routerbrain.ai/audio/v1/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H 'Authorization: Bearer sk-xxxxxxxx'
On success
{
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"task_status": "success",
"model": "<async-audio-model>",
"created": 1719000000000,
"updated": 1719000005000,
"completed": 1719000005000,
"data": [{ "url": "https://example.com/audio.mp3" }],
"usage": { "billing_method": "characters", "characters": 1200 },
"error": null
}
On failure
{
"task_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"task_status": "failed",
"model": "<async-audio-model>",
"created": 1719000000000,
"updated": 1719000050000,
"completed": 1719000050000,
"data": [],
"error": { "code": "upstream_task_failed", "message": "audio generation task failed" }
}
Response fields
| Field | Type | Description |
|---|---|---|
task_id | string | Task ID |
task_status | 'pending' | 'running' | 'success' | 'failed' | 'cancelled' | Task status |
model | string | Requested model |
created | number | null | Task creation timestamp in ms |
updated | number | null | Task update timestamp in ms |
completed | number | null | Task completion timestamp in ms |
data | Array<{ url?: string }> | Audio URL on success |
usage | object | null | Usage information |
error | { code: string; message: string } | null | Error info on failure |
Status flow
pending -> running -> success
-> failed
-> cancelled
Polling recommendations
- Start with a 3-second poll interval.
- Stop polling after reaching your business timeout.
- Async tasks support
upstream_options.unique_idfor idempotency.