Create Task
Submit a unified image or video generation task; the server infers the task family from model and returns a task ID.
/v1/generationsThis is the main public async media task creation endpoint.
Created tasks, charges, and generated assets belong to the API key's workspace and cannot be reassigned with request headers.
You do not need separate image and video create APIs. Call:
POST /v1/generationsThe server decides whether the task is image or video based on model.
Overview
| Item | Description |
|---|---|
| Route | POST /v1/generations |
| Auth | Authorization: Bearer sk_aibubu_xxx |
| Idempotency | Strongly recommended via Idempotency-Key |
| Request body | application/json |
| Response | 201 Created + task object |
| Result retrieval | Poll GET /v1/tasks/{task_id} or wait for webhook |
Integration Note
Do not treat this as a synchronous result endpoint. A successful create response usually means the task was accepted, not completed.
Authorizations
Authorization: Bearer sk_aibubu_your_api_key
Content-Type: application/json
Idempotency-Key: gen-demo-001Header notes
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer sk_aibubu_xxx |
Content-Type | Yes | Must be application/json |
Idempotency-Key | Strongly recommended | Prevents duplicate task creation during retries |
Body
Required fields
| Field | Type | Required | Example | Description |
|---|---|---|---|---|
model | string | Yes | gpt-image-2 | Target model. The server maps it to image or video automatically |
prompt | string | Yes | A cinematic fashion poster... | Generation instruction |
Common optional fields
Supported by POST /v1/images/generations, POST /v1/videos/generations, and POST /v1/generations.
| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
callback_url | string | No | - | https://example.com/aibubu/callback | Per-task callback URL; must be a public https URL, at most 2048 characters. When the task succeeds, fails, or is canceled, the terminal event is signed with the workspace callback_url signing secret and sent here. Returns callback_secret_required if the workspace has no such secret, or invalid_callback_url if the URL is invalid. See Webhooks |
Common image fields
Applies to current public image models. Use schema.fields from GET /v1/models as the source of supported fields and enums.
| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
reference_images | string[] | No | - | ["https://.../ref1.png"] | Reference image URLs. Call Upload Reference Image to get a hosted URL. |
aspect_ratio | string | No | auto | 1:1 | Output aspect ratio; 2.5 variants use this field, while 2.6 Official uses size |
resolution | string | No | Model-specific | 1K | Output resolution |
n | integer | No | 1 | 2 | Number of images requested; ordinary variants are fixed at 1, while 2.6 Official supports 1–4 |
quality | string | No | Model-specific | low | Send only when declared by the model schema; Official variants support auto, low, medium, high, xhigh, and max, while ordinary variants force high |
size | string | No | 1:1 | 1:1 | Canvas field for 2.6 Official; do not mix it with aspect_ratio |
input_mode | string | No | text_to_image | text_to_image | text_to_image or image_edit; editing requires reference_images |
GPT Image 2.5/2.6 models
Ordinary Flare/Sunburst variants force high quality and n=1, billed per successful image. Official variants settle five actual token dimensions; 2.5 Official uses aspect_ratio, while 2.6 Official uses size and supports n=1–4.
{
"model": "gpt-image-2.6-sunburst-official",
"prompt": "A ceramic coffee cup on a white background",
"input_mode": "text_to_image",
"size": "1:1",
"resolution": "1K",
"quality": "low",
"n": 1
}Flare, Sunburst, and Official variants use distinct model IDs. Read schema.fields from GET /v1/models before sending a request; do not copy fields between models.
Common video fields
Applies to current public video models. Supported fields must come from the selected model's schema in GET /v1/models.
| Field | Type | Required | Default | Example | Description |
|---|---|---|---|---|---|
reference_images | string[] | No | - | ["https://.../ref.png"] | Reference image URLs, up to 9 for Seedance 2 models |
reference_videos | string[] | No | - | ["https://.../ref.mp4"] | Reference video URLs, up to 3; may enable input-video billing |
input_video_duration | number | No | Output duration | 8 | Actual processed input-video seconds |
reference_audios | string[] | No | - | ["https://.../ref.mp3"] | Reference audio URLs, up to 3 |
generate_audio | boolean | No | true | true | Whether to generate audio |
audio | boolean | No | false | false | Kling generated-audio switch; send only when declared by the schema |
mode | string | No | Model-specific | pro | Kling quality tier, commonly std, pro, or 4k |
first_frame_image_url | string | No | - | https://.../first.png | First-frame image URL; send only when declared by the schema |
last_frame_image_url | string | No | - | https://.../last.png | Last-frame image URL; send only when declared by the schema |
aspect_ratio | string | No | Model-specific | 16:9 | Video aspect ratio |
resolution | string | No | Model-specific | 720p | Video resolution |
duration | integer | No | Model-specific | 5 | Duration in seconds |
Parameters are model-schema driven. Each model returned by
GET /v1/modelsincludesschema.fieldswith types, required/default values, enumoptions, and some limits. Do not copy fields between models.
Seedance 2/2.5, Kling 3, and Gemini Omni do not share an identical video contract. Seedance commonly uses duration, resolution, aspect_ratio, and reference media; Kling may additionally declare mode, audio, or sound; Gemini Omni may declare generate_audio. Send these fields only when they appear in the target model's schema.fields.
Seedance review flow
Reference images, videos, and audio for Seedance 2, 2 Fast, 2 Mini, and 2.5 pass through the seedance-private-v1 review policy:
- Up to 12 reference assets are accepted in total, limited to image and video media types; each field still follows the per-model
schema.fieldslimit. - Upload assets first and submit their returned URLs. Do not send local paths or browser-only temporary URLs.
- If review rejects the request, the task does not reach the upstream provider. Fix the assets and submit a new compliant request instead of retrying the same rejected payload.
This flow applies only to Seedance models that declare reference_review; use the task response for the final review status and error code.
Kling V3 Omni and Kling Video O1 use reference_videos with input_video_duration. With reference videos, Kling V3 Omni requires audio=false; Kling Video O1 has no audio field. Gemini Omni Flash currently exposes only duration=10.
Virtual avatars
seedance-2, seedance-2-fast, and seedance-2-mini support virtual-avatar mode. Upload the source assets first, then submit their returned asset_id values:
{
"model": "seedance-2",
"prompt": "A product video with the selected virtual character",
"avatar_mode": "virtual",
"avatar_asset_ids": ["asset_01jxyz..."]
}Up to 5 avatar assets may be submitted. Avatar assets differ from ordinary reference_images: they enter the provider review flow before generation continues. Pending review returns avatar_review_pending; unavailable assets return avatar_reference_invalid; provider setup failures return avatar_provider_unavailable.
External reference video and audio URLs
Upload Reference Image (POST /v1/uploads/images) accepts images only; Upload Reference Media (POST /v1/uploads/files) accepts image, video, and audio files up to 64 MB, and its returned url can be used in the corresponding reference-media fields. You can also host reference_videos and reference_audios on HTTPS URLs that Aibubu can download without cookies or custom headers, remain valid until the task completes, and return the correct Content-Type. Prefer signed URLs valid for several hours. Do not send local paths, blob: URLs, or browser-session-only resources. Limits follow the selected model's schema.fields and upstream validation.
Response
A successful create call returns a submission receipt, not the full task object. Fetch GET /v1/tasks/{task_id} for status, model, result, and error fields.
{
"created": 1784779200,
"task_id": "task_01jxyz...",
"object": "generation.task",
"progress": 0,
"billing_transaction_id": "bt_01jxyz..."
}Response fields
| Field | Type | Description |
|---|---|---|
task_id | string | Task ID used for polling and webhook reconciliation |
created | integer | Unix creation timestamp |
object | string | Always generation.task |
progress | integer | Progress at submission response time |
billing_transaction_id | string | Billing transaction ID for reconciliation; use task_id for task lookup |
data | array | May appear only if work has already completed; normally absent for async tasks |
What to do next
- Store
task_id - Poll
GET /v1/tasks/{task_id} - Or configure workspace webhooks on
/console/webhooks(or passcallback_url) and wait fortask.succeeded,task.failed, ortask.canceled
Verified video duration limits
seedance-2,seedance-2-fast, andseedance-2-mini: 4–15 seconds; Mini defaults to 4 seconds, Fast and standard default to 5.seedance-2.5: 4–30 seconds, default 5; supports text, image, first/last-frame, reference-video, video-edit, and audio input modes.grok-video-1.5: 1–6 seconds, default 6; supports first-frame and reference-image modes at 480p/720p.kling-v2.6andkling-video-o1: 5 or 10 seconds; thekling-v3family supports 4–15 seconds.gemini-omni-flashandomni-1.1: currently expose 10 seconds only.wan3.0-videoandwan3.0-video-prime: 2–30 seconds, default 5;generate_audiocurrently accepts only"false".
These limits come from the live schemas in both regions; still use GET /v1/models as the source of truth.

