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

# /api/v3/contents/generations/tasks

> 提交文本与参考媒体，异步生成视频。创建成功只返回任务 ID，需轮询查询接口获取结果。

使用 `Authorization: Bearer <API_KEY>` 鉴权。任务异步执行，创建成功只返回任务 ID，需调用[查询视频生成任务](https://docs-vip.apigo.ai/api-reference/endpoints/seedance/get-task.md)获取结果。

## 模型

| 模型 ID | 说明 |
| - | - |
| `dreamina-seedance-2-0-260128` | Seedance 2.0 |

可用的时长、分辨率、比例和计费规则以账号开通情况为准。

## content 元素

| 类型 | 写法 |
| - | - |
| 文本 | `{"type":"text","text":"提示词"}` |
| 图片 | `{"type":"image_url","role":"reference_image","image_url":{"url":"asset://<素材ID>"}}` |
| 音频 | `{"type":"audio_url","role":"reference_audio","audio_url":{"url":"asset://<素材ID>"}}` |
| 视频 | `{"type":"video_url","role":"reference_video","video_url":{"url":"asset://<素材ID>"}}` |

* `url` 可以是素材库中 `Status=Active` 的素材（`asset://<素材ID>`），也可以是可公开访问的 HTTP(S) 地址。素材的导入方式见[素材库](https://docs-vip.apigo.ai/api-reference/endpoints/seedance/asset-overview.md)。
* 提示词中用“图片1”“音频1”“视频1”按同类媒体在 `content` 中出现的顺序指代参考媒体。
* 音频不能作为唯一参考媒体，需搭配图片或视频。
* `audio_url` 是输入的参考音频，`generate_audio` 控制输出视频是否带声音，两者独立。使用参考音频或参考视频原声时，`generate_audio` 传 `true`。

## 素材引用错误

引用素材不可用时返回 HTTP 400，`error.code` 为 `InvalidParameter`：

| message | 处理方式 |
| - | - |
| `Asset '<ID>' does not exist.` | 检查素材 ID 是否正确、是否已删除 |
| `Asset '<ID>' is still processing. Use it after its status becomes Active.` | 等待 [GetAsset](https://docs-vip.apigo.ai/api-reference/endpoints/seedance/get-asset.md) 返回 `Active` 后再提交 |
| `Asset '<ID>' failed processing and cannot be used.` | 素材处理失败，修正来源文件后重新导入 |
| `The referenced assets cannot be used together in one request.` | 所引用的素材不能在同一请求中组合使用。新建一个素材组，把本次要用的素材全部重新导入，等全部变为 `Active` 后再引用 |

## 错误码

| HTTP 状态码 | error.type | error.code | 说明 |
| - | - | - | - |
| 400 | `BadRequest` | `InvalidParameter` | JSON 不合法、缺少字段、类型错误或素材引用不可用 |
| 400 | `BadRequest` | `InvalidParameter.UnsupportedImageFormat`、`InputImageSensitiveContentDetected` 等 | 媒体格式、参数或内容审核不通过。`param` 可能为空，请同时查看 `message` |
| 401 | `Unauthorized` | `AuthenticationError` | API Key 缺失或无效 |
| 403 | `Forbidden` | `AccountOverdueError` | 余额不足 |
| 403 | `Forbidden` | `AccessDenied` | IP 白名单或模型权限不允许调用 |
| 404 | `NotFound` | `InvalidEndpointOrModel.NotFound` | 模型不存在或当前不可用 |
| 429 | `TooManyRequests` | `AccountRateLimitExceeded` | 请求过于频繁 |
| 429 | `TooManyRequests` | `QuotaExceeded` | 达到 API Key 设置的额度上限 |
| 500 | `InternalServerError` | `InternalServiceError` | 服务内部或上游异常 |

> [!NOTE]
>
> 创建请求超时或连接中断时，任务可能已经创建。直接重试可能产生重复任务。


## OpenAPI

````yaml api-reference/openapi.json POST /api/v3/contents/generations/tasks
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api-vip.apigo.ai
security:
  - bearerAuth: []
paths:
  /api/v3/contents/generations/tasks:
    post:
      summary: 创建 Seedance 视频生成任务
      description: 提交文本与参考媒体，异步生成视频。创建成功只返回任务 ID，需轮询查询接口获取结果。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SeedanceCreateTaskRequest'
            example:
              model: dreamina-seedance-2-0-260128
              content:
                - type: text
                  text: 让图片1中的苹果轻微运动，保留主体及构图。
                - type: image_url
                  role: reference_image
                  image_url:
                    url: asset://asset-20261020080000-abcde
              duration: 5
              resolution: 720p
              ratio: '16:9'
              generate_audio: false
              watermark: false
      responses:
        '200':
          description: 任务已创建
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceCreateTaskResponse'
              example:
                id: task_20261020080000abcdef
        '400':
          description: 请求参数或素材引用不合法
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceErrorResponse'
              example:
                error:
                  code: InvalidParameter
                  message: >-
                    Asset 'asset-20261020080000-abcde' is still processing. Use
                    it after its status becomes Active.
                  param: ''
                  type: BadRequest
        '401':
          description: API Key 缺失或无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceErrorResponse'
              example:
                error:
                  code: AuthenticationError
                  message: The API key is missing or invalid.
                  param: ''
                  type: Unauthorized
        '403':
          description: 余额不足，或 IP 白名单、模型权限不允许调用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceErrorResponse'
              example:
                error:
                  code: AccountOverdueError
                  message: Your account balance is insufficient.
                  param: ''
                  type: Forbidden
        '404':
          description: 模型不存在或当前不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceErrorResponse'
              example:
                error:
                  code: InvalidEndpointOrModel.NotFound
                  message: >-
                    The model or endpoint does not exist or you do not have
                    access to it.
                  param: ''
                  type: NotFound
        '429':
          description: 请求过频或达到 API Key 额度
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SeedanceErrorResponse'
              example:
                error:
                  code: AccountRateLimitExceeded
                  message: Too many requests, please retry later.
                  param: ''
                  type: TooManyRequests
components:
  schemas:
    SeedanceCreateTaskRequest:
      type: object
      required:
        - model
        - content
      properties:
        model:
          type: string
          description: 模型 ID。
          example: dreamina-seedance-2-0-260128
        content:
          type: array
          description: 文本与参考媒体数组。提示词用“图片1”“音频1”“视频1”按同类素材出现顺序指代参考媒体。
          items:
            $ref: '#/components/schemas/SeedanceContentItem'
        duration:
          type: integer
          description: 视频时长（秒）。
          example: 5
        resolution:
          type: string
          description: 输出分辨率，例如 `720p`。
          example: 720p
        ratio:
          type: string
          description: 画面比例，例如 `16:9`、`1:1`。
          example: '16:9'
        generate_audio:
          type: boolean
          description: 是否生成声音。使用参考音频或参考视频原声时传 `true`。
        watermark:
          type: boolean
          description: 是否添加水印。
        priority:
          type: integer
          description: 任务优先级。传入后会在查询结果中回传。
        safety_identifier:
          type: string
          description: 终端用户标识，建议使用不可逆的哈希值。传入后会在查询结果中回传。
    SeedanceCreateTaskResponse:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          description: 任务 ID。
    SeedanceErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          description: 错误对象。
          properties:
            code:
              type: string
              description: 错误码，例如 `InvalidParameter`。
            message:
              type: string
              description: 错误描述。
            param:
              type: string
              description: 出错的参数名，可能为空。
            type:
              type: string
              description: 错误类型，例如 `BadRequest`。
    SeedanceContentItem:
      type: object
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
            - audio_url
            - video_url
          description: 内容类型。
        text:
          type: string
          description: 提示词，`type=text` 时必填。
        role:
          type: string
          enum:
            - reference_image
            - reference_audio
            - reference_video
          description: >-
            参考媒体角色，与 `type` 对应：`reference_image` / `reference_audio` /
            `reference_video`。
        image_url:
          type: object
          description: 参考图片，`type=image_url` 时必填。
          required:
            - url
          properties:
            url:
              type: string
              description: '`asset://<素材ID>`（素材须为 `Active`），或可公开访问的 HTTP(S) 地址。'
        audio_url:
          type: object
          description: 参考音频，`type=audio_url` 时必填。音频不能作为唯一参考媒体，需搭配图片或视频。
          required:
            - url
          properties:
            url:
              type: string
              description: '`asset://<素材ID>`（素材须为 `Active`），或可公开访问的 HTTP(S) 地址。'
        video_url:
          type: object
          description: 参考视频，`type=video_url` 时必填。
          required:
            - url
          properties:
            url:
              type: string
              description: '`asset://<素材ID>`（素材须为 `Active`），或可公开访问的 HTTP(S) 地址。'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.