APIMPAPIMP
User GuideAI APIImage APIVideo APIPublic API

grok-imagine

Submit an async xAI Grok Imagine video generation task. Returns a task_id to poll via the status endpoint.

POST
/api/generate/submit

Authorization

BearerAuth

AuthorizationBearer <token>

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx

In: header

Request Body

application/json

model*string

Grok Imagine 模型名。

Value in"grok-imagine"
prompt*string

视频描述。T2V 必填;I2V 建议填以描述动作 / 转场。

size?string

视频比例。

Value in"16:9" | "9:16" | "1:1" | "3:2" | "2:3"
duration?integer

视频时长,单位为秒。范围 6..30,默认 6。

Range6 <= value <= 30
quality?string

输出清晰度。

Value in"480p" | "720p"
images?array<string>

参考图 URL 列表。上限 7 张。

Itemsitems <= 7
[key: string]?never

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.apimp.ai/api/generate/submit" \  -H "Content-Type: application/json" \  -d '{    "model": "grok-imagine",    "prompt": "A cat playing piano in a jazz club"  }'
{
  "code": 200,
  "data": {
    "task_id": "task_2BvCWmHzG6sJxK4tQpAr8M9nZyYfRdLs",
    "status": "not_started",
    "created_time": "2026-07-08T09:21:26",
    "error_message": null
  }
}

{
  "code": 400,
  "error": {
    "message": "prompt is required unless `image` or `images` is provided",
    "type": "invalid_request_error"
  }
}

{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}
{
  "code": 400,
  "error": {
    "message": "string",
    "type": "invalid_request_error"
  }
}

How is this guide?

Last updated on