跳转到主要内容
POST
/
api
/
v1
/
jobs
/
createTask
使用 wan/2-6-text-to-video 从文本生成视频
curl --request POST \
  --url https://api.kie.ai/api/v1/jobs/createTask \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "wan/2-6-text-to-video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "In a hyperrealistic ASMR video, a hand uses a knitted knife to slowly slice a burger made entirely of knitted wool. The satisfyingly crisp cut reveals a detailed cross-section of knitted meat, lettuce, and tomato slices. Captured in a close-up with a shallow depth of field, the scene is set against a stark, matte black surface. Cinematic lighting makes the surreal yarn textures shine with clear reflections. The focus is on the deliberate, satisfying motion and the unique, tactile materials.",
    "duration": "5",
    "resolution": "1080p"
  }
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_wan_1765967707657"
  }
}

概述

使用 Wan 2.6 文转视频模型直接从文本描述生成视频。此模型无需输入图像即可从自然语言提示创建动态视频内容。

使用提示

  • 支持中文和英文提示
  • 最大提示长度:5,000 个字符
  • 最小提示长度:1 个字符
  • 根据您的需求选择合适的时长和质量

查询任务状态

提交任务后,使用统一的查询端点检查进度并检索结果:

获取任务详情

了解如何查询任务状态和检索生成结果
对于生产使用,我们建议使用 callBackUrl 参数接收生成完成时的自动通知,而不是轮询状态端点。

相关资源

授权

Authorization
string
header
必填

所有 API 都需要通过 Bearer Token 进行身份验证。

获取 API Key:

  1. 访问 API Key 管理页面 获取您的 API Key

使用方法: 在请求头中添加: Authorization: Bearer YOUR_API_KEY

注意:

  • 请妥善保管您的 API Key,不要与他人分享
  • 如果您怀疑 API Key 已被泄露,请立即在管理页面重置

请求体

application/json
model
enum<string>
默认值:wan/2-6-text-to-video
必填

用于生成的模型名称。必填字段。

  • 此端点必须为 wan/2-6-text-to-video
可用选项:
wan/2-6-text-to-video
示例:

"wan/2-6-text-to-video"

callBackUrl
string<uri>

接收生成任务完成更新的 URL。生产环境可选但推荐使用。

  • 系统会在生成完成时向此 URL 发送 POST 请求,包含任务状态和结果
  • 回调包含生成的内容 URL 和任务信息
  • 您的回调端点应接受包含 JSON 有效负载的 POST 请求
  • 或者使用 Get Task Details 端点轮询任务状态
示例:

"https://your-domain.com/api/callback"

input
object

生成任务的输入参数

响应

请求成功

code
enum<integer>

响应状态码

  • 200: 成功 - 请求已成功处理
  • 401: 未授权 - 身份验证凭据缺失或无效
  • 402: 积分不足 - 账户没有足够的积分来执行操作
  • 404: 未找到 - 请求的资源或端点不存在
  • 422: 验证错误 - 请求参数未通过验证检查
  • 429: 请求频率限制 - 已超过此资源的请求限制
  • 455: 服务不可用 - 系统当前正在维护中
  • 500: 服务器错误 - 处理请求时发生意外错误
  • 501: 生成失败 - 内容生成任务失败
  • 505: 功能已禁用 - 请求的功能当前已禁用
可用选项:
200,
401,
402,
404,
422,
429,
455,
500,
501,
505
msg
string

Response message, error description when failed

示例:

"success"

data
object