APIKO
视频系列

Wan 3.0 Image-to-Video API

  • 传入 first_image_url 严格指定视频首帧;再传 last_image_url 可同时严格指定尾帧。
  • 不接受参考素材(参考图、参考视频、参考音频):首尾帧与参考素材互斥,如需混合参考请改用Wan 3.0 参考生视频。
  • 最多 2 张图(首帧 + 尾帧)。需要 3 张及以上参考图请用参考生视频。
  • 可生成 2–30 秒视频,分辨率 480p、720p 或 1080p。
  • 标准版与 Prime 的请求参数、默认值和输入限制完全一致,仅模型 ID 与价格不同(见Wan 3.0 Prime 图生视频)。
  • 异步处理:POST /v1/videos 返回任务 ID,轮询 GET /v1/videos/{id} 或 GET /v1/tasks/{id} 直到任务完成。
  • 结果链接由 APIKO 签名,保留 24 小时;需要保存的请及时下载。
  • 计费说明
    • 计费时长 = 输出视频时长(duration)。
    • 按所选 resolution 的单价逐秒计费,价格见模型页。
    • 任务失败全额退款。
POST
/
v1
/
videos
TASK_ID=$(curl https://api.apiko.app/v1/videos \
  -H "Authorization: Bearer $APIKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "wan3.0-image-to-video",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "adaptive",
  "prompt": "The paper boats start to glide across the water, slow push-in.",
  "first_image_url": "https://apiko.app/imgs/model-cards/models-video.webp"
}' | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')

while :; do
  TASK=$(curl -s https://api.apiko.app/v1/videos/$TASK_ID \
    -H "Authorization: Bearer $APIKO_API_KEY")
  printf '%s\n' "$TASK"
  printf '%s' "$TASK" | grep -qE '"status": *"(completed|failed)"|"error": *\{' && break
  sleep 5
done
{
  "id": "task_abc123",
  "object": "video",
  "model": "wan3.0-image-to-video",
  "status": "completed",
  "progress": 100,
  "video_url": "https://api.apiko.app/v1/tasks/task_abc123/artifacts/video/content?access=…"
}

鉴权

Authorization
string必填
所有请求都使用 Bearer 鉴权:Authorization: Bearer <API_KEY>。
在控制台 → API 密钥创建密钥。
Routes
string
  • POST /v1/videos — 创建影片任务
  • GET /v1/videos/{id} — 查询任务并读取 video_url
  • GET /v1/tasks/{id} — 以通用任务格式查询同一任务

请求体

application/json
model
string默认:wan3.0-image-to-video必填
使用此公开模型 ID,原样填写。
可选值: wan3.0-image-to-video
示例:"wan3.0-image-to-video"
prompt
string必填
影片描述。
  • 支持中英文,最多 20,000 个字符;超出时在扣费前返回 HTTP 400。
  • 建议描述画面如何从首帧开始变化。
最小长度: 1
最大长度: 20000
示例:"A paper boat drifting across a calm lake at sunrise"
aspect_ratio
enum<string>
视频输出的宽高比。
adaptive 由模型根据输入素材与提示词自动选择宽高比;16:9 横屏,9:16 竖屏,1:1 方形。
可选值: adaptive, 16:9, 9:16, 1:1
示例:"adaptive"
resolution
enum<string>默认:720p
视频输出分辨率,取值匹配时不区分大小写。
  • 480p 价格最低,720p 为默认值,1080p 最清晰。
  • 各分辨率单价不同,见模型页。
可选值: 480p, 720p, 1080p
示例:"720p"
duration
integer默认:5
  • 输出视频时长(秒),2 到 30 之间的任意整数。
  • 也接受 OpenAI 视频接口的 seconds(字符串,如 "10")作为别名,二者只传其一。
范围: 2 ≤ x ≤ 30
示例:5
first_image_url
string<uri>必填
首帧。
  • 严格作为生成视频的第一帧。
  • 图像限制:JPEG、JPG、PNG(不支持透明通道)、BMP 或 WEBP;宽和高 240–8,000 像素;宽高比 1:8 至 8:1;不超过 20 MB。
  • 只接受公开的 HTTPS URL;不接受文件和 base64。
示例:"https://example.com/first-frame.png"
last_image_url
string<uri>
末帧;需要先提供 first_image_url。
  • 严格作为生成视频的最后一帧,必须与 first_image_url 搭配使用。
  • 图像限制:JPEG、JPG、PNG(不支持透明通道)、BMP 或 WEBP;宽和高 240–8,000 像素;宽高比 1:8 至 8:1;不超过 20 MB。
  • 只接受公开的 HTTPS URL;不接受文件和 base64。
需要先提供 first_image_url。
示例:"https://example.com/last-frame.png"
callback_url
string<uri>
可选,任务结束时接收通知的公网 HTTPS 地址。
  • 任务完成后,APIKO 会 POST 与 GET /v1/tasks/{id} 相同的 JSON,并带请求头 X-Apiko-Task-Id,最多重试 3 次。
  • 回调不带签名:请重新查询任务确认结果。
示例:"https://your-domain.com/webhooks/apiko-task"

响应

200 - application/json

请求被接受时扣费;以 failed 结束的任务全额退款。

id
string
视频任务 ID。使用 GET /v1/videos/{id} 或 GET /v1/tasks/{id} 查询。
示例:"task_abc123"
status
enum<string>
任务状态。每 5~10 秒轮询一次,直到变为 completed 或 failed。
可选值: queued, in_progress, completed, failed
progress
integer
进度范围为 0 到 100。
video_url
string<uri>
任务为 completed 时,GET /v1/videos/{id} 返回 APIKO 签名链接,保留 24 小时。GET /v1/tasks/{id} 会在 data[0].url 返回同一链接。

错误

application/json

错误格式为 { "error": { "message", "type", "param", "code" } };大多数 message 末尾带请求 id,联系支持时请提供。

400
error
请求无效。请修正请求后再试;该请求不会扣费。
  • 本页未列出的字段,例如 seed is not supported。
  • 取值超出列出的选项或范围,例如 duration must be an integer from …。
  • 缺少或为空的 prompt(prompt is required)。
  • 参考 URL 不是公开 HTTPS 地址(… must be a public HTTPS URL)。
  • last_image_url 未提供 first_image_url(last_image_url requires first_image_url)。
401
error
API Key 缺失或无效(Invalid token)。
403
error
余额不足(code: "insufficient_user_quota")。请前往控制台 → 账单充值。
404
error
GET /v1/videos/{id} 或 GET /v1/tasks/{id} 查询不存在或属于其他账号的任务(Task not found)。
503
error
模型存在,但此刻没有可用线路:No available channel for model …(code: "model_not_found")。请稍后退避重试,或换一个模型。model 缺失或拼写错误时返回 404,消息相同;这种情况请检查模型 ID,不要重试。