curl --request POST \
--url https://toapis.com/v1/videos/tsk_vid_01M59KNFZA2N4QFP0TMGACYH98/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}'
curl --request POST \
--url https://toapis.com/v1/videos/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6,
"video_urls": ["https://example.com/source-video.mp4"]
}'
import requests
video_id = "tsk_vid_01M59KNFZA2N4QFP0TMGACYH98"
response = requests.post(
f"https://toapis.com/v1/videos/{video_id}/extend",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const videoId = 'tsk_vid_01M59KNFZA2N4QFP0TMGACYH98';
const response = await fetch(`https://toapis.com/v1/videos/${videoId}/extend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'grok-imagine-video-official',
prompt: '继续场景,让狗跑向远方',
duration: 6
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "tsk_vid_01M59KTYQS81W0QENN56SEJ85S",
"object": "generation.task",
"model": "grok-imagine-video-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
Grok Imagine Video (Official)
Grok Imagine Video 视频延长 (官方通道)
通过官方渠道延长已生成的 Grok Imagine 视频
POST
/
v1
/
videos
/
{video_id}
/
extend
curl --request POST \
--url https://toapis.com/v1/videos/tsk_vid_01M59KNFZA2N4QFP0TMGACYH98/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}'
curl --request POST \
--url https://toapis.com/v1/videos/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6,
"video_urls": ["https://example.com/source-video.mp4"]
}'
import requests
video_id = "tsk_vid_01M59KNFZA2N4QFP0TMGACYH98"
response = requests.post(
f"https://toapis.com/v1/videos/{video_id}/extend",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const videoId = 'tsk_vid_01M59KNFZA2N4QFP0TMGACYH98';
const response = await fetch(`https://toapis.com/v1/videos/${videoId}/extend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'grok-imagine-video-official',
prompt: '继续场景,让狗跑向远方',
duration: 6
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "tsk_vid_01M59KTYQS81W0QENN56SEJ85S",
"object": "generation.task",
"model": "grok-imagine-video-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}
国内用户请注意: 中国大陆用户请使用
https://toapis.cn 作为接口地址(Base URL)。文档示例中的 https://toapis.com 请替换为 https://toapis.cn。- 官方渠道 Grok Imagine 视频延长能力
- 将已有视频延长 2-10 秒
- 异步任务管理,通过任务 ID 查询结果
Path Parameters
string
必填
原视频任务 ID即此前视频生成请求返回的任务 ID,该任务完成的视频将作为延长源。如需对任意视频 URL 延长而不关联源任务,使用
POST /v1/videos/extend,并在请求体中传 video_urls 代替路径参数。Authorizations
string
必填
所有接口均需要使用 Bearer Token 进行认证获取 API Key:访问 API Key 管理页面 获取您的 API Key使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
Body
string
默认值:"grok-imagine-video-official"
必填
视频延长模型名称示例:
"grok-imagine-video-official"string
必填
视频延长的文本描述
integer
默认值:"6"
延长时长(秒)支持范围:
2–10 秒string[]
源视频 URL 列表。使用
POST /v1/videos/extend 且无任务 ID 时必填;路径中已带 video_id 时可选。支持公网 http:///https:// URL 或平台 asset:// 引用。计费说明:延长计费 = 生成的延长秒数 + 输入源视频时长 按秒计费。源视频时长由平台自动确定,请求中无需声明。
Response
string
唯一任务标识,用于查询任务状态
string
对象类型,始终为
generation.taskstring
使用的模型名称
string
任务状态
queued- 排队等待处理in_progress- 处理中completed- 已完成failed- 失败
integer
任务进度百分比(0-100)
integer
任务创建时间戳(Unix 时间戳)
object
任务元数据
curl --request POST \
--url https://toapis.com/v1/videos/tsk_vid_01M59KNFZA2N4QFP0TMGACYH98/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}'
curl --request POST \
--url https://toapis.com/v1/videos/extend \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6,
"video_urls": ["https://example.com/source-video.mp4"]
}'
import requests
video_id = "tsk_vid_01M59KNFZA2N4QFP0TMGACYH98"
response = requests.post(
f"https://toapis.com/v1/videos/{video_id}/extend",
headers={
"Authorization": "Bearer your-ToAPIs-key",
"Content-Type": "application/json"
},
json={
"model": "grok-imagine-video-official",
"prompt": "继续场景,让狗跑向远方",
"duration": 6
}
)
task = response.json()
print(f"Task ID: {task['id']}")
print(f"Status: {task['status']}")
const videoId = 'tsk_vid_01M59KNFZA2N4QFP0TMGACYH98';
const response = await fetch(`https://toapis.com/v1/videos/${videoId}/extend`, {
method: 'POST',
headers: {
'Authorization': 'Bearer your-ToAPIs-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'grok-imagine-video-official',
prompt: '继续场景,让狗跑向远方',
duration: 6
})
});
const task = await response.json();
console.log(`Task ID: ${task.id}`);
console.log(`Status: ${task.status}`);
{
"id": "tsk_vid_01M59KTYQS81W0QENN56SEJ85S",
"object": "generation.task",
"model": "grok-imagine-video-official",
"status": "queued",
"progress": 0,
"created_at": 1768380224,
"metadata": {}
}