runapi-hailuo 0.2.3 → 0.2.5
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 +4 -4
- data/README.md +43 -0
- data/lib/runapi/hailuo/resources/image_to_video.rb +15 -15
- data/lib/runapi/hailuo/resources/text_to_video.rb +5 -5
- data/lib/runapi/hailuo/types.rb +5 -5
- metadata +12 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b1230de918ea20384c9e57ac5a3747ee7ba265e84e54e84db406fe2c8cf6d896
|
|
4
|
+
data.tar.gz: ea5f47c1117700e8cb0fbf814a910557ac5b8b11e364efa7c991bcfe85eafdb9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c868db7a59aecdaabbb57b1b2e3278930062ee6a015fc2384e13287a9a8e9127a876e7401a3419aec5d5739053de220476e0287ed0bb42f068c6456f344acdf5
|
|
7
|
+
data.tar.gz: d9752d9c75ebd3e679cfb119dc0aa7047dc5ff08631e97c135babed45b05f6f295f3b50422aa5a81fdf9782e697acce8b20b6602061db0562f3f8874c217c712
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Hailuo AI API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The hailuo ai api Ruby SDK is the language-specific package for Hailuo on RunAPI. Use this hailuo ai api package for text-to-video, image-to-video, video editing, and animation flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
|
+
|
|
5
|
+
This hailuo ai api README is the Ruby package guide inside the public `hailuo-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/hailuo; for API reference, use https://runapi.ai/docs#hailuo; for SDK docs, use https://runapi.ai/docs#sdk-hailuo.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-hailuo
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-hailuo"
|
|
17
|
+
|
|
18
|
+
client = RunApi::Hailuo::Client.new
|
|
19
|
+
task = client.text_to_video.create(
|
|
20
|
+
# Pass the Hailuo JSON request body from https://runapi.ai/docs#hailuo.
|
|
21
|
+
)
|
|
22
|
+
status = client.text_to_video.get(task.id)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use `create` when you want to submit a task and return quickly, `get` when you need the latest task state, and `run` when a script should create and poll until completion. In web request handlers, prefer `create` plus webhook or later `get` polling so a worker is not held open.
|
|
26
|
+
|
|
27
|
+
## Language notes
|
|
28
|
+
|
|
29
|
+
Use Ruby keyword arguments and the `RunApi::Hailuo` error classes when building video jobs, Rails workers, or scripts. The available resources include text to videos, and image to videos. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
30
|
+
|
|
31
|
+
## Links
|
|
32
|
+
|
|
33
|
+
- Model page: https://runapi.ai/models/hailuo
|
|
34
|
+
- SDK docs: https://runapi.ai/docs#sdk-hailuo
|
|
35
|
+
- Product docs: https://runapi.ai/docs#hailuo
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/hailuo/02-text-to-video-pro
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/minimax
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
- Repository: https://github.com/runapi-ai/hailuo-sdk
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -36,35 +36,35 @@ module RunApi
|
|
|
36
36
|
model = param(params, :model)
|
|
37
37
|
raise Core::ValidationError, "model is required" unless Types::IMAGE_TO_VIDEO_MODELS.include?(model)
|
|
38
38
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
|
-
raise Core::ValidationError, "
|
|
39
|
+
raise Core::ValidationError, "first_frame_image_url is required" unless param(params, :first_frame_image_url)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
duration_seconds = param(params, :duration_seconds)
|
|
42
|
+
output_resolution = param(params, :output_resolution)
|
|
43
43
|
|
|
44
|
-
if
|
|
45
|
-
raise Core::ValidationError, "
|
|
44
|
+
if duration_seconds && !Types::DURATIONS.include?(duration_seconds)
|
|
45
|
+
raise Core::ValidationError, "duration_seconds must be one of: #{Types::DURATIONS.join(", ")}"
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
case model
|
|
49
49
|
when "hailuo-02-image-to-video-pro"
|
|
50
|
-
raise Core::ValidationError, "
|
|
51
|
-
raise Core::ValidationError, "
|
|
50
|
+
raise Core::ValidationError, "duration_seconds is not supported for #{model}" if duration_seconds
|
|
51
|
+
raise Core::ValidationError, "output_resolution is not supported for #{model}" if output_resolution
|
|
52
52
|
when "hailuo-02-image-to-video-standard"
|
|
53
|
-
|
|
53
|
+
validate_output_resolution!(output_resolution, Types::IMAGE_02_RESOLUTIONS) if output_resolution
|
|
54
54
|
else
|
|
55
|
-
|
|
56
|
-
raise Core::ValidationError, "
|
|
55
|
+
validate_output_resolution!(output_resolution, Types::IMAGE_23_RESOLUTIONS) if output_resolution
|
|
56
|
+
raise Core::ValidationError, "last_frame_image_url is not supported for #{model}" if param(params, :last_frame_image_url)
|
|
57
57
|
raise Core::ValidationError, "prompt_optimizer is not supported for #{model}" if param(params, :prompt_optimizer)
|
|
58
|
-
if
|
|
59
|
-
raise Core::ValidationError, "
|
|
58
|
+
if duration_seconds == 10 && output_resolution.to_s == "1080p"
|
|
59
|
+
raise Core::ValidationError, "1080p does not support 10-second duration"
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
def
|
|
65
|
-
return if allowed.include?(
|
|
64
|
+
def validate_output_resolution!(output_resolution, allowed)
|
|
65
|
+
return if allowed.include?(output_resolution.to_s)
|
|
66
66
|
|
|
67
|
-
raise Core::ValidationError, "
|
|
67
|
+
raise Core::ValidationError, "output_resolution must be one of: #{allowed.join(", ")}"
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -37,14 +37,14 @@ module RunApi
|
|
|
37
37
|
raise Core::ValidationError, "model is required" unless Types::TEXT_TO_VIDEO_MODELS.include?(model)
|
|
38
38
|
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
return unless
|
|
40
|
+
duration_seconds = param(params, :duration_seconds)
|
|
41
|
+
return unless duration_seconds
|
|
42
42
|
|
|
43
|
-
unless Types::DURATIONS.include?(
|
|
44
|
-
raise Core::ValidationError, "
|
|
43
|
+
unless Types::DURATIONS.include?(duration_seconds)
|
|
44
|
+
raise Core::ValidationError, "duration_seconds must be one of: #{Types::DURATIONS.join(", ")}"
|
|
45
45
|
end
|
|
46
46
|
if model == "hailuo-02-text-to-video-pro"
|
|
47
|
-
raise Core::ValidationError, "
|
|
47
|
+
raise Core::ValidationError, "duration_seconds is not supported for #{model}"
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
data/lib/runapi/hailuo/types.rb
CHANGED
|
@@ -10,9 +10,9 @@ module RunApi
|
|
|
10
10
|
hailuo-2.3-image-to-video-pro
|
|
11
11
|
hailuo-2.3-image-to-video-standard
|
|
12
12
|
].freeze
|
|
13
|
-
DURATIONS =
|
|
14
|
-
IMAGE_02_RESOLUTIONS = %w[
|
|
15
|
-
IMAGE_23_RESOLUTIONS = %w[
|
|
13
|
+
DURATIONS = [6, 10].freeze
|
|
14
|
+
IMAGE_02_RESOLUTIONS = %w[512p 768p].freeze
|
|
15
|
+
IMAGE_23_RESOLUTIONS = %w[768p 1080p].freeze
|
|
16
16
|
|
|
17
17
|
class MediaUrl < RunApi::Core::BaseModel
|
|
18
18
|
optional :url, String
|
|
@@ -21,12 +21,12 @@ module RunApi
|
|
|
21
21
|
class VideoTaskResponse < RunApi::Core::TaskResponse
|
|
22
22
|
required :id, String
|
|
23
23
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
24
|
-
optional :videos, [
|
|
24
|
+
optional :videos, [-> { MediaUrl }]
|
|
25
25
|
optional :error, String
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
class CompletedVideoTaskResponse < VideoTaskResponse
|
|
29
|
-
required :videos, [
|
|
29
|
+
required :videos, [-> { MediaUrl }]
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
32
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-hailuo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RunAPI
|
|
@@ -15,22 +15,27 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.2.
|
|
18
|
+
version: 0.2.5
|
|
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.
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.5
|
|
26
|
+
description: The hailuo ai api Ruby SDK is the language-specific package for Hailuo
|
|
27
|
+
on RunAPI. Use this hailuo ai api package for text-to-video, image-to-video, video
|
|
28
|
+
editing, and animation flows when your application needs JSON request bodies, task
|
|
29
|
+
status lookup, and consistent RunAPI errors in Ruby.
|
|
27
30
|
email:
|
|
28
31
|
- contact@runapi.ai
|
|
29
32
|
executables: []
|
|
30
33
|
extensions: []
|
|
31
|
-
extra_rdoc_files:
|
|
34
|
+
extra_rdoc_files:
|
|
35
|
+
- README.md
|
|
32
36
|
files:
|
|
33
37
|
- LICENSE
|
|
38
|
+
- README.md
|
|
34
39
|
- lib/runapi-hailuo.rb
|
|
35
40
|
- lib/runapi/hailuo.rb
|
|
36
41
|
- lib/runapi/hailuo/client.rb
|
|
@@ -42,7 +47,7 @@ licenses:
|
|
|
42
47
|
- Apache-2.0
|
|
43
48
|
metadata:
|
|
44
49
|
homepage_uri: https://runapi.ai/models/hailuo
|
|
45
|
-
documentation_uri: https://runapi
|
|
50
|
+
documentation_uri: https://github.com/runapi-ai/hailuo-sdk/blob/main/ruby/README.md
|
|
46
51
|
source_code_uri: https://github.com/runapi-ai/hailuo-sdk
|
|
47
52
|
changelog_uri: https://github.com/runapi-ai/hailuo-sdk/blob/main/CHANGELOG.md
|
|
48
53
|
rdoc_options: []
|
|
@@ -61,5 +66,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
61
66
|
requirements: []
|
|
62
67
|
rubygems_version: 4.0.10
|
|
63
68
|
specification_version: 4
|
|
64
|
-
summary: Hailuo API
|
|
69
|
+
summary: Hailuo AI API Ruby SDK for RunAPI
|
|
65
70
|
test_files: []
|