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": {}
}