Documentation Index
Fetch the complete documentation index at: https://docs.rixapi.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
The unified async task API provides a standardized submit → poll → retrieve workflow, abstracting away provider-specific differences.
Overview
AI tasks such as video generation, image generation, and music generation can take anywhere from tens of seconds to several minutes. To ensure a good user experience and system stability, these tasks are handled through an async task API:- Submit a task — Send a generation request and immediately receive a task ID
- Poll for status — Use the task ID to check progress, or receive a callback notification
- Retrieve results — Once complete, get the generated resource URLs from the response
Submit a Task
POST /v1/task/submitRequest Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name |
input | object | Yes | Model-specific generation parameters |
callback_url | string | No | Webhook URL for task status updates |
Request Examples
Response Example
Query a Task
GET /v1/task/{task_id}Request Examples
Response Examples
Task in progress:Task Statuses
| Status | Description |
|---|---|
queued | Task submitted, waiting to be processed |
in_progress | Task is currently being generated |
completed | Task finished — results available in outputs |
failed | Task failed — reason available in error |
Callback Notifications
When you include acallback_url in your submit request, the system will send a POST request to that URL whenever the task status changes. The callback body uses the same format as the query response:
Complete Polling Example
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique task identifier |
status | string | Task status: queued / in_progress / completed / failed |
created_at | integer | Task creation time (Unix timestamp in seconds) |
completed_at | integer | Task completion time (Unix timestamp in seconds), only present when completed or failed |
outputs | string[] | List of result URLs (video/image/audio), only present when completed |
usage | object | Task usage information; see Usage Information section. Only present in terminal states for supported models |
error | string | Error message, only present when failed |
Usage Information
After a task reaches a terminal state (completed / failed), some models include a usage field in the response that reports the actual resources consumed. The usage field is a tagged union: the type field distinguishes the metering unit.
type=tokens (token-based billing)
Used by Doubao / Vidu / Ali / Kling text-based / Gemini and other token-billed tasks:| Field | Type | Description |
|---|---|---|
type | string | Always "tokens" |
input_tokens | integer | Total input tokens |
input_token_details | object | Input token breakdown by modality (optional); zero-valued sub-fields are omitted, and the entire object is omitted when all sub-fields are zero |
input_token_details.text_tokens | integer | Text input tokens |
input_token_details.audio_tokens | integer | Audio input tokens |
input_token_details.image_tokens | integer | Image input tokens |
input_token_details.cached_tokens | integer | Tokens served from prompt cache (compatible with OpenAI prompt cache) |
output_tokens | integer | Total output tokens |
output_token_details | object | Output token breakdown by modality (optional); same omission rules as input_token_details |
total_tokens | integer | input_tokens + output_tokens total |
type=duration (duration-based billing)
Used by Sora / Xai-video and other video generation tasks billed by output duration:| Field | Type | Description |
|---|---|---|
type | string | Always "duration" |
seconds | number | Task usage duration in seconds (decimal allowed) |
- Tasks billed strictly per-call (e.g., Flux / Replicate / Midjourney) do not return a
usagefield - The
usagefield is not returned while the task isqueuedorin_progress - Historical tasks and tasks where the upstream did not report usage data also omit this field
- Sub-fields with a zero value (e.g.,
text_tokens: 0) are omitted
Notes
Related Links
Video Models
Provider-specific video generation API documentation
Image Models
Image generation API documentation