Генерация видео
Генерация видео возможна только по моделям, которые поддерживают на выходе генерацию видео. Подробно о функциональности моделей можно почитать на странице тарифы и цены.
Параметры запроса
| Параметр | Тип | Обязательный | Описание |
|---|---|---|---|
| ai | object | Да | Настройка запроса |
| --model | string | Да | Название модели из списка в тарифах API |
| --temperature | float | Нет | Настройка температуры (креативности) модели (0 - 1.0) |
| --top_p | float | Нет | Настройка разнообразности (неожиданности) слов (0 - 1.0) |
| --video_size | string | Нет | Соотношение сторон генерируемого видео (например: "16:9", "9:16"). Поддерживаемые значения для конкретной модели можно посмотреть в окне настройки чатов |
| --video_quality | string | Нет | Качество генерируемого видео (например: "720p", "1080p", "4k", "2K"). Поддерживаемые значения для конкретной модели можно посмотреть в окне настройки чатов |
| --video_duration | string | Нет | Длительность генерируемого видео в секундах (например: "4", "6", "8"). Поддерживаемые значения для конкретной модели можно посмотреть в окне настройки чатов. |
| type | string | Да | Тип генерации. Для генерации видео укажите type = out_video |
| content | array | Да | Массив объектов с запросом к нейросети |
| --type | string | Да | Тип передаваемого контента (input_file/input_text) |
| --text | string | Да | Текст запроса к нейросети |
| --file_data | string | Нет | Файл для генерации (например, изображение для video-from-image). Может содержать ссылку на файл (URL), либо base64 строку. Максимум 10 файлов / 5 МБ |
| response_format | string | Нет | Формат возвращаемого результата (b64_json/url). По умолчанию response_format = url. |
| stop_sequences | list | Нет | Список стоп фраз в запросе (не больше 50). Если указаны, будет произведен поиск вхождений. Запрос будет заблокирован, если в тексте запроса указаны стоп-фразы |
Пример запроса на генерацию видео
cURL
Python
PHP
curl -X POST "https://ai.mitup.ru/api/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"ai": {
"model": "veo-3.1",
"video_size": "16:9",
"video_quality": "720p",
"video_duration": "4"
},
"type": "out_video",
"response_format": "url",
"content": [
{
"type": "input_text",
"text": "Сгенерируй короткое видео: закат над морем, волны и чайки"
}
],
"stop_sequences": ["...", "..."]
}'import requests
url = "https://ai.mitup.ru/api/v2"
api_key = "YOUR_API_KEY"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
params = {
"ai": {
"model": "veo-3.1",
"video_size": "16:9",
"video_quality": "720p",
"video_duration": "4"
},
"type": "out_video",
"response_format": "url",
"content": [
{
"type": "input_text",
"text": "Сгенерируй короткое видео: закат над морем, волны и чайки"
}
],
"stop_sequences": ["...", "..."]
}
response = requests.post(url, json=params, headers=headers)
print(response.json())<?php
$url = "https://ai.mitup.ru/api/v2";
$api_key = "YOUR_API_KEY";
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $api_key,
];
$params = [
"ai" => [
"model" => "veo-3.1",
"video_size" => "16:9",
"video_quality" => "720p",
"video_duration" => "4"
],
"type" => "out_video",
"response_format" => "url",
"content" => [
[
"type" => "input_text",
"text" => "Сгенерируй короткое видео: закат над морем, волны и чайки"
]
],
"stop_sequences" => ["...", "..."]
];
$data = json_encode($params, JSON_UNESCAPED_UNICODE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'mitupai-API-client');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);
print_r($response);
?>Пример запроса на генерацию видео с файлом
cURL
Python
PHP
curl -X POST "https://ai.mitup.ru/api/v2" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"ai": {
"model": "veo-3.1",
"video_size": "16:9",
"video_quality": "720p",
"video_duration": "4"
},
"type": "out_video",
"response_format": "url",
"content": [
{
"type": "input_text",
"text": "Оживи это изображение: добавь лёгкое движение камеры и ветер в листьях"
},
{
"type": "input_file",
"file_data": "https://..."
}
],
"stop_sequences": ["...", "..."]
}'import requests
url = "https://ai.mitup.ru/api/v2"
api_key = "YOUR_API_KEY"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
params = {
"ai": {
"model": "veo-3.1",
"video_size": "16:9",
"video_quality": "720p",
"video_duration": "4"
},
"type": "out_video",
"response_format": "url",
"content": [
{
"type": "input_text",
"text": "Оживи это изображение: добавь лёгкое движение камеры и ветер в листьях"
},
{
"type": "input_file",
"file_data": "https://..."
# "file_data" может также быть base64: "data:image/png;base64,iVBO..."
}
],
"stop_sequences": ["...", "..."]
}
response = requests.post(url, json=params, headers=headers)
print(response.json())<?php
$url = "https://ai.mitup.ru/api/v2";
$api_key = "YOUR_API_KEY";
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $api_key,
];
$params = [
"ai" => [
"model" => "veo-3.1",
"video_size" => "16:9",
"video_quality" => "720p",
"video_duration" => "4"
],
"type" => "out_video",
"response_format" => "url",
"content" => [
[
"type" => "input_text",
"text" => "Оживи это изображение: добавь лёгкое движение камеры и ветер в листьях"
],
[
"type" => "input_file",
"file_data" => "https://..."
// "file_data" может также быть base64: "data:image/png;base64,iVBO..."
]
],
"stop_sequences" => ["...", "..."]
];
$data = json_encode($params, JSON_UNESCAPED_UNICODE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'mitupai-API-client');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);
print_r($response);
?>Пример возвращаемого результата:
JSON
{'message': 'Ваш запрос отправлен', 'task_id': 'YOUR_TASK_ID'}Получение результата
cURL
Python
PHP
curl -X GET "https://ai.mitup.ru/api/v2/status/{task_id}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \import requests
api_key = "YOUR_API_KEY"
task_id = "YOUR_TASK_ID"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
url = f'https://ai.mitup.ru/api/v2/status/{task_id}'
response = requests.get(url, headers=headers)
print(response.json())<?php
$api_key = "YOUR_API_KEY";
$task_id = "YOUR_TASK_ID"
$url = "https://ai.mitup.ru/api/v2/status/" . task_id;
$headers = [
"Content-Type: application/json",
"Authorization: Bearer " . $api_key
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'mitupai-API-client');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);
print_r($response);
?>Пример возвращаемого результата:
JSON
{
"balance": {
"balance": 49202.0,
"balance_referral": 0.0,
"balance_bonus": -1.9
},
"contents": {
"status": 2,
"text": "Вот, что у меня получилось:",
"cost": {
"amount": 57.6,
"input": 27,
"output": 27
},
"files": [
{
"data": "https://s3.ru1.storage.beget.cloud/.../api/YOUR_TASK_ID/video.mp4",
"mime_type": "video/mp4",
"path": "api/YOUR_TASK_ID/video.mp4",
"name": "video.mp4",
"size": 8658430,
"endpoint": "https://s3.ru1.storage.beget.cloud/.../",
"available": "12.08.26"
}
]
},
"limits": {
"minute": 0,
"day": 5
},
"error": None
}