跳转到主要内容
POST
/
api
/
v1
/
jobs
/
createTask
从图像生成 Grok Imagine 视频
curl --request POST \
  --url https://api.kie.ai/api/v1/jobs/createTask \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-imagine/image-to-video",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "image_urls": [
      "https://file.aiquickdraw.com/custom-page/akr/section-images/1762247692373tw5di116.png"
    ],
    "prompt": "POV hand comes into frame handing the girl a cup of take away coffee, the girl steps out of the screen looking tired, then takes it and she says happily: \"thanks! Back to work\" she exits the frame and walks right to a different part of the office.",
    "mode": "normal"
  }
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "281e5b0*********************f39b9"
  }
}

查询任务状态

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

获取任务详情

了解如何查询任务状态并获取生成结果
对于生产环境,我们建议使用 callBackUrl 参数接收自动通知,而不是轮询状态端点。

相关资源

Authorizations

Authorization
string
header
required

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

获取 API Key:

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

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

注意:

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

Body

application/json
model
enum<string>
default:grok-imagine/image-to-video
required

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

  • 此端点必须使用 grok-imagine/image-to-video
可用选项:
grok-imagine/image-to-video
Example:

"grok-imagine/image-to-video"

input
object
required

视频生成任务的输入参数

callBackUrl
string<uri>

接收视频生成任务完成更新的 URL。可选但建议在生产环境中使用。

  • 当视频生成完成时,系统将向此 URL POST 任务状态和结果
  • 回调包含生成的视频 URL 和任务信息
  • 您的回调端点应接受包含视频结果的 JSON 负载的 POST 请求
  • 或者,使用获取任务详情端点轮询任务状态
Example:

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

Response

请求成功

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

响应消息,失败时为错误描述

Example:

"success"

data
object