Video
Используйте POST /v1/video/generations для синхронной генерации видео. HTTP connection остается открытым, пока provider рендерит результат.
POST https://api.rout.my/v1/video/generationsЗапрос
curl --max-time 900 https://api.rout.my/v1/video/generations \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "provider/video-model-id",
"prompt": "A slow camera move across a glass cube on a white table",
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9",
"n": 1
}'Поля запроса
| Поле | Тип | Обязательное | Примечания |
|---|---|---|---|
model | string | Да | Точный video model ID из /v1/models. |
prompt | string or object | Да | Text prompt или { "text": "...", "image": "..." } для image-to-video. |
input_image | string | Нет | URL, data URI или raw base64 image для image-to-video. |
input_image_b64 | string | Нет | Явный base64 image input. |
image, image_url, input_image_url | string | Нет | Алиасы для image input. |
input_video | string | Нет | URL, data URI или raw base64 source video для edit mode. |
input_video_b64 | string | Нет | Явный base64 source video input. |
input_audio | string | Нет | URL, data URI или raw base64 source audio для моделей, которые поддерживают внешний audio track. |
input_audio_b64 | string | Нет | Явный base64 audio input. |
duration | number | Нет | Длительность в секундах. Максимум ограничивается server-side. |
resolution | string | Нет | 480p, 720p, 1080p, 4K или WIDTHxHEIGHT. |
aspect_ratio, aspectRatio | string | Нет | 16:9, 9:16, 1:1, 4:3, 3:4. |
n, sampleCount | integer | Нет | Количество output videos. По умолчанию 1. |
audio | boolean | Нет | Явное включение/выключение audio. |
sound | string | Нет | Строковый audio switch для провайдеров вроде Kling: on или off. |
tier | string | Нет | Удобный video quality tier. Для Kling standard соответствует std, pro — pro, 4k — 4k, если режим поддерживается. |
quality, mode | string | Нет | draft, std, pro, 4k, lossless, optimized, single или multi, если выбранная модель это поддерживает. |
negative_prompt, negativePrompt | string | Нет | Что избегать. |
seed | integer | Нет | Seed для deterministic generation, если поддерживается. |
last_frame_image, lastFrameImage, image_tail, imageTail | string | Нет | Последний кадр для first/last-frame моделей. |
reference_urls, referenceUrls | string[] | Нет | Reference media URLs для reference-to-video моделей. Data URI/base64 временно хостятся, если возможно. |
reference_images, referenceImages | string[] | Нет | Reference image URLs для multi-reference моделей. |
reference_videos, referenceVideos | string[] | Нет | Reference video URLs для моделей, которые поддерживают video references. |
watermark | boolean | Нет | Watermark-флаг, если поддерживается. |
prompt_enhancement, enhance_prompt, prompt_extend, enable_prompt_expansion | boolean | Нет | Единый флаг prompt expansion/enhancement. CamelCase алиасы тоже принимаются. |
camera_fixed, cameraFixed | boolean | Нет | Fixed camera для поддерживаемых Seedance моделей. |
cfg_scale, cfgScale | number | Нет | Guidance scale для поддерживаемых Kling моделей. |
camera_control, cameraControl | string | Нет | Kling camera control mode. |
camera_control_config, cameraControlConfig | object | Нет | Kling camera control config object. |
shot_type, shotType | string | Нет | Wan reference-to-video shot type, обычно single или multi. |
character_orientation, characterOrientation | string | Нет | Kling motion-control orientation, обычно image или video. |
keep_original_sound, keepOriginalSound | boolean | Нет | Kling motion-control source audio flag. |
voice_list, voiceList | object[] | Нет | Kling voice-control voices, максимум 2 элемента вида { "voice_id": "..." }. В prompt можно ссылаться через <<<voice_1>>>; audio должен быть включён через sound:"on" или audio:true. |
person_generation, personGeneration | string | Нет | Veo person generation mode, если поддерживается. |
resize_mode, resizeMode | string | Нет | Veo resize mode, если поддерживается. |
compression_quality, compressionQuality | string | Нет | Veo compression quality, если поддерживается. |
service_tier, serviceTier | string | Нет | Service tier для моделей, которые это поддерживают, например Seedance default или flex. |
audio_url, audioUrl | string | Нет | Алиасы для input_audio. |
poll_timeout_ms, pollTimeoutMs | integer | Нет | Video job polling timeout в миллисекундах. |
poll_interval_ms, pollIntervalMs | integer | Нет | Video job polling interval в миллисекундах. |
user | string | Нет | Необязательный client-side user identifier. |
Используйте точные model IDs из /v1/models.
Дополнительные video-поля
Эти поля можно передавать на верхнем уровне запроса. Доступность зависит от выбранной модели.
| Поле | Примечания |
|---|---|
audio | Включает audio у моделей, где это поддерживается. |
sound | Kling audio switch, обычно on или off. |
negative_prompt, negativePrompt | Что избегать, если модель поддерживает negative prompt. |
prompt_enhancement, enhance_prompt, prompt_extend, enable_prompt_expansion | Prompt expansion/enhancement, если поддерживается. |
tier, quality, mode | Выбор качества или режима, например Kling std/pro/4k или Wan single/multi. |
watermark | Watermark-флаг, если поддерживается. |
last_frame_image, lastFrameImage, image_tail, imageTail | Последний кадр для first/last-frame моделей. |
voice_list, voiceList | Kling voice control. Если prompt использует <<<voice_1>>>, передайте соответствующие voices и включите audio. |
n, sampleCount | Несколько outputs для моделей, которые это поддерживают. |
reference_urls, referenceUrls | Reference media для -r2v моделей, например Wan reference-to-video. |
reference_images, referenceImages | Несколько image references для моделей, которые это поддерживают, включая Seedance 2.0 и Wan reference-to-video. |
reference_videos, referenceVideos | Несколько video references для моделей, которые это поддерживают, включая Seedance 2.0. |
input_video, video_url, videoUrl | Source video для xAI video editing, Kling motion-control или один Seedance 2.0 video reference. |
input_audio, audio_url, audioUrl | Внешний audio track, если поддерживается. |
poll_timeout_ms, poll_interval_ms | Более долгий wait для медленных video jobs. |
Некоторые edit и motion-control модели не поддерживают duration, resolution и aspect_ratio.
Kling tiers, audio и voice control
Kling Standard / Pro / 4K можно выбирать через tier, mode или quality:
{
"model": "klingai/kling-v3.0-t2v",
"prompt": "A chef plates a dessert with cinematic lighting.",
"tier": "pro",
"sound": "on",
"duration": 5,
"aspect_ratio": "16:9"
}tier:"standard" превращается в Kling mode std, tier:"pro" — в pro, а tier:"4k" — в 4k, если выбранная Kling-модель поддерживает режим.
Для voice control добавьте voice_list и используйте ссылки на голоса в prompt:
{
"model": "klingai/kling-v3.0-t2v",
"prompt": "The man <<<voice_1>>> said, \"Hello.\"",
"tier": "pro",
"sound": "on",
"voice_list": [
{ "voice_id": "voice-id-from-provider" }
]
}Voice control принимает до 2 голосов. Если prompt содержит маркеры <<<voice_1>>>, нужен voice_list, а sound должен быть включён.
Veo
Используйте Veo model IDs из /v1/models, например google/veo-3.1 или google/veo-3.1-fast.
{
"model": "google/veo-3.1-fast",
"prompt": "A robot skating through a neon arcade, cinematic motion",
"duration": 6,
"resolution": "720p",
"aspect_ratio": "16:9",
"n": 2,
"audio": true
}Для Veo text-to-video duration должен быть 4, 6 или 8; resolution — 720p или 1080p (4K также принимается на моделях Veo 3.1); aspect_ratio — 16:9 или 9:16. Используйте n/sampleCount для нескольких outputs, если модель это поддерживает.
Image-to-video
{
"model": "provider/video-model-id",
"prompt": {
"text": "Animate this product with a slow turntable movement.",
"image": "https://example.com/source.png"
},
"duration": 5,
"resolution": "720p"
}Base64 и data URI images временно публикуются как URL, когда это нужно.
xAI Grok Imagine 1.5 Preview
x-ai/grok-imagine-video-1.5-preview — image-to-video модель. Ей нужен image input; text-to-video она не поддерживает.
{
"model": "x-ai/grok-imagine-video-1.5-preview",
"prompt": "Slow cinematic push-in as embers drift across the battlefield and the helmet's crest stirs in the wind",
"image_url": "https://your-host.com/helmet.jpg",
"duration": 10,
"resolution": "720p"
}Можно использовать input_image, image_url или prompt:{"image":"..."}. input_video для этой модели не используется.
Seedance 2.0 Fast
bytedance/seedance-2.0-fast поддерживает text-to-video, image-to-video и multimodal references через reference_images, reference_videos, input_video и input_audio.
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Use the image as visual reference and animate it with a slow cinematic camera move.",
"input_image": "https://example.com/reference.png",
"duration": 5,
"resolution": "480p",
"aspect_ratio": "16:9"
}Для нескольких image references:
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Use [Image 1] as the main character and [Image 2] as the product reference in a cinematic street scene.",
"reference_images": [
"https://example.com/character.png",
"https://example.com/product.png"
],
"duration": 5,
"resolution": "720p",
"aspect_ratio": "16:9"
}Для video reference используйте input_video для одного клипа или reference_videos для нескольких клипов. Для audio reference используйте input_audio или audio_url. Когда input_image используется вместе с audio/video references на Seedance 2.0, rout.my считает картинку reference image, чтобы избежать конфликта first-frame и reference-media режимов.
{
"model": "bytedance/seedance-2.0-fast",
"prompt": "Use the image references for characters, the video reference for motion, and the audio reference for soundtrack timing.",
"reference_images": [
"https://example.com/character.png",
"https://example.com/background.png"
],
"reference_videos": [
"https://example.com/motion.mp4"
],
"input_audio": "https://example.com/music.mp3",
"duration": 5,
"resolution": "480p",
"aspect_ratio": "16:9"
}Video editing
{
"model": "provider/video-model-id",
"prompt": "Make the camera movement smoother and keep the same subject.",
"input_video": "https://example.com/source.mp4",
"duration": 5,
"resolution": "720p"
}input_video включает video-input accounting. Base64 videos можно передавать через input_video_b64; они временно хостятся, если нужно.
Для некоторых edit и motion-control моделей duration, resolution и aspect_ratio не поддерживаются и могут игнорироваться.
Motion control
{
"model": "klingai/kling-v2.6-motion-control",
"prompt": {
"image": "https://example.com/character.png",
"text": "Make the character follow the reference motion."
},
"input_video": "https://example.com/reference-motion.mp4",
"mode": "pro",
"character_orientation": "image",
"keep_original_sound": false
}Motion-control модели требуют и character image, и reference video URL.
Reference-to-video
{
"model": "qwen/wan-v2.6-r2v",
"prompt": "character1 and character2 talk in a cafe",
"reference_urls": [
"https://example.com/character1.png",
"https://example.com/character2.png"
],
"duration": 4,
"resolution": "1080p",
"mode": "single"
}reference_urls обязателен для -r2v моделей. Эти модели используют reference media вместо основного input_image.
Ответ
{
"created": 1744000000,
"model": "provider/video-model-id",
"duration": 5,
"videos": [
{
"url": "https://api.rout.my/public/media/generated.mp4",
"mime_type": "video/mp4"
}
]
}Generated video URLs временные. Если приложению нужно долгосрочное хранение, скачайте и перехостите видео.
Расход квоты
Video requests используют duration-based формулу:
tokens = duration_sec x 60,000 x resolution x audio x quality x video_input x n x token_multiplierЧастые коэффициенты:
| Factor | Value | Multiplier |
|---|---|---|
| resolution | 480p | 0.7 |
| resolution | 720p или 1K | 1.0 |
| resolution | 1080p или 2K | 1.8 |
| resolution | 4K | 2.5 |
| audio | off | 1.0 |
| audio | on | 1.3 |
| quality | draft | 0.3 |
| quality | std или optimized | 1.0 |
| quality | pro или lossless | 1.5 |
| video input | absent | 1.0 |
| video input | present | 1.7 |
Квота проверяется до начала генерации. Если квоты не хватает, запрос вернет 429.