The project is in a healthy, maintained state
Create image-to-video tasks, poll their status, and retrieve generated video URLs with Image to Video AI.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 12.3, < 14
 Project Readme

Image to Video AI Ruby

Gem Version Tests

A small Ruby client for the Image to Video AI generator. It creates image-to-video tasks, polls task status, and returns generated video URLs. The gem uses only the Ruby standard library at runtime.

Installation

gem install image_to_video_ai

Or add it to your Gemfile:

gem "image_to_video_ai", "~> 0.1"

Create an API key in your Image to Video AI account, then keep it outside source control:

export IMAGE_TO_VIDEO_AI_API_KEY="your_api_key"

Create a video

The input image must be available through a public HTTPS URL.

require "image_to_video_ai"

client = ImageToVideoAI::Client.new
task = client.create_video(
  image_url: "https://example.com/start-frame.jpg",
  prompt: "Slow camera push-in while the subject turns toward the light",
  model: "seedance-1.5-pro",
  duration: 5,
  aspect_ratio: "16:9"
)

puts "Created #{task.task_id} with status #{task.status}"

Query or wait for the result

task = client.result(task_id: task.task_id)

finished = client.wait_for_result(
  task_id: task.task_id,
  interval: 5,
  timeout: 600
)

if finished.successful?
  puts finished.url
else
  warn "Generation ended with status: #{finished.status}"
end

Optional generation controls

create_video also accepts resolution, generate_audio, tail_image_url, and audio_url. Model capabilities and credit costs vary; unsupported parameter combinations are returned as structured API errors.

begin
  client.create_video(image_url: "https://example.com/frame.jpg", prompt: "Pan left")
rescue ImageToVideoAI::APIError => error
  warn "#{error.status}: #{error.message} (API code #{error.code})"
end

Development

Run tests without real credentials or network requests:

ruby -Ilib test/client_test.rb

Build the gem locally:

gem build image_to_video_ai.gemspec

Security

  • Never commit API keys.
  • Load IMAGE_TO_VIDEO_AI_API_KEY from the environment or a secret manager.
  • The client sends the key only in the Authorization: Bearer header.
  • Tests use an injected fake transport and contain no credentials.

License

MIT