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

# PixVerse V6 参考生视频

> PixVerse V6 参考生视频（Fusion）：融合 1 ~ 7 张主体或背景参考图生成视频，提示词中用 @名称 指代参考图。

PixVerse V6 是爱诗科技（PixVerse）于 2026 年 3 月发布的视频生成模型，重点提升了镜头执行、角色表演和多镜头音画生成：镜头运动更准确、伪影更少；角色的情绪和肢体语言在不同场景之间保持一致；一段提示词就能生成带声音的多镜头短片，音频与画面同步生成；画面中的中英文等多语言文字也能正确呈现。

`pixverse-v6/reference-to-video`（Fusion 多图参考）把 1 \~ 7 张参考图融合进同一段视频：`type` 标记每张图是主体（人物、动物、商品等）还是背景，`ref_name` 给参考图命名后在提示词里用 `@名称` 指代，人物、商品和场景在画面中保持一致。

## 接入

PixVerse V6 系列使用异步任务接口：`POST /api/v1/jobs/createTask` 创建任务（`model` 选择模型，参数放在 `input` 中），`GET /api/v1/jobs/recordInfo?taskId=` 查询任务，传 `callBackUrl` 时任务结束后向该地址推送结果。服务地址为 `https://api.dreamto.ai`，API Key 放在 `Authorization: Bearer` 请求头。

所有响应的 HTTP 状态码都是 200，以响应体中的 `code` 判断结果：`200` 为成功，其余为错误（见各接口的响应示例）。

| 接口 | 用途 |
| - | - |
| [`POST /api/v1/jobs/createTask`](https://docs.dreamto.ai/api-reference/pixverse-v6-reference-to-video/create-task) | 创建任务 |
| [`GET /api/v1/jobs/recordInfo?taskId=...`](https://docs.dreamto.ai/api-reference/pixverse-v6-reference-to-video/query-task) | 查询任务 |
| [`POST callBackUrl`](https://docs.dreamto.ai/api-reference/pixverse-v6-reference-to-video/task-callback) | 任务完成回调 |

## 参数范围

`model` 填 `pixverse-v6/reference-to-video`，生成参数放在 `input` 中。超出范围的请求返回 `code: 422`，不建任务、不扣费。

| 字段 | 取值 |
| - | - |
| `prompt` | 必填，3 \~ 5000 个字符，可用 `@ref_name` 指代参考图 |
| `image_references` | 必填，1 \~ 7 张参考图，每项含 `image_url`（必填）、`type`（`subject` 默认 / `background`）、`ref_name`（最多 30 个字符，列表内不能重复） |
| `aspect_ratio` | 必填，`16:9` / `4:3` / `1:1` / `3:4` / `9:16` / `2:3` / `3:2` / `21:9` |
| `quality` | 必填，`360p` / `540p` / `720p` / `1080p`，不区分大小写 |
| `duration` | 必填，`1` \~ `15` 秒的整数 |
| `generate_audio_switch` | `false`（默认）/ `true`（同步生成对白、音效和音乐，单价更高） |
| `seed` | 可选，`0` \~ `2147483647`，不传时随机 |

## 计费

按生成视频的秒数计费，单价按 PixVerse 官方刊例价（225 积分 = 1 美元）折算，以控制台显示的模型价格为准：

| 分辨率 | 无音频 | 有音频（`generate_audio_switch: true`） |
| - | - | - |
| `360p` | \$0.0222 / 秒 | \$0.0311 / 秒 |
| `540p` | \$0.0311 / 秒 | \$0.04 / 秒 |
| `720p` | \$0.04 / 秒 | \$0.0533 / 秒 |
| `1080p` | \$0.08 / 秒 | \$0.1022 / 秒 |

一次任务的费用 = 每秒单价 × `duration`。创建任务时按本次请求的费用预检余额，余额不足返回 `code: 402`；参数错误、生成失败的任务不扣费。

## 快速开始

创建任务拿到 `data.taskId`，每 10 秒左右查询一次，`state` 为 `success` 时从 `response.resultUrls` 下载视频；也可以传 `callBackUrl` 在完成时接收回调。示例中的 `$DREAMTO_API_KEY` 为你的 API Key。

```bash cURL theme={null}
# 1. 创建任务
curl -X POST "https://api.dreamto.ai/api/v1/jobs/createTask" \
  -H "Authorization: Bearer $DREAMTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pixverse-v6/reference-to-video",
    "input": {
      "prompt": "@dog 在 @room 的沙发上打了个滚，然后跳下来跑向镜头",
      "image_references": [
        {
          "image_url": "https://your-cdn.example.com/dog.png",
          "type": "subject",
          "ref_name": "dog"
        },
        {
          "image_url": "https://your-cdn.example.com/room.png",
          "type": "background",
          "ref_name": "room"
        }
      ],
      "aspect_ratio": "16:9",
      "quality": "720p",
      "duration": 5
    }
  }'

# 2. 查询任务
curl "https://api.dreamto.ai/api/v1/jobs/recordInfo?taskId=7d3f0a9c41e85b2f6a1c9e04b8d27f53" \
  -H "Authorization: Bearer $DREAMTO_API_KEY"
```

```python Python theme={null}
import os
import time

import requests

BASE_URL = "https://api.dreamto.ai"
HEADERS = {"Authorization": f"Bearer {os.environ['DREAMTO_API_KEY']}"}

payload = {
    "model": "pixverse-v6/reference-to-video",
    "input": {
        "prompt": "@dog 在 @room 的沙发上打了个滚，然后跳下来跑向镜头",
        "image_references": [
            {
                "image_url": "https://your-cdn.example.com/dog.png",
                "type": "subject",
                "ref_name": "dog"
            },
            {
                "image_url": "https://your-cdn.example.com/room.png",
                "type": "background",
                "ref_name": "room"
            }
        ],
        "aspect_ratio": "16:9",
        "quality": "720p",
        "duration": 5
    }
}

created = requests.post(f"{BASE_URL}/api/v1/jobs/createTask", headers=HEADERS, json=payload, timeout=60).json()
if created["code"] != 200:
    raise SystemExit(f"{created['code']}: {created['msg']}")
task_id = created["data"]["taskId"]
while True:
    record = requests.get(f"{BASE_URL}/api/v1/jobs/recordInfo", headers=HEADERS, params={"taskId": task_id}, timeout=60).json()["data"]
    if record["state"] in ("success", "fail"):
        break
    time.sleep(10)
if record["state"] == "success":
    print(record["response"]["resultUrls"])
else:
    print(record["failCode"], record["failMsg"])
```

## 任务回调

创建任务时传 `callBackUrl`（公网 `http` / `https` 地址），任务成功或失败后 DreamTo 向该地址 `POST` 一次结果：外层 `code` 为 `200`（成功）或 `501`（失败），`data` 与查询任务返回的 `data` 相同。请求头带 `X-DreamTo-Event: task.completed`、`X-DreamTo-Timestamp`（UTC，RFC 3339）和 `X-DreamTo-Signature`：

```
X-DreamTo-Signature = hex( HMAC-SHA256( 密钥, X-DreamTo-Timestamp + "." + data.taskId + "." + status ) )
```

`status` 在任务成功时为 `success`，失败时为 `failed`（注意不是 `data.state` 的 `fail`）。密钥在控制台 API Key 页面的“Webhook 签名密钥”中生成；未生成密钥时不发送 `X-DreamTo-Signature`。回调超时 10 秒，返回任意 `2xx` 即视为送达，否则在 1、5、30 分钟后重试，最多投递 4 次；请以 `data.taskId` 幂等处理。密钥管理和校验代码见 [任务回调](https://docs.dreamto.ai/webhooks/task-callback.md)。

## 使用说明

* 只支持图片参考；PixVerse 官方的视频参考（`video_references`）暂不支持。
* `taskId` 由 DreamTo 生成（32 位十六进制），只能用同一账号的 API Key 查询；任务不存在或超过保存期限时查询返回 `code: 422`、`msg: recordInfo is null`。
* 请求体只接受 `model`、`callBackUrl`、`input`；`input` 中未声明的字段、类型错误和超出范围的取值返回 `code: 422`，`msg` 为英文原因，不建任务、不扣费。
* 视频链接（`response.resultUrls`，与 `resultJson` 中相同）为 DreamTo 下载地址（`/v1/tasks/{task_id}/artifacts/...`），无需 API Key 即可下载，支持 `Range`；任务创建后约 14 天内有效，请及时下载保存。
* `param` 原样回显创建任务时的请求，其中 `input` 是 JSON 字符串，需要再解析一次；查询结果不返回 `creditsConsumed`，费用以 DreamTo 控制台账单为准。
* 失败任务的 `failCode` / `failMsg` 来自模型服务（如图片无法下载、内容审核未通过）；服务内部错误统一为 `failCode: "500"`、`failMsg: "Internal Error, Please try again later."`。


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