Skip to content

Video Generation

Generate videos with any model available on ImageRouter. Supports both Text-to-Video and Image-to-Video generation. Requests can be encoded as application/json or multipart/form-data (optimal for file uploads).

Terminal window
# Text-to-Video
curl 'https://api.imagerouter.io/v1/openai/videos/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{
"prompt": "YOUR_PROMPT",
"model": "ir/test-video",
"size": "auto",
"seconds": "auto",
"response_format": "url",
"image": "https://example.com/your_image.jpg"
}'

Both JSON and Form-Data encoding are accepted

Show Form-Data formatted example
Terminal window
curl 'https://api.imagerouter.io/v1/openai/videos/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'prompt=YOUR_PROMPT' \
-F 'model=ir/test-video' \
-F 'size=auto' \
-F 'seconds=auto' \
-F 'response_format=url' \
-F 'image[]=@your_image1.webp'
  • model required Video model to use for generation.

  • prompt optional Text input for generating videos. Many models require prompt, but not all.

  • size optional Accepted values are different for each model. Some models and providers completely ignore size.

    • auto [default] - Uses the default recommended size for each model.
    • WIDTHxHEIGHT (eg 1024x576)
  • seconds optional Duration of the video in seconds. Accepted values vary by model.

    • auto [default] - Uses a default duration for each model.
    • Numeric value (eg 5, 10) - Specific duration in seconds (check model details page for supported values).
  • response_format optional

    • url [default] - Returns the video URL hosted on ImageRouter’s servers. The video is saved in your logs. and is publicly accessible with the URL if you share it.
    • b64_json - Returns the video as base64-encoded JSON data. The video is saved in your logs. and is publicly accessible with the URL if you share it.
    • b64_ephemeral - Same as b64_json but the video is not saved in our system. The provider may still have it.
  • image / image[] optional Input image for Image-to-Video generation. (Supported models have “image-to-video” label here.) Accepted formats:

    • File uploadmultipart/form-data with image[] field
    • URL string"https://example.com/photo.jpg" (passed as JSON string or form field)
    • Data URI string"data:image/png;base64,..." (passed as JSON string or form field)
{
"created": 1769286389027, // timestamp
"data":[
{
"url": "https://storage.imagerouter.io/fffb4426-efbd-4bcc-87d5-47e6936bf0bb.mp4"
// or "b64_json": "...", if you select a different response_format
}
],
"latency": 6942,
"cost": 0.004
}