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
参考图 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
错误处理建议
如果创建任务返回5xx,且错误信息包含 task_id is empty,通常表示上游没有接受本次任务。常见触发原因包括提示词过长、分镜描述过密或上游临时拒绝创建任务。建议客户端记录当前 prompt 的字符数与字节数,并在重试前压缩提示词。