跳转到主要内容

接口

MethodEndpointDescription
POST/api/v1/generateTask/wan-2-5创建生成任务
GET/api/v1/statusTask/wan-2-5查询任务状态

认证

所有请求需在请求头中携带 API 密钥:
Authorization: Bearer YOUR_API_KEY

请求体

{
  "request_type": "async",
  "callback_url": "https://...",
  "provider": "auto",
  "input": {
    "mode": "text-to-video",
    "prompt": "...",
    "resolution": "1080p",
    "duration": 10,
    "aspect_ratio": "16:9",
    "image_urls": ["..."],
    "negative_prompt": "...",
    "seed": 12345,
    "enable_prompt_expansion": true
  }
}

参数

request_type
string
默认值:"async"
async(轮询)或 callback(webhook)
callback_url
string
回调 URL,当 request_type=callback 时必填(条件必填)
provider
string
默认值:"auto"
路由策略:auto、value 或 official
input
object
必填
模型输入参数
模式选项:
  • text-to-video — 从文字生成视频
  • image-to-video — 从图片生成视频

示例

文生视频
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "provider": "value",
    "input": {
      "mode": "text-to-video",
      "prompt": "a serene mountain landscape with moving clouds and gentle breeze",
      "resolution": "1080p",
      "duration": 10,
      "aspect_ratio": "16:9",
      "negative_prompt": "low quality, blurry",
      "enable_prompt_expansion": true
    }
  }'
图生视频
curl -X POST "https://api.apixo.ai/api/v1/generateTask/wan-2-5" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/callback",
    "provider": "official",
    "input": {
      "mode": "image-to-video",
      "prompt": "make this picture into a smooth cinematic shot with camera slowly zooming in",
      "resolution": "720p",
      "duration": 5,
      "image_urls": ["https://example.com/ref.jpg"],
      "enable_prompt_expansion": false,
      "seed": 42
    }
  }'

响应

POST /api/v1/generateTask/wan-2-5

成功时返回 taskId,用于后续查询状态。 成功:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
错误:
{
  "code": 400,
  "message": "Insufficient credits",
  "data": null
}

GET /api/v1/statusTask/wan-2-5

通过 taskId 查询任务执行状态与结果。
curl -X GET "https://api.apixo.ai/api/v1/statusTask/wan-2-5?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
成功:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://r2.apixo.ai/video.mp4\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
失败:
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content does not meet safety guidelines"
  }
}

状态响应字段

taskId
string
任务唯一标识。
state
string
当前任务状态:pendingprocessingsuccessfailed
resultJson
string
包含 resultUrls 数组的 JSON 字符串。仅在成功时存在。使用 JSON.parse() 解析。
failCode
string
错误码。仅当 statefailed 时存在。详见错误码
failMsg
string
可读的错误信息。仅当 statefailed 时存在。
createTime
integer
任务创建时间戳(Unix 毫秒)。
completeTime
integer
任务完成时间戳(Unix 毫秒)。
costTime
integer
处理耗时(毫秒)。

错误码

CodeDescription
400参数无效或请求错误
401API 密钥无效或缺失
429超过速率限制
Fail CodeDescription
CONTENT_VIOLATION内容违反安全准则
INVALID_IMAGE_URL无法访问提供的图片 URL

速率限制

LimitValue
Requests10000 / minute
Concurrent tasks1000
超出限制返回 429 错误。请稍后重试。

提示

  • 生成时间
    • 720p:约 50-70 秒
    • 1080p:约 70-90 秒
    • 提交任务后等待 50 秒,再每隔 5 秒轮询
  • 回调模式:建议使用 callback 模式,避免频繁轮询。
  • 视频有效期:结果 URL 有效期为 15 天。请及时下载。
  • 内容审核:prompt 需符合内容安全准则。
  • 高分辨率
    • 720p:快速生成,适合预览和社交媒体
    • 1080p:高清输出,适合专业发布与高质量内容
  • Prompt 扩展
    • enable_prompt_expansion: true(默认):系统自动优化并扩展 prompt,增加细节
    • enable_prompt_expansion: false:严格使用原始 prompt,便于精确控制
    • 短 prompt 适合扩展;详细 prompt 可关闭
  • 宽高比选择
    • 16:9:横版(默认),适用于传统视频平台
    • 9:16:竖版,适用于短视频平台与移动端
    • 1:1:正方形,适用于社交媒体
  • 负面 prompt
    • negative_prompt 避免模糊、低质量、抖动等
    • 例:“low quality, blurry, shaky, distorted”
    • 有助于提升视频稳定与清晰度
  • 种子复现:相同 seed + prompt + 参数可复现相同结果。
  • 图生视频
    • 参考图作为视频起始帧
    • 在 prompt 中描述期望的动画效果与镜头运动
    • 适合让静态图动起来、角色动画、场景扩展
  • Prompt 建议
    • 描述具体场景与动作
    • 描述动态元素
    • 描述镜头运动
    • 具体描述效果优于抽象描述
  • 时长选择
    • 5 秒:快速预览、短视频、循环动画
    • 10 秒:更多叙事空间、完整场景展示
  • 图片格式image_urls 支持 JPG、PNG、WebP,单张最大 10MB。
  • 最佳实践
    • 使用清晰、具体的 prompt
    • 启用 prompt 扩展以获得更丰富细节
    • 使用负面 prompt 避免常见问题
    • 720p 快速迭代,1080p 做最终输出

视频生成比图像耗时更长 — 生产环境请使用 callback 模式。结果 URL 15 天后失效,请及时下载重要输出。

相关