千支API 千支API 文档

视频模型接入指南

视频生成是异步任务接口:先提交任务,拿到任务 ID 后轮询状态,完成后再下载视频内容。 当前站点开放 OpenAI 兼容视频接口和旧版兼容任务接口。

推荐 Base URL https://api.qianzhiapi.com/v1
创建视频任务 POST /v1/videos
查询和下载 GET /v1/videos/{task_id}
接口已按线上路由验证

POST /v1/videosGET /v1/videos/{task_id}GET /v1/videos/{task_id}/content 当前都由千支API后端接管。无令牌请求会返回 401 Invalid token,说明路由已存在。

1. 当前实测通过的视频模型

模型名 价格 分组 说明
minimax-h3/text-to-video ¥0.20 / 次 视频-Seedance-h3 文生视频,已通过真实任务和 MP4 下载验证。
minimax-h3/image-to-video ¥0.20 / 次 视频-Seedance-h3 图生视频,图片 URL 必须可公网直接访问。
minimax-h3/reference-to-video ¥0.20 / 次 视频-Seedance-h3 参考图/素材生成视频,已通过公开图片真实任务验证。
bytedance/seedance-2-mini ¥0.30 / 次 视频-Seedance-h3 Seedance 文生视频,已通过真实任务和 MP4 下载验证。

2. 通用流程

创建任务使用 POST /v1/videos,查询任务使用 GET /v1/videos/{task_id},下载视频使用 GET /v1/videos/{task_id}/content。请求体推荐使用 JSON。

3. MiniMax H3 文生视频

minimax-h3/text-to-video 需要顶层 prompt,同时在 input.prompt 中传给上游;aspect_ratioduration 放在 input 内。

curl https://api.qianzhiapi.com/v1/videos \
  -H "Authorization: Bearer sk-你的APIKey" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3/text-to-video",
    "prompt": "A cat walking slowly on the beach at sunset, cinematic shot",
    "input": {
      "prompt": "A cat walking slowly on the beach at sunset, cinematic shot",
      "aspect_ratio": "16:9",
      "duration": 6
    }
  }'

成功后会返回类似:

{
  "id": "task_abc123",
  "task_id": "task_abc123",
  "object": "video",
  "model": "minimax-h3/text-to-video",
  "status": "queued",
  "progress": 0,
  "created_at": 1785767000
}

4. MiniMax H3 图生视频

minimax-h3/image-to-video 使用 input.first_frame_url。 不要传 aspect_ratio,该模型会从输入图片自动推导比例。 图片地址必须是上游可直接下载的公网图片地址。

curl https://api.qianzhiapi.com/v1/videos \
  -H "Authorization: Bearer sk-你的APIKey" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3/image-to-video",
    "prompt": "Animate this image with slow cinematic camera movement.",
    "input": {
      "prompt": "Animate this image with slow cinematic camera movement.",
      "first_frame_url": "https://example.com/input.jpg",
      "duration": 6
    }
  }'

5. MiniMax H3 参考素材视频

minimax-h3/reference-to-video 是参考素材生成视频模型。常见用法是先把参考视频上传到 可公网访问的地址,再通过 input.reference_video_urls 传入视频 URL。也可以同时传 reference_image_urlsreference_audio_urls 作为图片、音频参考。 需要指定 aspect_ratio,可用 adaptive

curl https://api.qianzhiapi.com/v1/videos \
  -H "Authorization: Bearer sk-你的APIKey" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3/reference-to-video",
    "prompt": "Generate a continuous cinematic video referencing the style and motion of the input video.",
    "input": {
      "prompt": "Generate a continuous cinematic video referencing the style and motion of the input video.",
      "reference_video_urls": [
        "https://example.com/reference.mp4"
      ],
      "aspect_ratio": "adaptive",
      "duration": 6
    }
  }'

如果只使用图片作为参考素材,可以这样传:

{
  "model": "minimax-h3/reference-to-video",
  "prompt": "Generate a cinematic video referencing the input image.",
  "input": {
    "prompt": "Generate a cinematic video referencing the input image.",
    "reference_image_urls": [
      "https://example.com/reference.jpg"
    ],
    "aspect_ratio": "adaptive",
    "duration": 6
  }
}

6. Seedance 2 Mini 文生视频

bytedance/seedance-2-mini 使用顶层参数。实测 resolution 可用 480paspect_ratio 可用 16:9

curl https://api.qianzhiapi.com/v1/videos \
  -H "Authorization: Bearer sk-你的APIKey" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "bytedance/seedance-2-mini",
    "prompt": "A smooth cinematic drone shot over a quiet mountain lake at sunrise, realistic style.",
    "duration": 4,
    "resolution": "480p",
    "aspect_ratio": "16:9"
  }'

7. 查询任务状态

任务状态可能是 queuedin_progresscompletedfailed。建议每 5 到 10 秒查询一次,不要高频轮询。

curl https://api.qianzhiapi.com/v1/videos/task_abc123 \
  -H "Authorization: Bearer sk-你的APIKey"

8. 下载视频内容

当任务状态为 completed 后,使用 content 接口下载视频文件。

curl https://api.qianzhiapi.com/v1/videos/task_abc123/content \
  -H "Authorization: Bearer sk-你的APIKey" \
  -o output.mp4

9. 旧版兼容 JSON 接口

当前后端仍保留旧版 /v1/video/generations 兼容接口。新接入推荐优先用 /v1/videos; 只有老客户端已经按 JSON 任务接口实现时,再使用下面路径。

curl https://api.qianzhiapi.com/v1/video/generations \
  -H "Authorization: Bearer sk-你的APIKey" \
  -H "Content-Type: application/json" \
  -d '{
     "model": "bytedance/seedance-2-mini",
     "prompt": "宇航员在月球上慢慢行走,远处是蓝色地球",
     "duration": 4,
     "resolution": "480p",
     "aspect_ratio": "16:9"
  }'
curl https://api.qianzhiapi.com/v1/video/generations/task_abc123 \
  -H "Authorization: Bearer sk-你的APIKey"

10. 常见错误

错误 原因 处理方式
401 Invalid token API Key 错误或没有传 Authorization。 确认请求头为 Authorization: Bearer sk-...
403 permission_error 令牌分组没有视频模型权限。 确认令牌属于「视频生成分组」或联系管理员调整。
长时间 queuedin_progress 视频生成耗时较长或上游排队。 提高客户端超时时间,使用轮询查询状态。
failed 提示词、参考图、时长或上游任务失败。 缩短提示词、降低时长,或更换模型重试。
费用提醒

视频模型按次计费,提交任务即可能产生费用。测试时建议先用 fast 模型和较短时长。