Skip to main content
AIHubMix provides three groups of task endpoints: /ai/v1/images for images, /ai/v1/videos for videos, and /ai/v1/tasks for unified task records.
  • Image generation is synchronous by default and runs asynchronously when async: true is provided.
  • Video generation is always asynchronous.
  • Image and video detail endpoints return the latest status of media tasks.
  • /ai/v1/tasks provides a unified read-only view of image, video, and LLM tasks.
When a Doubao Seedance video needs real-person assets, complete personal verification and asset preparation using the Doubao Real-Person Assets Guide before creating the video task.

Video tutorial: Async Tasks

Learn how async tasks work and follow a complete async image generation workflow.

Enable async tasks in the console

Before using the /ai/v1 media task endpoints, enable async tasks for the current account.
When async tasks are not enabled, image and video task creation requests return 403 async_not_enabled.

Quickstart

The following example uses wan2.6-t2v to create a video. This model accepts duration and size; valid fields vary by model.

Which API Group Should You Use?

The base URL is https://aihubmix.com. Authenticate with a Bearer token:
The model list and model Schema endpoints are public discovery endpoints and do not require a Bearer Token. All other endpoints require authentication.
/ai/v1/tasks does not provide a creation endpoint. Images and videos must be created through their respective media generation endpoints. LLM recovery tasks are saved automatically by the platform after a client interruption.

Media Endpoints and Unified Task Endpoints

Media detail endpoints and unified task endpoints return the same top-level task fields, but their output items and query behavior differ: Use the image or video detail endpoint to poll media generation status. Use /ai/v1/tasks to filter tasks across types, read result metadata, or recover LLM responses.

How Do You Discover Async Media Models and Get Their Schemas?

The discovery flow has two steps. First, retrieve text-to-image or text-to-video models that support the async APIs from the public model catalog. Then use a model’s model_id to retrieve the request Schema for its endpoints.

List Models That Support the Async APIs

The model catalog uses the same data source as Playground. Use type=image_generation for text-to-image models and type=video for text-to-video models. Adding schema_checked=true limits the list to models with a published and reviewed request Schema.
Both requests use the same endpoint. The type filter currently accepts one value, so request each model type separately. The response has the shape {success, message, data}. The following fields in data are relevant to async media integrations.

Get the Request Schema for One Model

Supported fields, enumerations, and numeric ranges can vary by model. Before submitting an image or video request, use the public endpoint below to retrieve the available endpoints and request JSON Schemas for the selected model.
The response has a modality of image or video. Each item in the endpoints array describes one available calling protocol. A model may return both /ai/v1 endpoints and OpenAI-compatible /v1 endpoints. OpenAI-compatible endpoints may not yet support the latest models, so prefer the /ai/v1 endpoints. For async task APIs, select the item whose path is /ai/v1/images/generations or /ai/v1/videos, then use its request.schema. Do not depend on the position of an item in the endpoints array. The following commands extract the request Schema for each async task endpoint.
The endpoint returns 404 model_not_found when the model does not exist or has no discoverable endpoints. It returns 500 endpoints_unavailable when endpoint data is temporarily unavailable.

Which Models and Fields Are Supported?

The image and video protocols define standard fields across models, but each model narrows the supported fields, enumerations, and numeric ranges based on its capabilities. Before making a request, retrieve the model’s current constraints from the model Schema endpoint. For example:
  • wan2.6-t2v supports duration, size, and seed. It does not accept resolution, aspect_ratio, frame_images, input_references, or generate_audio.
  • qwen-image-2.0 supports n, size, seed, negative_prompt, image, and images. It does not accept aspect_ratio or mask.
The standard field set does not mean that every model supports every field. Passing a field unsupported by the selected model returns a parameter error.

Models for LLM Interruption Recovery

The following models are currently supported:
  • gpt-5.6-sol
  • gpt-5.5-pro
  • gpt-5.4-pro
  • gpt-5.2-pro
  • claude-fable-5
  • claude-opus-5
The supported range may change. Refer to the list on this page for the current range. The current account must also have async tasks enabled to use interruption recovery. If either condition is not met, the original LLM request still runs normally, but no recovery task is saved after the client disconnects.

How Do You Create Image Tasks?

Synchronous Images

When async is omitted or set to false, the endpoint waits for generation to finish and returns a task object:
Synchronous image tasks also save a task record. If the client connection is interrupted or the creation response is lost, use GET /ai/v1/images to find the corresponding task.

Asynchronous Images

When async is set to the Boolean value true, the endpoint returns a task object immediately and generation continues in the background:
Use GET /ai/v1/images/{id} to query an asynchronous image task. After completion, request the content_url from each output item directly. The URL already contains the corresponding image result_id.
async in an image request must be a Boolean. webhook_url and webhook_events_filter can only be used with async: true.

Standard Image Fields


How Do You Create Video Tasks?

Video requests are always asynchronous and cannot be changed to synchronous waiting with Prefer: wait. The standard protocol uses the integer field duration for the number of seconds:

Standard Video Fields

Structure of an input_references item:
type can be image_url, video_url, or audio_url. Structure of a frame_images item:
frame_type can be first_frame or last_frame.

Media Task Object

Image and video endpoints return the following structure:
Media output item:

Status Reference

Clients can query every 15 seconds until the status becomes completed, failed, or cancelled. The 15-second interval is a client polling recommendation, not a server protocol limit.

How Do You Query Media Tasks?

Get Media Details

Media detail endpoints can return an updated task status, so use the corresponding image or video detail endpoint for media polling.

List Media Tasks

If the creation response is lost, use the corresponding media list to recover the task ID:
Media lists return task snapshots at query time and do not actively update task status.

How Do You Use the Unified Task API?

The unified task API supports the following filters:
Unified task details:
A unified output item for a media task:
For a single-artifact task, request /ai/v1/tasks/{id}/content directly. For a multi-artifact task, request /ai/v1/tasks/{id}/content/{result_id}. Omitting the result ID returns 400 result_id_required.
Unified task list, detail, and content endpoints are isolated by the Bearer token used to create the task. Other API Keys under the same account cannot read the task.

How Do You Download Media Results?

Download Images

After an image task is completed, request output[].content_url from the media task object for each result:
The media download path for images is /ai/v1/images/{id}/content/{result_id}. The media task object does not expose result_id separately, so clients can use content_url directly. When b64_json is not empty, decode that field directly from Base64.

Download Videos

Results may expire, and download limits may apply. An expired result returns 410 artifact_expired; exceeding the download limit returns 429 too_many_downloads.

How Do You Use Webhooks?

Asynchronous images and videos support task-level webhooks:
webhook_url can be up to 512 characters and cannot point to localhost, private networks, or other restricted addresses. When webhook_events_filter is omitted, the platform sends completed, failed, and cancelled. When explicitly provided, the array must not be empty or contain duplicates, and it must be used with webhook_url. When webhook_url is omitted from the request, asynchronous image and video tasks try to use the default callback URL configured for the account. An invalid account default is ignored and does not prevent task creation.

Callback Request

results appears only when results have been archived. Downloads still require a Bearer token.

Retries and Deduplication

The platform uses at-least-once delivery, so the same event may be delivered more than once:
  • HTTP 2xx indicates successful receipt.
  • HTTP 5xx, network errors, or timeouts trigger a retry.
  • HTTP 3xx and 4xx are not retried.
  • Up to 6 delivery attempts are made, with retry intervals of 1, 4, 16, 64, and 256 seconds.
The receiver should store event_id and return 2xx immediately when the same event is received again.
Task-level webhooks do not include a separate signing secret. If signature verification is required, configure an account-level webhook subscription and retain task detail queries as the method for confirming results.

How LLM Interruption Recovery Works

LLM interruption recovery retrieves the final response after the client disconnects. The request method, streaming behavior, and response format remain unchanged, and no task ID is returned in advance when the request starts. All of the following conditions must be met: The platform creates a recovery task and saves the final JSON or SSE only when it detects that the response was not delivered completely and the client has disconnected. LLM requests that finish normally and are delivered completely to the client do not create recovery tasks. LLM response headers contain X-Aihubmix-Request-Id. Clients should save this value as early as possible so the request can be located in the console. The public task API currently cannot filter by request ID. Recent LLM tasks can be queried by model and creation time:
A unified output item for an LLM task contains type=response, content_type, content_url, and truncated. GET /ai/v1/tasks/{id}/content returns the saved original JSON or SSE.
LLM interruption recovery tasks currently do not send task-level webhooks. A client interruption does not stop the platform from continuing to process the request, and the call is still billed according to the rules of the original endpoint.

Error Responses and Error Codes

This section applies to /ai/v1/images/*, /ai/v1/videos/*, and media tasks under /ai/v1/tasks/* where object=image or object=video. Clients must handle both non-2xx HTTP responses and terminal tasks returned with HTTP 200 and status=failed.

Submit HTTP 5xx error feedback

Only when a request returns HTTP 5xx, submit feedback and include error.tid.

Non-2xx HTTP Errors

The invalid_request and schema_violation rows show fallback messages. When the service can identify a specific field or parameter constraint, it returns a dynamic message. Clients should classify errors by code instead of exact-matching message. The message for media_form_unsupported is generated from the confirmed cause. Common templates are listed below: For example, if the model allows PNG, JPEG, WebP, HEIC, and HEIF, a GIF image returns:

HTTP 200 + Task status=failed

A successful query does not mean that generation succeeded. When a task is failed, read the failure reason from error.code and error.message in the task object:

Complete Video Example


FAQ

Should a media task be queried through /ai/v1/tasks/{id} or the media detail endpoint? Use the media detail endpoint to poll generation status: /ai/v1/images/{id} for images and /ai/v1/videos/{id} for videos. /ai/v1/tasks/{id} returns a read-only snapshot. Why does seconds in a video request return a parameter error? The standard /ai/v1/videos protocol uses the integer field duration, measured in seconds. The allowed values depend on the parameters supported by the corresponding model. Why does resolution return a parameter error for some video models? The standard video protocol includes resolution and size, but individual models narrow the supported fields. For example, wan2.6-t2v uses size and does not accept resolution. How can a media task be recovered after the creation response is lost? Request GET /ai/v1/images for images or GET /ai/v1/videos for videos. The lists support the after, limit, and order pagination parameters. Why do the two detail endpoints have different output fields? Media detail endpoints provide the simplified fields required for direct downloads. Unified task endpoints additionally provide result_id and content_type, as well as truncated for archived LLM responses. What should I do if a webhook is not received? Confirm that the callback URL is publicly accessible and returns 2xx promptly, then query the final status through the media detail endpoint.
Last updated: 2026-08-12