# doubao-seedance-2-0

Text/image-to-video model

| Model | Max Resolution |
| :--- | :--------- |
| `doubao-seedance-2-0-260128` | 4K |
| `doubao-seedance-2-0-mini-260615` | 720p |

## Submit Async Task

### Endpoint

`https://api-us-ca.umodelverse.ai/v1/tasks/submit`

### Input

| Parameter | Type | Required | Description |
| :--------------------------------- | :------ | :------- | :------------------------------------------------------------------------------------------------------- |
| model | string | Yes | Model name: `doubao-seedance-2-0-260128` or `doubao-seedance-2-0-mini-260615` |
| input.content | object[] | Yes | Input objects for video generation. Supports five object types:<br>`Text content`<br>`Image content`<br>`Draft content`<br>`Reference video content`<br>`Reference audio content`<br>See the content description below. |
| parameters.execution_expires_after | int | No | Task timeout threshold. Specifies the expiration time after submission in seconds. Default: `172800` seconds (`48` hours). Range: `[3600, 259200]`. |
| parameters.generate_audio | boolean | No | Controls whether the generated video includes synchronized audio. Default: `false`.<br>`true`: output video contains synced audio.<br>`false`: output video is silent. |
| parameters.resolution | string | No | Video resolution. Default: `720p`.<br>`doubao-seedance-2-0-260128`: supports `480p`, `720p`, `1080p`, `4K`.<br>`doubao-seedance-2-0-mini-260615`: supports `480p`, `720p`.<br>Draft mode only supports `480p`. |
| parameters.ratio | string | No | Aspect ratio of the generated video. Supported values: `16:9`, `4:3`, `1:1`, `3:4`, `9:16`, `21:9`, `adaptive`. Default: `adaptive`, which intelligently selects the most suitable ratio. |
| parameters.duration | int | No | Video duration in seconds: `4~15`, default is `5` |
| parameters.seed | int | No | Random seed, range `[0, 2147483647]` |
| parameters.camera_fixed | boolean | No | Whether to fix the camera. Default: `false`.<br>`true`: fixed camera.<br>`false`: unfixed camera. |
| parameters.watermark | boolean | No | Whether the generated video includes a watermark. Default: `false`.<br>`false`: no watermark.<br>`true`: contains watermark. |
| parameters.callback_url | string | No | Callback URL to receive task result notifications. When the video generation task status changes, a POST request will be pushed to this address. |

#### Description of `input.content` Objects
A draft content object generates a video from a draft task and cannot be mixed with text content or image content objects.

#### Text Content Object
| Parameter | Type | Required | Description |
| :--------------------------------- | :------ | :------- | :------------------------------------------------------------------------------------------------------- |
| content.type | string | Yes | Type of input content. Must be `text`. |
| content.text | string | Yes | Text input describing the expected video. Supports both Chinese and English. Recommended length: no more than 500 characters. |

#### Image Content Object
| Parameter | Type | Required | Description |
| :--------------------------------- | :------ | :------- | :------------------------------------------------------------------------------------------------------- |
| content.type | string | Yes | Type of input content. Must be `image_url`. Supports image URL or Base64-encoded image. |
| content.image_url | object | Yes | Image object provided to the model. |
| content.image_url.url | string | Yes | Image data, which can be an image URL or Base64-encoded image.<br>Image URL: please ensure the URL is accessible.<br>Base64 format must follow: `data:image/<image_format>;base64,<Base64>` where `<image_format>` must be lowercase, e.g. `data:image/png;base64,{base64_image}`. |
| content.role | string | No | Position or purpose of the image.<br>For 1 `image_url` object, `role` may be omitted or set to `first_frame`.<br>For 2 `image_url` objects, `role` is required.<br>The first frame image should use `first_frame`.<br>The last frame image should use `last_frame`.<br>The reference image should use `reference_image`. |

#### Reference Video Content Object
| Parameter | Type | Required | Description |
| :--------------------------------- | :------ | :------- | :------------------------------------------------------------------------------------------------------- |
| content.type | string | Yes | Type of input content. Must be `video_url`. |
| content.video_url | object | Yes | Reference video object provided to the model. |
| content.video_url.url | string | Yes | Reference video URL. Please ensure the URL is accessible. |
| content.role | string | Yes | Must be: `reference_video`. |

#### Reference Audio Content Object
| Parameter | Type | Required | Description |
| :--------------------------------- | :------ | :------- | :------------------------------------------------------------------------------------------------------- |
| content.type | string | Yes | Type of input content. Must be `audio_url`. |
| content.audio_url | object | Yes | Reference audio object provided to the model. |
| content.audio_url.url | string | Yes | Reference audio URL. Please ensure the URL is accessible. |
| content.role | string | Yes | Must be: `reference_audio`. |

### Request Example
⚠️ If you are using Windows, it is recommended to use Postman or another API client tool.
```shell
curl -v 'https://api-us-ca.umodelverse.ai/v1/tasks/submit' \
--header 'Authorization: <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
    "model": "doubao-seedance-2-0-260128",
    "input": {
        "content": [
        {
            "type": "text",
            "text": "Make him run."
        },
        {
            "type": "image_url",
            "image_url": {
                "url": "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg"
            },
            "role": "first_frame"
        },
        {
          "type": "video_url",
          "video_url": {
              "url": "https://ark-project.tos-cn-beijing.volces.com/doc_video/r2v_tea_video1.mp4"
          },
          "role": "reference_video"
        },
        {
          "type": "audio_url",
          "audio_url": {
              "url": "https://ark-project.tos-cn-beijing.volces.com/doc_audio/r2v_tea_audio1.mp3"
          },
          "role": "reference_audio"
        }
      ]
    },
    "parameters": {
      "generate_audio": true,
      "duration": 15,
      "execution_expires_after": 3600,
      "generate_audio": true,
      "resolution": "720p",
      "camera_fixed": false,
      "watermark": false,
      "draft": false,
      "callback_url": "https://ark-project.tos-cn-beijing.volces.com"
    }
  }'
```

### Output

| Parameter      | Type   | Description                         |
| :------------- | :----- | :---------------------------------- |
| output.task_id | string | Unique identifier of the async task |
| request_id     | string | Unique request identifier           |

### Response Example

```json
{
  "output": {
    "task_id": "task_id"
  },
  "request_id": "request_id"
}
```

## Query Task Status

### Endpoint

`https://api-us-ca.umodelverse.ai/v1/tasks/status?task_id=<task_id>`

### Request Example

```shell
curl --location 'https://api-us-ca.umodelverse.ai/v1/tasks/status?task_id=<task_id>' \
--header 'Authorization: <YOUR_API_KEY>'
```

### Output

| Parameter               | Type    | Description                                                                                                                                             |
| :---------------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
| output.task_id          | string  | Unique identifier of the async task                                                                                                                     |
| output.task_status      | string  | Task status: `Pending`, `Running`, `Success`, `Failure`, `Expired`                                                                                      |
| output.urls             | array   | List of video result URLs                                                                                                                               |
| output.submit_time      | integer | Task submission timestamp                                                                                                                               |
| output.finish_time      | integer | Task completion timestamp                                                                                                                               |
| output.error_message    | string  | Error message returned on failure                                                                                                                       |
| usage.duration          | integer | Video duration (seconds)                                                                                                                                |
| usage.completion_tokens | integer | Number of tokens spent by the model to generate the output video                                                                                        |
| usage.total_tokens      | integer | Total tokens consumed by this request. Video generation models do not count input tokens, so input tokens are 0 and `total_tokens = completion_tokens`. |
| request_id              | string  | Unique request identifier                                                                                                                               |

### Response Example (Success)

```json
{
	"output": {
		"task_id": "xxxxxxx",
		"task_status": "Success",
		"urls": ["http://xxxxxxxx/xx.mp4"],
		"submit_time": 1768460826,
		"finish_time": 1768460932
	},
	"usage": {
		"completion_tokens": 108900,
		"total_tokens": 108900,
		"duration": 5
	},
	"request_id": ""
}
```

### Response Example (Failure)

```json
{
  "output": {
    "task_id": "xxxxxxx",
    "task_status": "Failure",
    "submit_time": 1756959000,
    "finish_time": 1756959019,
    "error_message": "error_message"
  },
  "usage": {
  	"completion_tokens": 0,
		"total_tokens": 0,
    "duration": 5
  },
  "request_id": ""
}
```

