Skip to content

Video

Используйте POST /v1/video/generations для синхронной генерации видео. HTTP connection остается открытым, пока provider рендерит результат.

text
POST https://api.rout.my/v1/video/generations

Запрос

bash
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
  }'

Поля запроса

ПолеТипОбязательноеПримечания
modelstringДаТочный video model ID из /v1/models.
promptstring or objectДаText prompt или { "text": "...", "image": "..." } для image-to-video.
input_imagestringНетURL, data URI или raw base64 image для image-to-video.
input_image_b64stringНетЯвный base64 image input.
image, image_url, input_image_urlstringНетАлиасы для image input.
input_videostringНетURL, data URI или raw base64 source video для edit mode.
input_video_b64stringНетЯвный base64 source video input.
input_audiostringНетURL, data URI или raw base64 source audio для моделей, которые поддерживают внешний audio track.
input_audio_b64stringНетЯвный base64 audio input.
durationnumberНетДлительность в секундах. Максимум ограничивается server-side.
resolutionstringНет480p, 720p, 1080p, 4K или WIDTHxHEIGHT.
aspect_ratio, aspectRatiostringНет16:9, 9:16, 1:1, 4:3, 3:4.
n, sampleCountintegerНетКоличество output videos. По умолчанию 1.
audiobooleanНетЯвное включение/выключение audio.
soundstringНетСтроковый audio switch для провайдеров вроде Kling: on или off.
tierstringНетУдобный video quality tier. Для Kling standard соответствует std, propro, 4k4k, если режим поддерживается.
quality, modestringНетdraft, std, pro, 4k, lossless, optimized, single или multi, если выбранная модель это поддерживает.
negative_prompt, negativePromptstringНетЧто избегать.
seedintegerНетSeed для deterministic generation, если поддерживается.
last_frame_image, lastFrameImage, image_tail, imageTailstringНетПоследний кадр для first/last-frame моделей.
reference_urls, referenceUrlsstring[]НетReference media URLs для reference-to-video моделей. Data URI/base64 временно хостятся, если возможно.
reference_images, referenceImagesstring[]НетReference image URLs для multi-reference моделей.
reference_videos, referenceVideosstring[]НетReference video URLs для моделей, которые поддерживают video references.
watermarkbooleanНетWatermark-флаг, если поддерживается.
prompt_enhancement, enhance_prompt, prompt_extend, enable_prompt_expansionbooleanНетЕдиный флаг prompt expansion/enhancement. CamelCase алиасы тоже принимаются.
camera_fixed, cameraFixedbooleanНетFixed camera для поддерживаемых Seedance моделей.
cfg_scale, cfgScalenumberНетGuidance scale для поддерживаемых Kling моделей.
camera_control, cameraControlstringНетKling camera control mode.
camera_control_config, cameraControlConfigobjectНетKling camera control config object.
shot_type, shotTypestringНетWan reference-to-video shot type, обычно single или multi.
character_orientation, characterOrientationstringНетKling motion-control orientation, обычно image или video.
keep_original_sound, keepOriginalSoundbooleanНетKling motion-control source audio flag.
voice_list, voiceListobject[]НетKling voice-control voices, максимум 2 элемента вида { "voice_id": "..." }. В prompt можно ссылаться через <<<voice_1>>>; audio должен быть включён через sound:"on" или audio:true.
person_generation, personGenerationstringНетVeo person generation mode, если поддерживается.
resize_mode, resizeModestringНетVeo resize mode, если поддерживается.
compression_quality, compressionQualitystringНетVeo compression quality, если поддерживается.
service_tier, serviceTierstringНетService tier для моделей, которые это поддерживают, например Seedance default или flex.
audio_url, audioUrlstringНетАлиасы для input_audio.
poll_timeout_ms, pollTimeoutMsintegerНетVideo job polling timeout в миллисекундах.
poll_interval_ms, pollIntervalMsintegerНетVideo job polling interval в миллисекундах.
userstringНетНеобязательный client-side user identifier.

Используйте точные model IDs из /v1/models.

Дополнительные video-поля

Эти поля можно передавать на верхнем уровне запроса. Доступность зависит от выбранной модели.

ПолеПримечания
audioВключает audio у моделей, где это поддерживается.
soundKling audio switch, обычно on или off.
negative_prompt, negativePromptЧто избегать, если модель поддерживает negative prompt.
prompt_enhancement, enhance_prompt, prompt_extend, enable_prompt_expansionPrompt expansion/enhancement, если поддерживается.
tier, quality, modeВыбор качества или режима, например Kling std/pro/4k или Wan single/multi.
watermarkWatermark-флаг, если поддерживается.
last_frame_image, lastFrameImage, image_tail, imageTailПоследний кадр для first/last-frame моделей.
voice_list, voiceListKling voice control. Если prompt использует <<<voice_1>>>, передайте соответствующие voices и включите audio.
n, sampleCountНесколько outputs для моделей, которые это поддерживают.
reference_urls, referenceUrlsReference 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, videoUrlSource 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:

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

json
{
  "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.

json
{
  "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; resolution720p или 1080p (4K также принимается на моделях Veo 3.1); aspect_ratio16:9 или 9:16. Используйте n/sampleCount для нескольких outputs, если модель это поддерживает.

Image-to-video

json
{
  "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 она не поддерживает.

json
{
  "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.

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

json
{
  "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 режимов.

json
{
  "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

json
{
  "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

json
{
  "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

json
{
  "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.

Ответ

json
{
  "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 формулу:

text
tokens = duration_sec x 60,000 x resolution x audio x quality x video_input x n x token_multiplier

Частые коэффициенты:

FactorValueMultiplier
resolution480p0.7
resolution720p или 1K1.0
resolution1080p или 2K1.8
resolution4K2.5
audiooff1.0
audioon1.3
qualitydraft0.3
qualitystd или optimized1.0
qualitypro или lossless1.5
video inputabsent1.0
video inputpresent1.7

Квота проверяется до начала генерации. Если квоты не хватает, запрос вернет 429.

API documentation for rout.my.