跳转到主要内容
PixVerse

爱诗 PixVerse — 创建任务

提交 PixVerse 视频超清任务

POST
/services/aigc/video-generation/video-synthesis
cURL - 视频超清
curl --location 'https://maas.qianwenaiapi.com/api/v1/services/aigc/video-generation/video-synthesis' \
  -H 'X-DashScope-Async: enable' \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "pixverse/pixverse-upscale",
    "input": {
        "media": [
            {
                "type": "video_url",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/wqefue/mix_input_video.mp4"
            }
        ]
    },
    "parameters": {
        "seed": 12345,
        "watermark": true
    }
}'
{
  "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx",
  "output": {
    "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx",
    "task_status": "PENDING"
  }
}
传入视频文件,输出固定 4K(3840×2160)分辨率的超分辨率视频。
  • Python SDK
import dashscope
import os
from dashscope.v2 import DashScopeError

# 若没有配置环境变量,请用千问AI平台API Key将下行替换为:api_key="sk-xxx"
# 获取API Key:https://platform.qianwenai.com/home/api-keys
client = dashscope.Client(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://maas.qianwenaiapi.com/api/v1",
)

media = [{'type': 'video_url', 'url': 'https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250919/wqefue/mix_input_video.mp4'}]

def sample_async_call():
  # 异步提交视频生成任务
  try:
    job = client.videos.jobs.create(model='pixverse/pixverse-upscale',
                    media=media,
                    seed=12345,
                    watermark=True)
    print(job)
    print("task_id: %s" % job.task_id)
  except DashScopeError as e:
    print(f"HTTP返回码:{e.status_code}")
    print(f"错误码:{e.code}")
    print(f"错误信息:{e.message}")
    print("请参考文档:/api-reference/preparation/error-messages")
    return

  # 查询任务状态
  try:
    snapshot = client.videos.jobs.fetch(job.task_id)
    print(snapshot.status)
  except DashScopeError as e:
    print(f"HTTP返回码:{e.status_code}")
    print(f"错误码:{e.code}")
    print(f"错误信息:{e.message}")
    print("请参考文档:/api-reference/preparation/error-messages")

  # 等待任务完成
  try:
    done = client.videos.jobs.wait(job)
    print(done)
    print(done.video_url)
  except DashScopeError as e:
    print(f"HTTP返回码:{e.status_code}")
    print(f"错误码:{e.code}")
    print(f"错误信息:{e.message}")
    print("请参考文档:/api-reference/preparation/error-messages")

if __name__ == '__main__':
  sample_async_call()

鉴权

string
header
必填

千问AI平台 API Key。详见获取 API Key。

Header 参数

enum<string>
必填

异步处理配置参数。HTTP 请求只支持异步,必须设置为 enable。缺少此请求头将报错:"current user api does not support synchronous calls"。

enable

请求体

application/json
enum<string>
必填

模型名称。固定值:pixverse/pixverse-upscale。

pixverse/pixverse-upscale
pixverse/pixverse-upscale
object
必填

输入的基本信息,包括待超分的视频。

object

视频生成参数。如设置是否添加水印、随机种子等。

响应

200-application/json
string

请求唯一标识。可用于请求明细溯源和问题排查。

4909100c-7b5a-9f92-bfe5-xxxxxx
object

任务输出信息。