文档版本:v1.0.0 | 最后更新:2026-06-11 本平台已完整适配 Grok (xAI) 官方视频生成接口,请求与响应均为透传,参数语义与官方一致。
延长模式不支持自定义 aspect_ratio、resolution,输出匹配输入视频属性
输入视频格式:MP4(H.264/H.265/AV1 编码)
输入视频长度:2-15 秒
POST https://platform.dataeyes.ai/grok/v1/videos/extensions| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
Content-Type | string | 是 | application/json | 数据交换格式 |
Authorization | string | 是 | 鉴权信息,参考接口鉴权 |
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
model | string | 是 | grok-imagine-video | 模型标识 |
prompt | string | 是 | 视频生成的文本提示词 | |
video | string | 是 | 视频 URL(公开 URL、Base64 data URL 或 xAI Files API 的 file_id) | |
duration | integer | 否 | 6 | 视频时长,单位:秒 范围:2-10 |
curl --request POST \
--url 'https://platform.dataeyes.ai/grok/v1/videos/extensions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video",
"prompt": "一枚水晶能量火箭从火星红色沙丘上发射升空",
"video": "https://example.com/video.mp4",
"duration": 10
}'{
"request_id": "req_abc123def456"
}GET https://platform.dataeyes.ai/grok/v1/videos/{request_id}request_id 轮询任务状态及结果。| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
Authorization | string | 是 | Bearer {API_KEY} |
curl --request GET \
--url 'https://platform.dataeyes.ai/grok/v1/videos/{request_id}' \
--header 'Authorization: Bearer <token>'{
"status": "done",
"video": {
"url": "https://vidgen.x.ai/.../video.mp4",
"duration": 10,
"respect_moderation": true
},
"model": "grok-imagine-video"
}{
"status": "pending",
"model": "grok-imagine-video"
}{
"status": "failed",
"error": {
"code": "invalid_argument",
"message": "Prompt cannot be empty. Please provide a prompt."
}
}| 字段 | 类型 | 说明 |
|---|---|---|
status | string | 任务状态:pending, done, failed, expired |
video.url | string | 生成的视频临时 URL(有效期 24 小时) |
video.duration | integer | 生成视频的时长(秒) |
video.respect_moderation | boolean | 内容是否通过审核;若为 false 则 url 为空 |
model | string | 使用的模型 |
error.code | string | 错误码 |
error.message | string | 错误描述 |
error 对象,含 code 和 message 字段。可能的错误码如下:| 错误码 | 含义 | 处理建议 |
|---|---|---|
invalid_argument | 请求参数无效(不支持的时长、无效的图片/视频、提示词过长、冲突的模式,或内容被审核拦截) | 修正请求参数或输入媒体后重新提交 |
permission_denied | API 密钥无权执行请求的操作 | 确认 API 密钥权限 |
failed_precondition | 当前模型或设置不支持请求的操作 | 更改模型、模式、分辨率或其他设置 |
service_unavailable | 视频生成服务暂时过载 | 稍后重试 |
internal_error | 服务内部错误 | 重试请求;如持续失败,携带 request_id 联系支持 |
鉴权错误、模型不存在和限流等错误在任务创建前同步返回,不会出现在上述异步错误码中。
