Grok Imagine Video 1.5 视频生成 API
通过 APIMaster 调用 Grok Imagine Video 1.5,支持文生视频与图生视频。
Grok Imagine Video 1.5 视频生成
通过 APIMaster 的异步视频接口调用 grok-imagine-video-1.5,支持文生视频和图生视频。
Base URL:
https://apimaster.ai/v1即https://apimaster.ai/v1。创建任务使用POST https://apimaster.ai/v1/videos/generations。
提交任务
POST https://apimaster.ai/v1/videos/generations
请求头:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | 固定为 grok-imagine-video-1.5 |
prompt |
string | 是 | 视频内容描述,支持中文和英文 |
aspect_ratio |
string | 否 | 画面比例,例如 16:9、9:16、1:1,默认 16:9 |
duration |
integer | 否 | 视频时长(秒);不传时按 6 秒提交 |
resolution |
string | 否 | 480p、720p 或可用的其他分辨率,默认 720p |
image_urls |
string[] | 否 | 图生视频参考图,使用公网可访问的 HTTP(S) URL |
文生视频
curl -s "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"aspect_ratio": "16:9",
"duration": 6,
"resolution": "720p"
}'
图生视频
curl -s "https://apimaster.ai/v1/videos/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5",
"prompt": "让画面自然动起来,加入轻微镜头推进",
"image_urls": ["https://example.com/start.png"],
"aspect_ratio": "16:9",
"duration": 10,
"resolution": "720p"
}'
提交后会立即返回任务 ID:
{
"code": 200,
"data": [{"task_id": "task_xxxxxxxx", "status": "submitted"}]
}
查询任务
GET https://apimaster.ai/v1/videos/{task_id}
curl -s "https://apimaster.ai/v1/videos/task_xxxxxxxx" \
-H "Authorization: Bearer YOUR_API_KEY"
任务完成后响应会包含视频地址:
{
"id": "task_xxxxxxxx",
"status": "completed",
"progress": "100%",
"url": "https://apimaster.ai/v1/videos/task_xxxxxxxx/content"
}
下载视频
GET https://apimaster.ai/v1/videos/{task_id}/content
curl -L "https://apimaster.ai/v1/videos/task_xxxxxxxx/content" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o output.mp4
错误与限制
- Grok 任务时长不足 6 秒会按 6 秒提交;具体上限和可用分辨率以当前模型卡和接口返回为准。
image_urls中的图片必须是公网可访问的 HTTP(S) URL。401表示 API Key 无效,402表示余额不足,429表示请求过于频繁。- 任务失败时先读取查询响应中的错误信息,不要继续下载视频。
