生成视频

用任意视频模型发起视频,读取任务,然后下载文件。

POST

发送提示词和视频模型,立即拿回任务。从 GET /videos/models 中选择模型和它的取值:模型没有列出的值会在预留任何费用之前被拒绝。图片、延长、费用和限制见视频。

用 Authorization: Bearer binf_... 或 x-api-key 发送你的密钥。

请求体

只接受这些字段:其他字段会被拒绝或忽略。

  • modelstring必填

    GET /videos/models 中的视频模型 id,例如 alibaba/wan-3.0。

  • promptstring

    视频中发生什么:场景、动作和镜头。最多 2,000 个字符。除非视频从图片开始或延长一个视频,否则必填。

  • durationinteger必填

    秒数,必须是模型 supported_durations 中的一个值。

  • resolutionstring必填

    例如 720p,必须是模型 supported_resolutions 中的一个值。

  • aspect_ratiostring必填

    例如 "16:9" 或 "9:16",必须是模型 supported_aspect_ratios 中的一个值。

  • generate_audioboolean

    声音,适用于 generate_audio: true 的模型。不填时关闭。

  • seedinteger

    同样的种子和设置会生成相似的视频,适用于 seed: true 的模型。

  • frame_imagesobject[]

    视频开始或结束时的图片,每张为 { "type": "image_url", "image_url": { "url": "https://..." }, "frame_type": "first_frame" }(或 last_frame),以模型的 supported_frame_images 为准。链接须为公开的 https 链接。

  • input_referencesobject[]

    要在视频中保留的人物、物品或风格的图片,每张为 { "type": "image_url", "image_url": { "url": "https://..." } },最多为模型的 max_input_references 张,须为公开的 https 链接。不能与 frame_images 同时使用。

  • previous_job_idstring

    要继续延长的、此 Agent 已完成的视频,适用于 extends: true 的模型。

请求头

  • Idempotency-Keystring

    8 到 64 个字母、数字、- 或 _。用同一个键再次调用会返回同一个视频,不会生成新的视频。

返回

  • idstring

    视频的 id:vid_ 加 20 个字母和数字。

  • status"pending" | "in_progress" | "completed" | "failed" | "expired"

    生成期间为 pending 或 in_progress,之后为 completed 或 failed;不再保留时为 expired。

  • polling_urlstring

    读取任务的地址:每隔约 10 秒用你的密钥 GET 一次。

  • unsigned_urlsstring[]

    完成后:用你的密钥 GET 文件的地址。它返回一个有效期一小时的链接。

  • estimated_costnumber

    这个视频的最高花费,单位为美元。在视频结束前从你的余额中预留。

  • usageobject | null

    完成后:cost,实际扣费。生成失败的视频不扣费。

  • errorobject | null

    失败原因,以 code 表示,例如 content_refused。

  • expires_atstring | null

    文件的删除时间:生成 30 天后。

请求
curl https://binference.io/api/v1/videos \  -H "Authorization: Bearer $BINF_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "alibaba/wan-3.0",    "prompt": "A paper boat drifts across a calm pond at sunrise, slow tracking shot",    "duration": 5,    "resolution": "720p",    "aspect_ratio": "16:9"  }'
返回
{  "id": "vid_TFEnw4pmFHxtp2oqMHR8",  "object": "video.generation",  "model": "alibaba/wan-3.0",  "status": "pending",  "polling_url": "https://binference.io/api/v1/videos/vid_TFEnw4pmFHxtp2oqMHR8",  "unsigned_urls": [],  "estimated_cost": 0.6,  "usage": null,  "error": null,  "created_at": "2026-10-04T17:26:08.000Z",  "expires_at": null}

读取视频

用你的密钥请求 GET /videos/{id},会返回与 POST /videos 相同的任务,显示它当前的状态。每隔约 10 秒请求一次,直到 status 变为 completed 或 failed。每个密钥每分钟最多读取 60 次任务。

下载视频

用你的密钥请求 GET /videos/{id}/content,会返回 302 跳转到文件(一个 H.264 MP4),链接有效一小时。视频完成前,以及生成 30 天后被删除时,它会返回 404 和 not_ready。

列出视频模型

GET /videos/models 不需要密钥。每个模型包括:supported_resolutions、supported_aspect_ratios、supported_durations、supported_frame_images、max_input_references、generate_audio、seed、extends,以及 from_price:它最短、最小视频的价格,单位为美元。模型上线或下线时列表会变化,最多每小时一次。