> ## Documentation Index
> Fetch the complete documentation index at: https://docs.senseaudio.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 创建视频生成任务

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.senseaudio.cn/v1/video/create \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "model": "doubao-seedance-2-0-260128",
      "content": [
        {
          "type": "text",
          "text": "黄昏海边，海浪轻轻拍打礁石，镜头缓慢推进"
        },
        {
          "type": "image",
          "url": "https://example.com/first.jpg",
          "role": "first_frame"
        }
      ],
      "duration": 10,
      "resolution": "720p",
      "ratio": "16:9",
      "timeout": 88200,
      "watermark": true,
      "provider_specific": {
        "generate_audio": true
      }
    }'
  ```
</RequestExample>

## 说明

创建视频生成任务，支持 Seedance 系列模型的文本生成视频、首尾帧图生视频、参考素材生成视频等模式。

<Note>
  视频生成为异步任务，创建成功后返回 `task_id`，请通过
  [查询视频生成状态](/api-reference/endpoint/video/status) 轮询进度与最终结果。
</Note>

## 接口概览

| 项目           | 值                                           |
| :----------- | :------------------------------------------ |
| 接口地址         | `https://api.senseaudio.cn/v1/video/create` |
| 请求方式         | `POST`                                      |
| Content-Type | `application/json`                          |
| 鉴权方式         | Bearer Token                                |

## 请求头

| 参数名             |  必填 | 说明                           | 示例                    |
| :-------------- | :-: | :--------------------------- | :-------------------- |
| `Authorization` |  是  | 鉴权 Token，格式 `Bearer API_KEY` | `Bearer sk-123456...` |
| `Content-Type`  |  是  | 固定为 `application/json`       | `application/json`    |

## 请求参数

### 顶层参数

| 参数名                 | 类型     |  必填 | 描述                                    |
| :------------------ | :----- | :-: | :------------------------------------ |
| `model`             | string |  是  | 模型名称                                  |
| `content`           | array  |  是  | 视频内容描述（文本、图片、音频或视频）                   |
| `duration`          | int    |  是  | 视频时长（秒）                               |
| `resolution`        | string |  是  | 分辨率，如 `480p`、`720p`、`1080p`           |
| `ratio`             | string |  是  | 宽高比，如 `16:9`、`9:16`、`4:3`、`3:4`、`1:1` |
| `timeout`           | int    |  否  | 最大超时时间（秒），min：3600，max：172800         |
| `watermark`         | bool   |  否  | 是否添加水印，默认添加                           |
| `provider_specific` | object |  否  | 厂商特定参数（JSON 对象）                       |

### content 元素

| 参数名         | 类型     |  必填 | 描述                                                      |
| :---------- | :----- | :-: | :------------------------------------------------------ |
| `type`      | string |  是  | 内容类型：`text`、`image`、`audio`、`video`                     |
| `text`      | string |  否  | 当 `type` 为 `text` 时，填写文本内容（提示词）                         |
| `url`       | string |  否  | 当 `type` 为 `image` 时，填写图片 URL（支持 http/https 及 data URL） |
| `role`      | string |  否  | 当 `type` 为 `image` 时，指定图片作用，取值见下表                       |
| `audio_url` | string |  否  | 当 `type` 为 `audio` 时，填写音频 URL                           |
| `video_url` | string |  否  | 当 `type` 为 `video` 时，填写视频 URL                           |

## 模型说明

以下为 `doubao-seedance-2-0-260128` 支持的参数、`content` 组合与 `provider_specific` 说明及示例。

**支持参数**

* `ratio`：`16:9`、`4:3`、`1:1`、`3:4`、`9:16`
* `resolution`：`480p`、`720p`、`1080p`
* `duration`：4 \~ 15 秒之间的整数
* `provider_specific`：`{"generate_audio": true}`

**content 组合（两种模式不可混用）**

* 首尾帧模式：`text`（可选，最多 1 条）+ `image`（仅 `first_frame` / `last_frame`，首帧必传，尾帧可选）
* 参考素材模式：`text`（可选，最多 1 条）+ `reference` 图片（≤ 9 张）+ `audio`（≤ 3 条）+ `video`（≤ 3 条）

<Warning>
  不支持同一请求中混用首尾帧与参考素材；仅传 `audio` 不合法，必须至少搭配 `image` 或 `video`。
</Warning>

**代码示例**

<CodeGroup>
  ```bash 纯文本 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "黄昏海边，海浪轻轻拍打礁石，镜头缓慢推进"}
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 10,
    "watermark": true,
    "provider_specific": {"generate_audio": true}
  }'
  ```

  ```bash 首帧图生视频 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "镜头从女孩侧脸缓慢推进，发丝被微风吹动"},
      {"type": "image", "url": "https://example.com/first.jpg", "role": "first_frame"}
    ],
    "resolution": "720p",
    "ratio": "9:16",
    "duration": 5,
    "watermark": false,
    "provider_specific": {"generate_audio": false}
  }'
  ```

  ```bash 首尾帧图生视频 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "镜头从街头咖啡店门口推进到室内，最后停在窗边座位"},
      {"type": "image", "url": "https://example.com/first.jpg", "role": "first_frame"},
      {"type": "image", "url": "https://example.com/last.jpg", "role": "last_frame"}
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 8,
    "watermark": false,
    "provider_specific": {"generate_audio": false}
  }'
  ```

  ```bash 参考图 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "保留人物服饰与场景氛围，生成一段自然运镜的短视频"},
      {"type": "image", "url": "https://example.com/ref1.jpg", "role": "reference"},
      {"type": "image", "url": "https://example.com/ref2.jpg", "role": "reference"}
    ],
    "resolution": "720p",
    "ratio": "3:4",
    "duration": 10,
    "watermark": false,
    "provider_specific": {"generate_audio": true}
  }'
  ```

  ```bash 参考图+音频 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "根据参考图生成广告短片，整体节奏贴合背景音乐"},
      {"type": "image", "url": "https://example.com/ref1.jpg", "role": "reference"},
      {"type": "audio", "audio_url": "https://example.com/bgm.mp3"}
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 10,
    "watermark": false,
    "provider_specific": {"generate_audio": true}
  }'
  ```

  ```bash 参考视频+参考图+音频 theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "全程使用视频1的第一视角构图，全程使用音频1作为背景音乐。第一人称视角果茶宣传广告..."},
      {"type": "image", "url": "https://example.com/pic1.jpg", "role": "reference"},
      {"type": "image", "url": "https://example.com/pic2.jpg", "role": "reference"},
      {"type": "audio", "audio_url": "https://example.com/audio1.mp3"},
      {"type": "video", "video_url": "https://example.com/video1.mp4"}
    ],
    "duration": 10,
    "ratio": "16:9",
    "resolution": "720p",
    "watermark": false,
    "provider_specific": {"generate_audio": true}
  }'
  ```
</CodeGroup>

## 字段细则

<AccordionGroup>
  <Accordion title="role 字段说明" icon="image">
    * `doubao-seedance-2-0-260128`支持 `first_frame` / `last_frame` 或 `reference`，两种模式不可混用
  </Accordion>

  <Accordion title="provider_specific 字段说明" icon="sliders">
    * 该字段传入 JSON 对象，仅 `doubao-seedance-2-0-260128`支持
    * `doubao-seedance-2-0-260128`：`{"generate_audio": true}`
    * 传入不支持的字段会直接忽略
  </Accordion>
</AccordionGroup>

## 素材格式要求

<AccordionGroup>
  <Accordion title="图片" icon="image">
    * **格式**：jpeg、png、webp、bmp、tiff、gif；
    * **宽高比（宽 / 高）**：(0.4, 2.5)
    * **宽高尺寸（px）**：(300, 6000)
    * **大小**：单张 ≤ 30 MB，请求体 ≤ 64 MB；大文件请勿使用 Base64 编码
  </Accordion>

  <Accordion title="音频" icon="music">
    * **格式**：wav、mp3 - **时长**：单条 \[2, 15] s，最多 3 条，总时长 ≤ 15 s -
      **大小**：单条 ≤ 15 MB，请求体 ≤ 64 MB；大文件请勿使用 Base64 编码
  </Accordion>

  <Accordion title="视频" icon="video">
    * **格式**：mp4、mov
    * **分辨率**：480p、720p
    * **时长**：单条 \[2, 15] s，最多 3 条，总时长 ≤ 15 s
    * **宽高比（宽 / 高）**：\[0.4, 2.5]
    * **宽高尺寸（px）**：\[300, 6000]
    * **总像素数**：\[640×640=409600, 834×1112=927408]
    * **大小**：单条 ≤ 50 MB
    * **帧率 (FPS)**：\[24, 60]
  </Accordion>
</AccordionGroup>

## 响应结构

| 参数名       | 类型     | 描述               |
| :-------- | :----- | :--------------- |
| `task_id` | string | 任务 ID，用于查询视频生成状态 |

```json 响应示例 theme={null}
{
  "task_id": "task_1234567890"
}
```

## 通用代码示例

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.senseaudio.cn/v1/video/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "content": [
      {"type": "text", "text": "根据参考图生成一段自然运镜的商品短片"},
      {"type": "image", "url": "https://example.com/ref1.jpg", "role": "reference"}
    ],
    "resolution": "720p",
    "ratio": "16:9",
    "duration": 10,
    "watermark": false,
    "provider_specific": {"generate_audio": true}
  }'
  ```

  ```python Python theme={null}
  import requests

  API_URL = "https://api.senseaudio.cn/v1/video/create"
  HEADERS = {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  def create_video(content, model="doubao-seedance-2-0-260128", **kwargs):
      data = {"model": model, "content": content, **kwargs}
      resp = requests.post(API_URL, headers=HEADERS, json=data)
      return resp.json() if resp.status_code == 200 else None

  result = create_video(
      content=[
          {"type": "text", "text": "根据参考图生成一段自然运镜的商品短片"},
          {"type": "image", "url": "https://example.com/ref1.jpg", "role": "reference"}
      ],
      ratio="16:9",
      duration=10,
      resolution="720p",
      provider_specific={"generate_audio": True}
  )
  print(f"任务ID: {result['task_id']}")
  ```

  ```javascript JavaScript theme={null}
  const axios = require("axios");

  const API_URL = "https://api.senseaudio.cn/v1/video/create";
  const HEADERS = {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  };

  async function createVideo(content, model = "doubao-seedance-2-0-260128", options = {}) {
    const data = { model, content, ...options };
    const res = await axios.post(API_URL, data, { headers: HEADERS });
    return res.data;
  }

  createVideo(
    [
      { type: "text", text: "根据参考图生成一段自然运镜的商品短片" },
      { type: "image", url: "https://example.com/ref1.jpg", role: "reference" },
    ],
    "doubao-seedance-2-0-260128",
    {
      ratio: "16:9",
      duration: 10,
      resolution: "720p",
      provider_specific: { generate_audio: true },
    },
  ).then((r) => console.log(`任务ID: ${r.task_id}`));
  ```
</CodeGroup>

## 注意事项

<Note>
  * **内容描述**：`text`
    元素建议清晰描述场景、动作、风格等信息，有助于提升稳定性 -
    **素材组合**：`doubao-seedance-2-0-260128` 的首尾帧模式与参考素材模式不可混用 -
    **音频限制**：仅传 `audio` 不合法，必须至少搭配 `image` 或 `video` -
    **处理时间**：视频生成耗时较长，建议使用轮询方式
    [查询任务状态](/api-reference/endpoint/video/status)
</Note>


## OpenAPI

````yaml POST /v1/video/create
openapi: 3.1.0
info:
  title: SenseAudio Open Platform API
  description: >-
    SenseAudio 开放平台
    API，覆盖语音合成、语音识别、音色能力、音乐生成、图片生成、视频生成、智能体与大语言模型等能力。未显式说明的字段为依据素材文档推断。
  version: 1.0.0
servers:
  - url: https://api.senseaudio.cn
    description: 生产环境
security:
  - bearerAuth: []
paths:
  /v1/video/create:
    post:
      tags:
        - Video
      summary: 创建视频生成任务
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoCreateRequest'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoCreateResponse'
components:
  schemas:
    VideoCreateRequest:
      type: object
      required:
        - model
        - content
        - duration
        - resolution
        - ratio
      properties:
        model:
          type: string
          description: 模型名称
          enum:
            - doubao-seedance-2-0-260128
          example: doubao-seedance-2-0-260128
        content:
          type: array
          description: 视频内容描述（文本、图片、音频或视频）
          items:
            type: object
            required:
              - type
            properties:
              type:
                type: string
                description: 内容类型
                enum:
                  - text
                  - image
                  - audio
                  - video
                example: text
              text:
                type: string
                description: 文本内容（type=text 时使用）
                example: 黄昏海边，海浪轻轻拍打礁石，镜头缓慢推进
              url:
                type: string
                description: 图片 URL，支持 http/https 及 data URL（type=image 时使用）
                example: https://example.com/first.jpg
              role:
                type: string
                description: 图片作用（type=image 时使用）
                enum:
                  - first_frame
                  - last_frame
                  - reference
                example: first_frame
              audio_url:
                type: string
                description: 音频 URL（type=audio 时使用）
                example: https://example.com/bgm.mp3
              video_url:
                type: string
                description: 视频 URL（type=video 时使用）
                example: https://example.com/demo.mp4
          example:
            - type: text
              text: 黄昏海边，海浪轻轻拍打礁石，镜头缓慢推进
            - type: image
              url: https://example.com/first.jpg
              role: first_frame
        duration:
          type: integer
          description: 视频时长（秒），doubao-seedance-2-0-260128 取值 4～15 之间的整数
          example: 10
        resolution:
          type: string
          description: 分辨率，可选 480p、720p、1080p
          enum:
            - 480p
            - 720p
            - 1080p
          example: 720p
        ratio:
          type: string
          description: 宽高比，如 16:9、9:16、4:3、3:4、1:1
          enum:
            - '16:9'
            - '9:16'
            - '4:3'
            - '3:4'
            - '1:1'
          example: '16:9'
        timeout:
          type: integer
          description: 最大超时时间（秒），最小 3600，最大 172800
          minimum: 3600
          maximum: 172800
        watermark:
          type: boolean
          description: 是否添加水印，默认 true
          default: true
        provider_specific:
          $ref: '#/components/schemas/VideoProviderSpecific'
    VideoCreateResponse:
      type: object
      properties:
        task_id:
          type: string
          description: 任务 ID，用于查询视频生成状态
          example: task_1234567890
    VideoProviderSpecific:
      type: object
      description: 厂商特定参数
      properties:
        generate_audio:
          type: boolean
          description: 是否生成音频
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: 格式：`Bearer <API_KEY>`

````