总览

账户、积分和最近任务

未连接
Customer Workspace

视频生成中心

积分 -
API Key 0
任务 0
最近状态 -

最近任务

-

任务 模型 状态 视频

生成视频

就绪

任务 模型 状态 视频 积分明细 耗时

API Key

-

名称 前缀 状态 最后使用

模型列表

登录后显示你的实际计费方式

模型名称 计费方式 积分消耗 模型特点

快速开始

用户侧只需要使用公开模型 ID,不同视频生成渠道由 VideoApi 自动适配。

Base URL 当前服务域名 认证头 Authorization: Bearer vga_xxx 公开模型 ID video-2.0-mini-reference-to-video

提示词里引用素材统一使用 @Image1@Image2@Video1@Audio1。 不同渠道要求的引用格式会在转发层适配,调用方只需要使用公开模型 ID。

认证方式

生成、上传、查询任务都使用 Bearer API Key。

在用户控制台的 API Key 页面创建 Key。创建后只展示一次,请保存好。后续请求都带上:

HTTP Header
Authorization: Bearer vga_xxxxxxxxxxxxxxxxxxxxxxxx

模型列表

公开接口返回可调用模型和当前展示价格。

GET /v1/models
curl
curl "$VIDEOAPI_BASE/v1/models"

上传素材

上传图片、视频、音频,返回可被生成服务访问的 URL。

POST /api/upload
curl
curl -X POST "$VIDEOAPI_BASE/api/upload" \
  -H "Authorization: Bearer vga_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "files=@/path/to/image.png" \
  -F "files=@/path/to/audio.mp3"
响应示例
{
  "data": [
    {
      "filename": "image.png",
      "content_type": "image/png",
      "size": 123456,
      "key": "uploads/...",
      "url": "https://your-domain.com/uploads/image.png"
    }
  ]
}

创建视频任务

提交后立即返回本地任务 ID,后台异步等待生成结果。

POST /v1/video/generations
curl
curl -X POST "$VIDEOAPI_BASE/v1/video/generations" \
  -H "Authorization: Bearer vga_xxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "video-2.0-mini-reference-to-video",
    "type": "image-to-video",
    "prompt": "让 @Image1 中的人物自然转身,镜头缓慢推进,光影真实",
    "image_urls": ["https://your-domain.com/uploads/reference.png"],
    "video_urls": [],
    "audio_urls": [],
    "resolution": "720p",
    "duration": "auto",
    "aspect_ratio": "9:16",
    "generate_audio": true,
    "end_user_id": "customer_001"
  }'
JavaScript
const response = await fetch(`${VIDEOAPI_BASE}/v1/video/generations`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${VIDEOAPI_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "video-2.0-mini-reference-to-video",
    type: "image-to-video",
    prompt: "让 @Image1 自然动起来,保持主体稳定",
    image_urls: ["https://your-domain.com/uploads/reference.png"],
    resolution: "720p",
    duration: "auto",
    aspect_ratio: "9:16",
    generate_audio: true
  })
});
const task = await response.json();
Python
import requests

response = requests.post(
    f"{VIDEOAPI_BASE}/v1/video/generations",
    headers={
        "Authorization": f"Bearer {VIDEOAPI_KEY}",
        "Content-Type": "application/json",
    },
    json={
        "model": "video-2.0-mini-reference-to-video",
        "type": "image-to-video",
        "prompt": "让 @Image1 自然动起来,保持主体稳定",
        "image_urls": ["https://your-domain.com/uploads/reference.png"],
        "resolution": "720p",
        "duration": "auto",
        "aspect_ratio": "9:16",
        "generate_audio": True,
    },
    timeout=30,
)
task = response.json()
响应示例
{
  "task_id": "vidgen_1783003830450_081f0558",
  "status": "pending",
  "poll_interval_seconds": 30
}

查询任务结果

按返回的 poll_interval_seconds 间隔查询,直到 completed 或 failed。

GET /v1/video/generations/{task_id}
curl
curl "$VIDEOAPI_BASE/v1/video/generations/vidgen_1783003830450_081f0558" \
  -H "Authorization: Bearer vga_xxxxxxxxxxxxxxxxxxxxxxxx"
完成响应
{
  "task_id": "vidgen_1783003830450_081f0558",
  "status": "completed",
  "url": "https://cdn.example.com/result.mp4",
  "format": "mp4",
  "generated": ["https://cdn.example.com/result.mp4"],
  "outputs": [],
  "metadata": {
    "credits_reserved": 180,
    "public_model": "video-2.0-mini-reference-to-video",
    "asset_reference_style": "@Image1/@Video1/@Audio1"
  },
  "credits_reserved": 180,
  "credits_refunded": false,
  "error": null,
  "videos": ["https://cdn.example.com/result.mp4"]
}

请求字段

字段保持统一,后续新增渠道仍由转发层适配。

字段 类型 必填 说明
model string 公开模型 ID,例如 video-2.0-mini-reference-to-video。
prompt string 提示词;素材引用统一使用 @Image1、@Video1、@Audio1。
image_urls string[] 图片素材 URL。第 1 个对应 @Image1,第 2 个对应 @Image2。
video_urls string[] 视频素材 URL。第 1 个对应 @Video1。
audio_urls string[] 音频素材 URL。第 1 个对应 @Audio1。
resolution string 当前支持 720p、480p,具体以模型能力为准。
duration string | number 可传 auto 或秒数;按秒计费模型会根据该字段预估积分。
aspect_ratio string 例如 auto、16:9、9:16、1:1、21:9。
generate_audio boolean 是否生成音频,默认按模型配置处理。
end_user_id string 调用方自己的终端用户 ID,便于审计和排查。

状态与错误

任务状态固定为 pending、processing、completed、failed。

pending任务已创建,等待提交或处理。
processing生成服务正在处理或后台正在同步结果。
completed生成完成,可读取 url 或 videos 下载。
failed生成失败,查看 error.message。已预扣积分会自动返还。
HTTP 状态 常见原因
400 模型不存在、模型已停用或 provider 未配置。
401 缺少 Bearer Token、API Key 错误或用户停用。
402 积分不足,任务不会进入生成流程。
413 上传素材超过当前服务限制。
422 请求字段不合法,或提示词引用了不存在的素材序号。