curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "雨夜霓虹街头,一辆复古跑车驶过湿润路面",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P"
}'
curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
]
}'
import requests
resp = requests.post(
"https://td.geeknow.top/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://td.geeknow.top/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-video-1.5-preview",
prompt: "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
seconds: "4",
aspect_ratio: "16:9",
resolution: "720P",
images: [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
}),
});
console.log(await response.json());
{
"id": "task_abc123",
"task_id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "4",
"size": "1280x720"
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "prompt",
"code": "invalid_request"
}
}
Grok 视频
Grok Imagine 1.5 Preview
使用 POST /v1/videos 调用 grok-imagine-video-1.5-preview 提交 JSON 视频生成任务。
POST
https://www.geeknow.top
/
v1
/
videos
curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "雨夜霓虹街头,一辆复古跑车驶过湿润路面",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P"
}'
curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
]
}'
import requests
resp = requests.post(
"https://td.geeknow.top/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://td.geeknow.top/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-video-1.5-preview",
prompt: "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
seconds: "4",
aspect_ratio: "16:9",
resolution: "720P",
images: [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
}),
});
console.log(await response.json());
{
"id": "task_abc123",
"task_id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "4",
"size": "1280x720"
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "prompt",
"code": "invalid_request"
}
}
Grok Imagine 1.5 Preview
grok-imagine-video-1.5-preview 是 Grok Imagine 线路的 1.5 Preview 模型。本模型使用 application/json 请求体,参考图通过顶层 images 字段传递。
- 接口路径是
POST /v1/videos。 - 请求格式是
application/json。 - 文生视频只需要
model、prompt、seconds、aspect_ratio、resolution。 seconds支持4到15秒,建议按字符串传入。- 图生视频使用
images数组传入参考图,最多7张。 - 当前 1.5 规范统一使用
images字段传入参考图。 resolution支持480P和720P。prompt最多支持4096个字符;过长或过密的提示词可能导致上游没有返回任务 ID。
方法与路径
POST /v1/videos
curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "雨夜霓虹街头,一辆复古跑车驶过湿润路面",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P"
}'
curl -X POST https://td.geeknow.top/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png"
]
}'
import requests
resp = requests.post(
"https://td.geeknow.top/v1/videos",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"model": "grok-imagine-video-1.5-preview",
"prompt": "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
"seconds": "4",
"aspect_ratio": "16:9",
"resolution": "720P",
"images": [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
},
timeout=60,
)
print(resp.json())
const response = await fetch("https://td.geeknow.top/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "grok-imagine-video-1.5-preview",
prompt: "参考多张图片中的人物外观和场景氛围,生成一段自然运镜视频",
seconds: "4",
aspect_ratio: "16:9",
resolution: "720P",
images: [
"https://example.com/reference-1.png",
"https://example.com/reference-2.png",
],
}),
});
console.log(await response.json());
响应示例
{
"id": "task_abc123",
"task_id": "task_abc123",
"object": "video",
"model": "grok-imagine-video-1.5-preview",
"status": "queued",
"progress": 0,
"created_at": 1735689600,
"seconds": "4",
"size": "1280x720"
}
{
"error": {
"message": "prompt is required",
"type": "new_api_error",
"param": "prompt",
"code": "invalid_request"
}
}
认证
Authorization: Bearer YOUR_API_KEY
Body
string
required
固定传
grok-imagine-video-1.5-preview。string
required
视频生成提示词。最多
4096 个字符。string
目标秒数。支持
4 到 15 秒;建议按字符串传入,例如 "4"。string
宽高比。支持常见预设
1:1、16:9、9:16、4:3、3:4、3:2、2:3、2:1、1:2、19.5:9、9:19.5、20:9、9:20,也支持 数字:数字 的自定义比例。string
输出清晰度。支持
480P、720P。array<string>
参考图 URL 数组,最多
7 张。请传入上游可访问的图片地址,例如 ["https://example.com/reference-1.png", "https://example.com/reference-2.png"]。请求构造规则
| 场景 | 字段组合 |
|---|---|
| 文生视频 | model、prompt、seconds、aspect_ratio、resolution |
| 图生视频 / 多图参考 | 在文生字段基础上追加 images,最多 7 张 |
images 应传入上游可访问的图片 URL 数组,最多 7 张;只有一张参考图时,也按 images: ["https://..."] 传入。不要把本地文件路径直接作为 JSON 字段提交。
Response
string
任务 ID。后续用
GET /v1/videos/{id} 查询结果。string
任务 ID。部分响应会同时返回
id 与 task_id,两者可指向同一个任务。string
对象类型,通常为
video。string
任务对应的模型名。该字段用于展示和排查,不应用作任务 ID。
string
任务状态,常见值有
queued、processing、completed、failed、cancelled。integer
任务进度百分比。
string
任务完成后的视频地址。也可以使用
GET /v1/videos/{task_id}/content 下载结果。错误处理建议
如果创建任务返回5xx,且错误信息包含 task_id is empty,通常表示上游没有接受本次任务。常见触发原因包括提示词过长、分镜描述过密或上游临时拒绝创建任务。建议客户端记录当前 prompt 的字符数与字节数,并在重试前压缩提示词。