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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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: 'Continue the scene, make the dog run towards the horizon',
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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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: 'Continue the scene, make the dog run towards the horizon',
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
обязательно
Все запросы к API требуют аутентификации по Bearer TokenПолучение API Key: посетите страницу управления API-ключамиДобавьте в заголовки запроса:
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 присутствует в пути.Публичные URL http:///https:// или ссылки на активы asset:// платформы.Примечание о тарификации: Продление тарифицируется как сгенерированные секунды продления плюс длительность исходного видео посекундно. Длительность исходного видео определяется платформой автоматически; указывать её в запросе не нужно.
Response
string
Уникальный идентификатор задачи для проверки статуса
string
Тип объекта, всегда
generation.taskstring
Название использованной модели
string
Статус задачи
queued- ожидает обработкиin_progress- обрабатываетсяcompleted- успешно завершенаfailed- ошибка
integer
Прогресс задачи в процентах (0-100)
integer
Временная метка создания задачи (Unix timestamp)
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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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": "Continue the scene, make the dog run towards the horizon",
"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: 'Continue the scene, make the dog run towards the horizon',
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": {}
}