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

# Wan 2.7

> 统一 720p/1080p 视频接口，支持文生、首尾帧、多参考（含音色绑定）与视频编辑。

## 参数与输入模式

请求须传入 `model` 与 `input`。省略 `input.mode` 时默认按 `text_to_video` 处理；其余三种工作流须显式指定 `mode`（不会自动推断），且所有字段按所选模式校验。默认值与限制见下方 Body 参数列表。

nsfw\_check=true 启用本站筛查，否则跳过。

| 请求场景 | input 必填字段 |
| - | - |
| 文生视频 | `prompt`（`mode` 可省略，默认 `"text_to_video"`） |
| 首尾帧图生视频 | `mode: "image_to_video"`、`first_frame_url`（可选 `last_frame_url`、`reference_audio_urls`） |
| 多参考生视频 | `mode: "reference_to_video"`、`prompt`、≥1 项图/视频（扁平图片字段或 `image_with_roles`，及/或 `reference_video_urls`） |
| 视频编辑 | `mode: "video_edit"`、`source_video_url`（可选 `prompt`、`reference_image_urls`） |

## 特殊模式说明

以下说明各模式的字段隔离与组合规则；具体默认值、时长范围与素材上限见下方 Body 参数列表。

* **模式隔离**：混传其他模式的字段会返回 HTTP 400；省略 `resolution` 前请核对 Body 默认值。
* **参考模式**（`reference_to_video`）：`image_with_roles` 与扁平图片互斥；有首帧须省略 `aspect_ratio`；含参考视频时收紧 Body 时长上限。
* **编辑模式**（`video_edit`）：默认 `duration` 跟随源片；显式时长从片头截取且不超源片。不支持续写与特效模板。

## 使用场景

提交到 `POST /api/v1/tasks/create_task`。`files.apistable.ai` 为托管样本；请将 `cdn.example.com` 替换为符合 Body 限制的公网 HTTPS 直链。

```json 文生视频 theme={null}
{
  "model": "wan-2.7",
  "input": {
    "mode": "text_to_video",
    "prompt": "A paper boat drifting on a calm pond at sunrise, gentle ripples",
    "resolution": "720p",
    "duration": 2,
    "aspect_ratio": "16:9"
  }
}
```

```json 图生视频（首尾帧） theme={null}
{
  "model": "wan-2.7",
  "input": {
    "mode": "image_to_video",
    "first_frame_url": "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-keyframes-input-0.jpg",
    "last_frame_url": "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-keyframes-input-1.jpg",
    "prompt": "Smooth transition as morning mist lifts and warm sunlight brightens the pond.",
    "resolution": "1080p",
    "duration": 5
  }
}
```

```json 参考生视频（参考图 + 参考视频） theme={null}
{
  "model": "wan-2.7",
  "input": {
    "mode": "reference_to_video",
    "prompt": "Keep the folded paper boat appearance from the reference image and the calm golden-hour pond setting and visual style from the reference video as gentle ripples spread.",
    "reference_image_urls": [
      "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-reference-input-0.jpg"
    ],
    "reference_video_urls": [
      "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-snow-edit-input-0.mp4"
    ],
    "resolution": "720p",
    "duration": 5,
    "aspect_ratio": "16:9"
  }
}
```

```json 参考生视频（角色音色绑定） theme={null}
{
  "model": "wan-2.7",
  "input": {
    "mode": "reference_to_video",
    "prompt": "Medium close-up of the studio host from the character reference image speaking calmly into the camera in the bound reference voice, warm studio key light, soft background.",
    "image_with_roles": [
      {
        "url": "https://cdn.example.com/character-host.jpg",
        "role": "reference_image",
        "reference_voice": "https://cdn.example.com/host-voice.mp3"
      }
    ],
    "aspect_ratio": "16:9",
    "resolution": "720p",
    "duration": 5
  }
}
```

```json 视频编辑 theme={null}
{
  "model": "wan-2.7",
  "input": {
    "mode": "video_edit",
    "source_video_url": "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-snow-edit-input-0.mp4",
    "reference_image_urls": [
      "https://files.apistable.ai/examples/wan/v2/inputs/wan27-boat-reference-input-0.jpg"
    ],
    "prompt": "Replace the distant background with a softly blurred snowy shoreline while keeping the white paper boat, water ripples, and camera motion unchanged.",
    "resolution": "720p",
    "duration": 0,
    "metadata": {
      "audio_setting": "origin"
    }
  }
}
```

> 凭响应中的 `data.task_id` 通过 [查询任务](https://docs.apistable.ai/zh/query-task.md) 或 `callback_url`（[Webhook 安全与验签](https://docs.apistable.ai/zh/webhook-secret.md)）获取结果；鉴权见 [快速开始](https://docs.apistable.ai/zh/quickstart.md)，提交错误见 [创建任务](https://docs.apistable.ai/zh/create-task.md)。视频链接保留 14 天；超 24 小时未完成将进入超时清理且不扣费。

## 试用与价格

单次生成 1 条视频，各模式共用秒价。文生/图生按请求输出秒计费；参考/编辑按所有输入视频秒数之和（含重复 URL）加实测输出秒计费（图/音频不计秒）。失败扣费 0。余额见 [查询积分余额](https://docs.apistable.ai/zh/credits.md)。

| 分辨率 | 积分 / 计费秒 | 美元 / 计费秒 |
| - | - | - |
| `720p` | 17.0 | \$0.085 |
| `1080p`（默认） | 28.0 | \$0.140 |

> [card] [在线试用](https://apistable.ai/zh/models/wan-2.7#try)
>
> 在工作台测试 Wan 2.7 四种模式。

> [card] [查看价格](https://apistable.ai/zh/models/wan-2.7#pricing)
>
> 按模式查看 720p/1080p 价格与对比。


## OpenAPI

````yaml openapi-wan-2.7-zh.json POST /api/v1/tasks/create_task
openapi: 3.1.0
info:
  title: APIstable API
  version: 1.0.0-preview
  description: >-
    Public /api/v1 protocol. Valid API keys have the same account-scoped access.
    Read the selected model documentation for its ID, supported inputs, result
    format and availability before submitting. No client submission idempotency
    or max_credits. Availability, pricing, file retention and callback formats
    follow the selected model contract. Unconfigured operations return 503.
servers:
  - url: https://apistable.ai
    description: API Stable API
security: []
paths:
  /api/v1/tasks/create_task:
    post:
      summary: Wan 2.7
      description: 统一 720p/1080p 视频接口，支持文生、首尾帧、多参考（含音色绑定）与视频编辑。
      operationId: wan-2.7
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              additionalProperties: false
              properties:
                model:
                  type: string
                  enum:
                    - wan-2.7
                  example: wan-2.7
                  description: 本页对应的 APIstable 模型 ID。
                input:
                  $schema: https://json-schema.org/draft/2020-12/schema
                  oneOf:
                    - type: object
                      properties:
                        nsfw_check:
                          description: true 时启用本站输入筛查；省略或 false 时跳过。不转发给生成供应商。
                          type: boolean
                        prompt:
                          type: string
                          minLength: 1
                          maxLength: 5000
                          description: 画面与动作描述（必填，1–5,000 字符）。
                        negative_prompt:
                          description: 可选负向提示词，描述不希望出现的元素（最多 500 字符）。
                          type: string
                          maxLength: 500
                        resolution:
                          default: 1080p
                          description: 输出分辨率：720p（17.0 积分/计费秒）或 1080p（默认，28.0 积分/计费秒）。
                          type: string
                          enum:
                            - 720p
                            - 1080p
                        duration:
                          default: 5
                          description: 输出时长（秒）：2–15 整数（默认 5）。
                          type: integer
                          minimum: 2
                          maximum: 15
                        prompt_extend:
                          default: true
                          description: 是否开启提示词自动扩写（默认 true）。
                          type: boolean
                        watermark:
                          default: false
                          description: 是否添加 AI 生成水印（默认 false）。
                          type: boolean
                        seed:
                          description: 可选非负整数种子（0–2147483647）；省略则随机生成。
                          type: integer
                          minimum: 0
                          maximum: 2147483647
                        output_count:
                          default: 1
                          description: 单次输出数量，固定为 1。
                          type: number
                          const: 1
                        official_fallback:
                          default: false
                          description: 不支持官方回退，固定为 false。
                          type: boolean
                          const: false
                        mode:
                          default: text_to_video
                          description: >-
                            显式工作流模式：text_to_video（默认）、image_to_video、reference_to_video
                            或 video_edit；不会按素材自动推断。
                          type: string
                          const: text_to_video
                        aspect_ratio:
                          description: 可选输出宽高比（16:9 / 9:16 / 1:1 / 4:3 / 3:4，默认 16:9）。
                          type: string
                          enum:
                            - '16:9'
                            - '9:16'
                            - '1:1'
                            - '4:3'
                            - '3:4'
                      required:
                        - prompt
                      additionalProperties: false
                      description: >-
                        Wan 2.7（text_to_video）输入参数：公网 HTTPS 素材（不含凭据、自定义端口或 #
                        片段），按所选工作流严格校验，固定输出 1 条，不支持官方回退、特效模板与视频续写。nsfw_check 为
                        true 时，APIstable 在提交前审核文本和图片；省略或 false
                        时跳过本站审核；视频和音频交由模型供应商按其自身策略审核。
                    - type: object
                      properties:
                        nsfw_check:
                          description: true 时启用本站输入筛查；省略或 false 时跳过。不转发给生成供应商。
                          type: boolean
                        prompt:
                          description: 可选画面描述（1–5,000 字符）。
                          type: string
                          minLength: 1
                          maxLength: 5000
                        negative_prompt:
                          description: 可选负向提示词，描述不希望出现的元素（最多 500 字符）。
                          type: string
                          maxLength: 500
                        resolution:
                          default: 1080p
                          description: 输出分辨率：720p（17.0 积分/计费秒）或 1080p（默认，28.0 积分/计费秒）。
                          type: string
                          enum:
                            - 720p
                            - 1080p
                        duration:
                          default: 5
                          description: 输出时长（秒）：2–15 整数（默认 5）。
                          type: integer
                          minimum: 2
                          maximum: 15
                        prompt_extend:
                          default: true
                          description: 是否开启提示词自动扩写（默认 true）。
                          type: boolean
                        watermark:
                          default: false
                          description: 是否添加 AI 生成水印（默认 false）。
                          type: boolean
                        seed:
                          description: 可选非负整数种子（0–2147483647）；省略则随机生成。
                          type: integer
                          minimum: 0
                          maximum: 2147483647
                        output_count:
                          default: 1
                          description: 单次输出数量，固定为 1。
                          type: number
                          const: 1
                        official_fallback:
                          default: false
                          description: 不支持官方回退，固定为 false。
                          type: boolean
                          const: false
                        mode:
                          type: string
                          const: image_to_video
                          description: >-
                            显式工作流模式：text_to_video（默认）、image_to_video、reference_to_video
                            或 video_edit；不会按素材自动推断。
                        first_frame_url:
                          type: string
                          maxLength: 16384
                          format: uri
                          description: >-
                            必填首帧图片，公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1）。首帧决定输出画幅，勿同时传 aspect_ratio。
                        last_frame_url:
                          description: >-
                            可选尾帧图片（须搭配 first_frame_url），公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1）。
                          type: string
                          maxLength: 16384
                          format: uri
                        reference_audio_urls:
                          description: 可选自定义音频数组（最多 1 段公网 HTTPS WAV/MP3，2–30 秒，≤15 MiB）。
                          maxItems: 1
                          type: array
                          items:
                            type: string
                            maxLength: 16384
                            format: uri
                      required:
                        - mode
                        - first_frame_url
                      additionalProperties: false
                      description: >-
                        Wan 2.7（image_to_video）输入参数：公网 HTTPS 素材（不含凭据、自定义端口或 #
                        片段），按所选工作流严格校验，固定输出 1 条，不支持官方回退、特效模板与视频续写。nsfw_check 为
                        true 时，APIstable 在提交前审核文本和图片；省略或 false
                        时跳过本站审核；视频和音频交由模型供应商按其自身策略审核。
                    - type: object
                      properties:
                        nsfw_check:
                          description: true 时启用本站输入筛查；省略或 false 时跳过。不转发给生成供应商。
                          type: boolean
                        prompt:
                          type: string
                          minLength: 1
                          maxLength: 5000
                          description: 画面与动作描述（必填，1–5,000 字符）。
                        negative_prompt:
                          description: 可选负向提示词，描述不希望出现的元素（最多 500 字符）。
                          type: string
                          maxLength: 500
                        resolution:
                          default: 1080p
                          description: 输出分辨率：720p（17.0 积分/计费秒）或 1080p（默认，28.0 积分/计费秒）。
                          type: string
                          enum:
                            - 720p
                            - 1080p
                        duration:
                          default: 5
                          description: 输出时长（秒）：2–15 整数（默认 5）；包含任意参考视频时上限为 2–10 秒。
                          type: integer
                          minimum: 2
                          maximum: 15
                        prompt_extend:
                          default: true
                          description: 是否开启提示词自动扩写（默认 true）。
                          type: boolean
                        watermark:
                          default: false
                          description: 是否添加 AI 生成水印（默认 false）。
                          type: boolean
                        seed:
                          description: 可选非负整数种子（0–2147483647）；省略则随机生成。
                          type: integer
                          minimum: 0
                          maximum: 2147483647
                        output_count:
                          default: 1
                          description: 单次输出数量，固定为 1。
                          type: number
                          const: 1
                        official_fallback:
                          default: false
                          description: 不支持官方回退，固定为 false。
                          type: boolean
                          const: false
                        mode:
                          type: string
                          const: reference_to_video
                          description: >-
                            显式工作流模式：text_to_video（默认）、image_to_video、reference_to_video
                            或 video_edit；不会按素材自动推断。
                        aspect_ratio:
                          description: >-
                            可选输出宽高比（16:9 / 9:16 / 1:1 / 4:3 / 3:4，默认
                            16:9）；传入首帧时请省略，由首帧决定画幅。
                          type: string
                          enum:
                            - '16:9'
                            - '9:16'
                            - '1:1'
                            - '4:3'
                            - '3:4'
                        first_frame_url:
                          description: >-
                            可选首帧图片，公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1）。首帧决定输出画幅，勿同时传 aspect_ratio。
                          type: string
                          maxLength: 16384
                          format: uri
                        reference_image_urls:
                          description: >-
                            可选参考图片数组，公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1）。至少提供 1 项参考图或视频，图片与视频合计 ≤5 项。
                          maxItems: 5
                          type: array
                          items:
                            type: string
                            maxLength: 16384
                            format: uri
                        reference_video_urls:
                          description: >-
                            可选参考视频数组（最多 5 段；公网 HTTPS MP4/MOV，单段 1–30 秒、合计 ≤150
                            秒，≤100 MiB，240–4096 px，比例 1:8–8:1；与参考图合计 ≤5
                            项；每段传入实例含重复 URL 均计入计费秒数）。
                          maxItems: 5
                          type: array
                          items:
                            type: string
                            maxLength: 16384
                            format: uri
                        image_with_roles:
                          description: >-
                            可选角色图片数组（与扁平图片字段互斥），支持为单张图指定 role（reference_image
                            或最多 1 个 first_frame）与可选 reference_voice（1–30 秒公网
                            HTTPS WAV/MP3，≤15 MiB）；每张图片须为公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1），与参考视频合计 ≤5 项。
                          minItems: 1
                          maxItems: 5
                          type: array
                          items:
                            type: object
                            properties:
                              url:
                                type: string
                                maxLength: 16384
                                format: uri
                                description: >-
                                  公网 HTTPS
                                  图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10
                                  MiB，240–8000 px，比例 1:8–8:1）。
                              role:
                                default: reference_image
                                description: 图片角色：reference_image（默认）或 first_frame（最多 1 个）。
                                type: string
                                enum:
                                  - reference_image
                                  - first_frame
                              reference_voice:
                                description: >-
                                  可选角色音色公网 HTTPS 直链（WAV/MP3，1–30 秒，≤15
                                  MiB），交由模型供应商按其自身策略审核。
                                type: string
                                maxLength: 16384
                                format: uri
                            required:
                              - url
                            additionalProperties: false
                      required:
                        - prompt
                        - mode
                      additionalProperties: false
                      description: >-
                        Wan 2.7（reference_to_video）输入参数：公网 HTTPS 素材（不含凭据、自定义端口或
                        # 片段），按所选工作流严格校验，固定输出 1 条，不支持官方回退、特效模板与视频续写。nsfw_check 为
                        true 时，APIstable 在提交前审核文本和图片；省略或 false
                        时跳过本站审核；视频和音频交由模型供应商按其自身策略审核。
                    - type: object
                      properties:
                        nsfw_check:
                          description: true 时启用本站输入筛查；省略或 false 时跳过。不转发给生成供应商。
                          type: boolean
                        prompt:
                          description: 可选视频编辑说明（1–5,000 字符）。
                          type: string
                          minLength: 1
                          maxLength: 5000
                        negative_prompt:
                          description: 可选负向提示词，描述不希望出现的元素（最多 500 字符）。
                          type: string
                          maxLength: 500
                        resolution:
                          default: 1080p
                          description: 输出分辨率：720p（17.0 积分/计费秒）或 1080p（默认，28.0 积分/计费秒）。
                          type: string
                          enum:
                            - 720p
                            - 1080p
                        duration:
                          default: 0
                          description: >-
                            输出时长（秒）：0（默认）跟随源视频长度，或传 2–10
                            整数从片头截取且不超过源视频长度。按源视频秒数加实测输出秒数计费。
                          anyOf:
                            - type: number
                              const: 0
                            - type: integer
                              minimum: 2
                              maximum: 10
                        prompt_extend:
                          default: true
                          description: 是否开启提示词自动扩写（默认 true）。
                          type: boolean
                        watermark:
                          default: false
                          description: 是否添加 AI 生成水印（默认 false）。
                          type: boolean
                        seed:
                          description: 可选非负整数种子（0–2147483647）；省略则随机生成。
                          type: integer
                          minimum: 0
                          maximum: 2147483647
                        output_count:
                          default: 1
                          description: 单次输出数量，固定为 1。
                          type: number
                          const: 1
                        official_fallback:
                          default: false
                          description: 不支持官方回退，固定为 false。
                          type: boolean
                          const: false
                        mode:
                          type: string
                          const: video_edit
                          description: >-
                            显式工作流模式：text_to_video（默认）、image_to_video、reference_to_video
                            或 video_edit；不会按素材自动推断。
                        aspect_ratio:
                          description: 可选输出宽高比（16:9 / 9:16 / 1:1 / 4:3 / 3:4）；省略则跟随源视频比例。
                          type: string
                          enum:
                            - '16:9'
                            - '9:16'
                            - '1:1'
                            - '4:3'
                            - '3:4'
                        reference_image_urls:
                          description: >-
                            可选参考图片数组（最多 4 张），公网 HTTPS
                            图片直链（JPEG/PNG/BMP/WebP，所有格式均不可含透明通道，≤10 MiB，240–8000
                            px，比例 1:8–8:1）。
                          maxItems: 4
                          type: array
                          items:
                            type: string
                            maxLength: 16384
                            format: uri
                        source_video_url:
                          type: string
                          maxLength: 16384
                          format: uri
                          description: >-
                            必填源视频公网 HTTPS 直链（MP4/MOV，2–10 秒，≤100 MiB，240–4096
                            px，比例 1:8–8:1）。按源视频秒数加实测输出秒数计费。
                        metadata:
                          default:
                            audio_setting: auto
                          description: >-
                            视频编辑音频策略：audio_setting 可选 auto（默认，重新生成音频）或
                            origin（保留源视频原声）。
                          type: object
                          properties:
                            audio_setting:
                              default: auto
                              description: auto（默认）重新生成音频；origin 保留源视频原声。
                              type: string
                              enum:
                                - auto
                                - origin
                          additionalProperties: false
                      required:
                        - mode
                        - source_video_url
                      additionalProperties: false
                      description: >-
                        Wan 2.7（video_edit）输入参数：公网 HTTPS 素材（不含凭据、自定义端口或 #
                        片段），按所选工作流严格校验，固定输出 1 条，不支持官方回退、特效模板与视频续写。nsfw_check 为
                        true 时，APIstable 在提交前审核文本和图片；省略或 false
                        时跳过本站审核；视频和音频交由模型供应商按其自身策略审核。
                  description: >-
                    Wan 2.7 输入对象，按所选工作流校验字段（mode：text_to_video / image_to_video
                    / reference_to_video / video_edit）。省略 mode 时默认选择
                    text_to_video，其余三种工作流须显式指定 mode。nsfw_check 为 true
                    时，APIstable 在提交前审核文本和图片；省略或 false
                    时跳过本站审核；视频和音频交由模型供应商按其自身策略审核。
                callback_url:
                  type: string
                  format: uri
                  description: 任务完成时接收签名回调的公网 HTTPS 地址。须为可直接访问的地址，不能跳转到其他地址。省略时可轮询查询任务接口。
            example:
              model: wan-2.7
              input:
                mode: text_to_video
                prompt: >-
                  A paper boat drifting on a calm pond at sunrise, gentle
                  ripples
                resolution: 720p
                duration: 2
                aspect_ratio: '16:9'
      responses:
        '200':
          description: 已受理。使用 `task_id` [查询任务](/zh/query-task)，或通过 `callback_url` 接收结果。
          content:
            application/json:
              schema:
                type: object
                required:
                  - code
                  - msg
                  - data
                additionalProperties: false
                properties:
                  code:
                    const: 200
                  msg:
                    const: success
                  data:
                    type: object
                    required:
                      - task_id
                    additionalProperties: false
                    properties:
                      task_id:
                        type: string
        '400':
          description: >-
            40001 invalid JSON, 40002 invalid input/callback or input rejected
            by screening, 40003 unsupported parameter.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: '40201: Insufficient credits (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: '40301: Website session requests require the APIstable site origin.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '40401: Unknown model or resource not found in this account.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '40901: Resource incompatible with this operation.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: '41001: Source audio or temporary resource has expired.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: '41301: Request too large.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: '42201: Requested capability combination is not enabled.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '42901: Rate/concurrency limit (live acceptance).'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '50301: Service unavailable. No live submission or charge.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      callbacks:
        Webhook:
          '{$request.body#/callback_url}':
            post:
              requestBody:
                required: true
                description: >-
                  任务成功或失败后，APIstable 向创建任务时传入的 `callback_url` 发送 JSON POST。验签后返回
                  HTTP 2xx 确认接收。


                  用 `data.status` 判断生成结果。成功时为 `succeeded`，生成视频链接位于
                  `data.result.urls`。全部失败时为 `failed`，`data.result` 为
                  `null`，`data.message` 提供失败原因。


                  签名和去重使用 `X-APIstable-Signature`、`X-APIstable-Timestamp` 和
                  `X-APIstable-Event-Id`。详见 [Webhook 安全与验签](/zh/webhook-secret)。


                  **Webhook 请求体示例**


                  ```json

                  {
                    "code": 200,
                    "msg": "success",
                    "data": {
                      "task_id": "c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb",
                      "model": "wan-2.7",
                      "status": "succeeded",
                      "created_at": "2026-11-24T08:30:00.000Z",
                      "completed_at": "2026-11-24T08:31:45.000Z",
                      "duration": 105000,
                      "charged_credits": 85,
                      "message": "",
                      "input": "{\"mode\":\"text_to_video\",\"prompt\":\"A paper boat drifting on a calm pond at sunrise, gentle ripples\",\"resolution\":\"720p\",\"aspect_ratio\":\"16:9\",\"duration\":5}",
                      "result": {
                        "urls": [
                          "https://cdn.example.com/generated/wan-video.mp4"
                        ],
                        "items": [
                          {
                            "id": "e7aacd19-819a-4747-bbbf-46fb6f2995a5",
                            "urls": [
                              "https://cdn.example.com/generated/wan-video.mp4"
                            ],
                            "last_frame_url": null,
                            "draft": false,
                            "draft_expires_at": null
                          }
                        ]
                      }
                    }
                  }

                  ```
                content:
                  application/json:
                    schema:
                      type: object
                      required:
                        - code
                        - msg
                        - data
                      properties:
                        code:
                          type: integer
                          const: 200
                        msg:
                          type: string
                          const: success
                        data:
                          type: object
                          additionalProperties: false
                          required:
                            - task_id
                            - model
                            - status
                            - created_at
                            - completed_at
                            - duration
                            - charged_credits
                            - message
                            - input
                            - result
                          properties:
                            task_id:
                              type: string
                            model:
                              type: string
                              const: wan-2.7
                            status:
                              type: string
                              enum:
                                - succeeded
                                - failed
                            created_at:
                              type: string
                              format: date-time
                            completed_at:
                              type:
                                - string
                                - 'null'
                              format: date-time
                            duration:
                              type:
                                - integer
                                - 'null'
                              minimum: 0
                              description: >-
                                Total elapsed milliseconds; null while
                                processing.
                            charged_credits:
                              type:
                                - number
                                - 'null'
                              minimum: 0
                              description: Final charged Credits; null until completion.
                            message:
                              type: string
                              description: >-
                                Failure reason for failed tasks, or an
                                actionable pending-settlement message while
                                processing; empty on success.
                            input:
                              type: string
                              contentMediaType: application/json
                              description: JSON-serialized accepted model input.
                            result:
                              type:
                                - object
                                - 'null'
                              required:
                                - urls
                                - items
                              properties:
                                urls:
                                  type: array
                                  items:
                                    type: string
                                    format: uri
                                items:
                                  type: array
                                  maxItems: 1
                                  items:
                                    type: object
                                    required:
                                      - id
                                      - urls
                                      - last_frame_url
                                      - draft
                                      - draft_expires_at
                                    properties:
                                      id:
                                        type: string
                                        format: uuid
                                      urls:
                                        type: array
                                        items:
                                          type: string
                                          format: uri
                                      last_frame_url:
                                        type:
                                          - string
                                          - 'null'
                                        format: uri
                                      draft:
                                        type: boolean
                                      draft_expires_at:
                                        type:
                                          - string
                                          - 'null'
                                        format: date-time
                    example:
                      code: 200
                      msg: success
                      data:
                        task_id: c6adbc82-8b9a-4d6f-8b60-1114c8c4aafb
                        model: wan-2.7
                        status: succeeded
                        created_at: '2026-11-24T08:30:00.000Z'
                        completed_at: '2026-11-24T08:31:45.000Z'
                        duration: 105000
                        charged_credits: 85
                        message: ''
                        input: >-
                          {"mode":"text_to_video","prompt":"A paper boat
                          drifting on a calm pond at sunrise, gentle
                          ripples","resolution":"720p","aspect_ratio":"16:9","duration":5}
                        result:
                          urls:
                            - https://cdn.example.com/generated/wan-video.mp4
                          items:
                            - id: e7aacd19-819a-4747-bbbf-46fb6f2995a5
                              urls:
                                - >-
                                  https://cdn.example.com/generated/wan-video.mp4
                              last_frame_url: null
                              draft: false
                              draft_expires_at: null
              responses:
                2XX:
                  description: 已接收 Webhook。
              method: post
              type: path
            path: '{$request.body#/callback_url}'
      security:
        - bearerAuth: []
components:
  schemas:
    Error:
      type: object
      required:
        - code
        - msg
        - data
      properties:
        code:
          type: integer
        msg:
          type: string
        data:
          type: 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        登录 APIstable 后，在 [API Key 管理](https://apistable.ai/zh/console/keys)
        创建并复制密钥。


        每次调用都要在 HTTP 请求头传入：


        ```http

        Authorization: Bearer YOUR_API_KEY

        ```


        将 YOUR_API_KEY 替换为你创建的 API Key。

````

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