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://51kik.com/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

FieldTypeDescription
task_idstringTask ID
task_status'pending' | 'running' | 'success' | 'failed' | 'cancelled'Task status
modelstringRequested model
creatednumber | nullTask creation timestamp in ms
updatednumber | nullTask update timestamp in ms
completednumber | nullTask completion timestamp in ms
dataArray<{ url?: string }>Audio URL on success
usageobject | nullUsage information
error{ code: string; message: string } | nullError 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_id for idempotency.