# 创建视频任务（ARK 兼容路径）

与 `POST /v1/videos/generations` 完全等效，但响应体直接采用官方 Volcengine Ark 的
seedance 格式：`id` 字段就是上游任务 ID，无 `upstream_id` 包裹。

用途：让已经接入官方 ARK SDK 的客户端只改 `base_url` 和 `api_key` 即可切到 XRToken。
官方 SDK 默认前缀是 `/api/v3`，XRToken 同时接受 `/api/v3`、`/v3`、`/api/v1`、`/v1`。
请求体、鉴权方式、计费、模型路由全部与 `/v1/videos/generations` 共用一套实现。
Seedance 2.5 样片模式也走这条路径：创建响应里的 `id` 就是样片任务 ID，第二步 `draft_task.id` 直接传它。

## POST /v1/contents/generations/tasks

> Create a video task (ARK alias)

Same handler as `POST /v1/videos/generations`, but the response
body matches the official Volcengine Ark seedance shape: `id`
is the upstream task id, no extra `upstream_id` wrapper.

Lets clients already wired up to the official Ark SDK switch to
XRToken by changing only `base_url` and `api_key`. The official SDK
prefix is `/api/v3`; XRToken also accepts `/api/v3`, `/v3`, `/api/v1`,
and `/v1`. Auth, billing, model routing, and channel selection are
shared with the OpenAI path.

### Authentication

`Authorization: Bearer tr-xxx`

### Request Body

Content-Type: `application/json`

- **video_url_mode** ``auto` | `upstream` | `tos``  
  Delivery address: auto prefers a usable native URL with archive fallback; upstream strictly preserves the native URL; tos waits for a verified archive. Omitted uses the account/task default. Existing accounts retain legacy behavior; new accounts default to auto. Does not disable archiving. Idle enhanced models reject upstream. Combining callback_url with an explicit mode requires a configured webhook secret; otherwise creation returns 400 webhook_secret_required.
- **model** `string` **(required)**  
  Video generation model ID. Filter by `type: video` via `GET /v1/models`.
- **content** `object[]` **(required)**  
  Input content for the model, supporting text, images, video, and audio. Supported combinations:
- **content[].type** ``text` | `image_url` | `video_url` | `audio_url` | `draft_task`` **(required)**  
  Input content type:
- **content[].text** `string`  
  Text prompt (used when `type: text`). Supports Chinese and English; recommended max 500 Chinese characters
- **content[].image_url** `object`  
  Image object (used when `type: image_url`)
- **content[].role** ``first_frame` | `last_frame` | `reference_image` | `reference_video` | `reference_audio``  
  Role or purpose of the image/video/audio:
- **content[].video_url** `object`  
  Video object (used when `type: video_url`, Seedance 2.0 only)
- **content[].audio_url** `object`  
  Audio object (used when `type: audio_url`, Seedance 2.0 only)
- **content[].draft_task** `object`  
  Draft task reference (used when `type: draft_task`). `id` is the task ID returned when the draft was created.
- **resolution** ``480p` | `720p` | `1080p` | `768P` | `2K`` (default: `720p`)  
  Output video resolution.
- **ratio** ``16:9` | `4:3` | `1:1` | `3:4` | `9:16` | `21:9` | `adaptive`` (default: `adaptive`)  
  Output video aspect ratio.
- **duration** `integer` (default: `5`)  
  Output video duration (seconds), integer. Set to `-1` to let the model choose an appropriate duration (note: duration affects billing).
- **seed** `integer` (default: `-1`)  
  Random seed for controlling generation randomness. Range: [-1, 2^32-1].
- **generate_audio** `boolean` (default: `true`)  
  Whether to generate audio-enabled video. The model generates matching voice, sound effects, and background music based on the prompt and visual content.
- **draft** `boolean` (default: `false`)  
  Generate a draft preview. Seedance 2.5 only. Idle models do not support it.
- **return_last_frame** `boolean` (default: `false`)  
  Whether to return the last frame of the video as an image (PNG format, no watermark, same resolution as the video).
- **camera_fixed** `boolean` (default: `false`)  
  Whether to fix the camera position.
- **watermark** `boolean` (default: `false`)  
  Whether the generated video includes a watermark
- **service_tier** ``default` | `flex`` (default: `default`)  
  Service tier (cannot be changed for submitted tasks):
- **callback_url** `string`  
  Callback URL for terminal task states. When a task reaches `succeeded` / `failed`, XRToken sends a `POST` request to this URL.
- **safety_identifier** `string`  
  End-user unique identifier for safety auditing. It is recommended to pass a hash of the user ID, up to 64 characters.

### Response

- **id** `string`  
  Upstream seedance task id; reuse for poll/cancel
- **model** `string`  
  
- **status** `string`  
  
- **created_at** `string`  
  

### Error Codes

- `400`: 
- `401`: 
- `402`: 
- `429`: 
- `502`:
