runapi-happyhorse 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c4f0f454f1eb15878f3c4edd3f7d958db1777e5ffb6260c0f29e0774fa587bd
4
- data.tar.gz: 0c0f9d96f07ed1d893a531df62c42f5c2896b1c61d56e751635b973d7608d6f0
3
+ metadata.gz: 8420f63d7f99ed90385490503c24de7fcb1057aafe9c7d2e707e0509df9daeb2
4
+ data.tar.gz: 76648efbe65479f2c4c042ae4e5d11b2fc51e8f76c0fe113836f784e797c4f98
5
5
  SHA512:
6
- metadata.gz: 1464ac2c22e0349fdb59df6a910a8afd1ae31be12831847359182b09da136ed7e332f9a3df0d32bbe2a5ada0c711a2e78eb14f3ecb509e8f5e25640100de8490
7
- data.tar.gz: 0cc07a34f20984589248c3571a528e35085194557e5477fbed9b524ecc78dacf308511dc0a68750488ff5da5c926b454d42e7be743d51d8b061ce587fd3c6975
6
+ metadata.gz: f7e08714a1d7b8ffb5f22ac49c0d652876eeedff7c8e0a460cb9114db6604d9a98c275cb56d8244b46a0602891f62bf2ab9af652afa824476de778dc9ef6acbf
7
+ data.tar.gz: fefb8e30365b1d577314ef2de5dcda68bce75f85125fd0734128a5f648f255a5f2a3bdd26fc1078d637631662265ce7ab49ed197deb071cc1cfbbe5b6411c701
data/README.md CHANGED
@@ -26,6 +26,8 @@ video = client.text_to_video.run(
26
26
 
27
27
  For image-to-video, call `client.image_to_video.run` with `model: "happyhorse-image-to-video"` and exactly one `image_urls` entry. For character-guided text-to-video, call `client.text_to_video.run` with `model: "happyhorse-character"` and 1-9 `reference_image_urls` entries. For edit-video, call `client.edit_video.run` with `model: "happyhorse-edit-video"`, one `video_url`, and optional `reference_image` entries.
28
28
 
29
+ RunAPI-generated file URLs are temporary. Download and store generated images, videos, audio, or other files in your own durable storage within 7 days; do not treat returned URLs as long-term assets.
30
+
29
31
  ## Links
30
32
 
31
33
  - Model page: https://runapi.ai/models/happyhorse
@@ -2,14 +2,23 @@
2
2
 
3
3
  module RunApi
4
4
  module HappyHorse
5
- class Client
6
- attr_reader :text_to_video, :image_to_video, :edit_video
5
+ # HappyHorse video generation and editing API client.
6
+ #
7
+ # @example
8
+ # client = RunApi::HappyHorse::Client.new(api_key: "your-api-key")
9
+ # result = client.text_to_video.run(
10
+ # model: "happyhorse-text-to-video", prompt: "A horse galloping across a sunset beach"
11
+ # )
12
+ class Client < RunApi::Core::Client
13
+ # @return [Resources::TextToVideo] Text-to-video generation with optional character consistency.
14
+ attr_reader :text_to_video
15
+ # @return [Resources::ImageToVideo] Image-to-video animation from a first-frame image.
16
+ attr_reader :image_to_video
17
+ # @return [Resources::EditVideo] Video editing with text prompts and reference images.
18
+ attr_reader :edit_video
7
19
 
8
20
  def initialize(api_key: nil, **options)
9
- @api_key = Core::Auth.resolve_api_key(api_key)
10
-
11
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
12
- http = client_options.http_client || Core::HttpClient.new(client_options)
21
+ super
13
22
  @text_to_video = Resources::TextToVideo.new(http)
14
23
  @image_to_video = Resources::ImageToVideo.new(http)
15
24
  @edit_video = Resources::EditVideo.new(http)
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module HappyHorse
5
5
  module Resources
6
+ # HappyHorse edit-video resource.
7
+ # Transform an existing video with a text prompt and optional reference images.
6
8
  class EditVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -16,17 +18,29 @@ module RunApi
16
18
  @http = http
17
19
  end
18
20
 
21
+ # Create an edit-video task and wait until complete.
22
+ #
23
+ # @param params [Hash] edit-video parameters
24
+ # @return [RunApi::HappyHorse::Types::CompletedEditVideoResponse] completed task with videos
19
25
  def run(**params)
20
26
  task = create(**params)
21
27
  poll_until_complete { get(task.id) }
22
28
  end
23
29
 
30
+ # Create an edit-video task.
31
+ #
32
+ # @param params [Hash] edit-video parameters
33
+ # @return [RunApi::HappyHorse::Types::EditVideoResponse] task creation result with id
24
34
  def create(**params)
25
35
  params = compact_params(params)
26
36
  validate_params!(params)
27
37
  request(:post, ENDPOINT, body: params)
28
38
  end
29
39
 
40
+ # Get edit-video task status by task ID.
41
+ #
42
+ # @param id [String] task ID
43
+ # @return [RunApi::HappyHorse::Types::EditVideoResponse] current task status
30
44
  def get(id)
31
45
  request(:get, "#{ENDPOINT}/#{id}")
32
46
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module HappyHorse
5
5
  module Resources
6
+ # HappyHorse image-to-video resource.
7
+ # Animate a still first-frame image into video, guided by an optional text prompt.
6
8
  class ImageToVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -15,17 +17,29 @@ module RunApi
15
17
  @http = http
16
18
  end
17
19
 
20
+ # Create an image-to-video task and wait until complete.
21
+ #
22
+ # @param params [Hash] image-to-video parameters
23
+ # @return [RunApi::HappyHorse::Types::CompletedImageToVideoResponse] completed task with videos
18
24
  def run(**params)
19
25
  task = create(**params)
20
26
  poll_until_complete { get(task.id) }
21
27
  end
22
28
 
29
+ # Create an image-to-video task.
30
+ #
31
+ # @param params [Hash] image-to-video parameters
32
+ # @return [RunApi::HappyHorse::Types::ImageToVideoResponse] task creation result with id
23
33
  def create(**params)
24
34
  params = compact_params(params)
25
35
  validate_params!(params)
26
36
  request(:post, ENDPOINT, body: params)
27
37
  end
28
38
 
39
+ # Get image-to-video task status by task ID.
40
+ #
41
+ # @param id [String] task ID
42
+ # @return [RunApi::HappyHorse::Types::ImageToVideoResponse] current task status
29
43
  def get(id)
30
44
  request(:get, "#{ENDPOINT}/#{id}")
31
45
  end
@@ -3,6 +3,8 @@
3
3
  module RunApi
4
4
  module HappyHorse
5
5
  module Resources
6
+ # HappyHorse text-to-video resource.
7
+ # Generate video from a text prompt, with optional character consistency via happyhorse-character.
6
8
  class TextToVideo
7
9
  include RunApi::Core::ResourceHelpers
8
10
 
@@ -16,17 +18,29 @@ module RunApi
16
18
  @http = http
17
19
  end
18
20
 
21
+ # Create a text-to-video task and wait until complete.
22
+ #
23
+ # @param params [Hash] text-to-video parameters
24
+ # @return [RunApi::HappyHorse::Types::CompletedTextToVideoResponse] completed task with videos
19
25
  def run(**params)
20
26
  task = create(**params)
21
27
  poll_until_complete { get(task.id) }
22
28
  end
23
29
 
30
+ # Create a text-to-video task.
31
+ #
32
+ # @param params [Hash] text-to-video parameters
33
+ # @return [RunApi::HappyHorse::Types::TextToVideoResponse] task creation result with id
24
34
  def create(**params)
25
35
  params = compact_params(params)
26
36
  validate_params!(params)
27
37
  request(:post, ENDPOINT, body: params)
28
38
  end
29
39
 
40
+ # Get text-to-video task status by task ID.
41
+ #
42
+ # @param id [String] task ID
43
+ # @return [RunApi::HappyHorse::Types::TextToVideoResponse] current task status
30
44
  def get(id)
31
45
  request(:get, "#{ENDPOINT}/#{id}")
32
46
  end
@@ -2,18 +2,28 @@
2
2
 
3
3
  module RunApi
4
4
  module HappyHorse
5
+ # Type definitions and constants for HappyHorse video generation and editing.
5
6
  module Types
7
+ # Standard text-to-video model.
6
8
  TEXT_TO_VIDEO_MODEL = "happyhorse-text-to-video"
9
+ # Character-consistent model; requires 1-9 reference_image_urls.
7
10
  CHARACTER_MODEL = "happyhorse-character"
11
+ # All text-to-video model variants.
8
12
  TEXT_TO_VIDEO_MODELS = [TEXT_TO_VIDEO_MODEL, CHARACTER_MODEL].freeze
9
13
  IMAGE_TO_VIDEO_MODEL = "happyhorse-image-to-video"
10
14
  EDIT_VIDEO_MODEL = "happyhorse-edit-video"
15
+ # Output resolution options. Defaults to 1080p.
11
16
  OUTPUT_RESOLUTIONS = %w[720p 1080p].freeze
17
+ # Aspect ratio options. Defaults to 16:9.
12
18
  ASPECT_RATIOS = %w[16:9 9:16 1:1 4:3 3:4].freeze
19
+ # Audio handling for video editing: "auto" lets the model decide, "original" preserves source audio.
13
20
  AUDIO_SETTINGS = %w[auto original].freeze
21
+ # Duration range in seconds (3-15). Defaults to 5.
14
22
  DURATION_RANGE = (3..15)
23
+ # Reproducibility seed range.
15
24
  SEED_RANGE = (0..2_147_483_647)
16
25
 
26
+ # A generated video file with a download URL.
17
27
  class MediaUrl < RunApi::Core::BaseModel
18
28
  optional :url, String
19
29
  end
@@ -25,6 +35,8 @@ module RunApi
25
35
  optional :error, String
26
36
  end
27
37
 
38
+ # Narrowed response returned by +run()+ once polling observes +status: "completed"+.
39
+ # +videos+ is required so consumers never have to null-check it on a successful task.
28
40
  class CompletedTextToVideoResponse < TextToVideoResponse
29
41
  required :videos, [-> { MediaUrl }]
30
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-happyhorse
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RunAPI
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 0.2.5
18
+ version: 0.2.6
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 0.2.5
25
+ version: 0.2.6
26
26
  description: The happyhorse ai api Ruby SDK is the language-specific package for HappyHorse
27
27
  on RunAPI. Use this package for text, image, and edit-video workflows that need
28
28
  JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.