runapi-veo-3.1 0.2.1 → 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 +4 -4
- data/README.md +43 -0
- data/lib/runapi/veo_3_1/client.rb +1 -1
- data/lib/runapi/veo_3_1/resources/extend_video.rb +1 -1
- data/lib/runapi/veo_3_1/resources/text_to_video.rb +40 -17
- data/lib/runapi/veo_3_1/resources/upscale_video.rb +5 -5
- data/lib/runapi/veo_3_1/types.rb +18 -10
- metadata +13 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 304c93ccbf6c01279040c323008db17aa2168d4d7e01c1a0582ef3bb348bf4ea
|
|
4
|
+
data.tar.gz: 293d5ac2cc0d180d94b3e7469731080b0f96b03613abe6f963b25035be95ab27
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce3a494d33a8289424abe5237c86699eafa66514017664f14e3aa4a087ef968d50e23de3a4b0df34e0fec0c92997d6b26c004f3196b07564a8aadafe9cb4bac7
|
|
7
|
+
data.tar.gz: 214f758deab6d00915cf7d97118ab2b9d5ee226de2f7e628651207d4a1ed3460de0f134eea122fc97707720ac437b83a779bb172c29e25d8f8ae359afd362029
|
data/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Veo API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The veo api Ruby SDK is the language-specific package for Veo 3 on RunAPI. Use this veo 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 veo api README is the Ruby package guide inside the public `veo3-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/veo-3.1; for API reference, use https://runapi.ai/docs#veo-3.1; for SDK docs, use https://runapi.ai/docs#sdk-veo-3.1.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-veo3
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-veo3"
|
|
17
|
+
|
|
18
|
+
client = RunApi::Veo3::Client.new
|
|
19
|
+
task = client.generations.create(
|
|
20
|
+
# Pass the Veo 3 JSON request body from https://runapi.ai/docs#veo-3.1.
|
|
21
|
+
)
|
|
22
|
+
status = client.generations.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::Veo3` error classes when building video jobs, Rails workers, or scripts. Text-to-video request bodies can include `duration` with `4`, `6`, or `8` seconds. The available resources include generations, extensions, hd1080p, and hd4k. 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/veo-3.1
|
|
34
|
+
- SDK docs: https://runapi.ai/docs#sdk-veo-3.1
|
|
35
|
+
- Product docs: https://runapi.ai/docs#veo-3.1
|
|
36
|
+
- Pricing and rate limits: https://runapi.ai/models/veo-3.1/veo-3.1
|
|
37
|
+
- Provider comparison: https://runapi.ai/providers/google
|
|
38
|
+
- Full catalog: https://runapi.ai/models
|
|
39
|
+
- Repository: https://github.com/runapi-ai/veo3-sdk
|
|
40
|
+
|
|
41
|
+
## License
|
|
42
|
+
|
|
43
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -10,7 +10,7 @@ module RunApi
|
|
|
10
10
|
# model: "veo-3.1-fast", prompt: "A drone shot over mountains at sunset"
|
|
11
11
|
# )
|
|
12
12
|
class Client
|
|
13
|
-
# @return [Resources::TextToVideo] Text, image, and reference-
|
|
13
|
+
# @return [Resources::TextToVideo] Text, image, and reference-image operations.
|
|
14
14
|
# @return [Resources::ExtendVideo] Video extension operations.
|
|
15
15
|
# @return [Resources::UpscaleVideo] Video upscaling operations.
|
|
16
16
|
attr_reader :text_to_video, :extend_video, :upscale_video
|
|
@@ -34,7 +34,7 @@ module RunApi
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
36
|
def validate_params!(params)
|
|
37
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_task_id is required" unless params[:source_task_id] || params["source_task_id"]
|
|
38
38
|
raise Core::ValidationError, "prompt is required" unless params[:prompt] || params["prompt"]
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -43,38 +43,61 @@ module RunApi
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
46
|
-
validate_optional!(params, :
|
|
46
|
+
validate_optional!(params, :input_mode, Types::INPUT_MODES)
|
|
47
|
+
validate_duration!(params)
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
validate_input_mode!(params)
|
|
49
50
|
end
|
|
50
51
|
|
|
51
|
-
def
|
|
52
|
-
|
|
53
|
-
return unless
|
|
52
|
+
def validate_duration!(params)
|
|
53
|
+
duration_seconds = param(params, :duration_seconds)
|
|
54
|
+
return unless duration_seconds
|
|
55
|
+
return if Types::DURATIONS.include?(duration_seconds)
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
raise Core::ValidationError, "Invalid duration_seconds: #{duration_seconds}. Must be one of: #{Types::DURATIONS.join(", ")}"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def validate_input_mode!(params)
|
|
61
|
+
input_mode = param(params, :input_mode)
|
|
62
|
+
return unless input_mode
|
|
63
|
+
|
|
64
|
+
case input_mode
|
|
65
|
+
when "first_and_last_frames"
|
|
66
|
+
raise Core::ValidationError, "first_frame_image_url is required for first_and_last_frames" unless field_present?(params, :first_frame_image_url)
|
|
67
|
+
if field_present?(params, :reference_image_urls)
|
|
68
|
+
raise Core::ValidationError, "reference_image_urls requires input_mode reference"
|
|
61
69
|
end
|
|
62
|
-
when "
|
|
63
|
-
urls = param(params, :
|
|
64
|
-
raise Core::ValidationError, "
|
|
70
|
+
when "reference"
|
|
71
|
+
urls = param(params, :reference_image_urls)
|
|
72
|
+
raise Core::ValidationError, "reference_image_urls is required for reference" unless urls
|
|
65
73
|
unless urls.is_a?(Array) && urls.length.between?(1, 3)
|
|
66
|
-
raise Core::ValidationError, "
|
|
74
|
+
raise Core::ValidationError, "reference_image_urls must contain 1-3 items for reference"
|
|
67
75
|
end
|
|
68
76
|
model = param(params, :model)
|
|
69
77
|
unless model == "veo-3.1-fast"
|
|
70
|
-
raise Core::ValidationError, "
|
|
78
|
+
raise Core::ValidationError, "reference requires model veo-3.1-fast"
|
|
71
79
|
end
|
|
72
80
|
ar = param(params, :aspect_ratio)
|
|
73
81
|
if ar && ar != "16:9"
|
|
74
|
-
raise Core::ValidationError, "
|
|
82
|
+
raise Core::ValidationError, "reference requires aspect_ratio 16:9"
|
|
83
|
+
end
|
|
84
|
+
if field_present?(params, :first_frame_image_url) || field_present?(params, :last_frame_image_url)
|
|
85
|
+
raise Core::ValidationError, "first_frame_image_url and last_frame_image_url require input_mode first_and_last_frames"
|
|
86
|
+
end
|
|
87
|
+
else
|
|
88
|
+
if field_present?(params, :first_frame_image_url) || field_present?(params, :last_frame_image_url)
|
|
89
|
+
raise Core::ValidationError, "first_frame_image_url and last_frame_image_url require input_mode first_and_last_frames"
|
|
90
|
+
end
|
|
91
|
+
if field_present?(params, :reference_image_urls)
|
|
92
|
+
raise Core::ValidationError, "reference_image_urls requires input_mode reference"
|
|
75
93
|
end
|
|
76
94
|
end
|
|
77
95
|
end
|
|
96
|
+
|
|
97
|
+
def field_present?(params, key)
|
|
98
|
+
value = param(params, key)
|
|
99
|
+
value.is_a?(Array) ? value.any? : !value.nil? && !value.to_s.empty?
|
|
100
|
+
end
|
|
78
101
|
end
|
|
79
102
|
end
|
|
80
103
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Veo31
|
|
5
5
|
module Resources
|
|
6
|
-
# Veo 3.1
|
|
6
|
+
# Veo 3.1 videos upscaling resource.
|
|
7
7
|
class UpscaleVideo
|
|
8
8
|
include RunApi::Core::ResourceHelpers
|
|
9
9
|
|
|
@@ -34,10 +34,10 @@ module RunApi
|
|
|
34
34
|
private
|
|
35
35
|
|
|
36
36
|
def validate_params!(params)
|
|
37
|
-
raise Core::ValidationError, "
|
|
38
|
-
|
|
39
|
-
unless Types::
|
|
40
|
-
raise Core::ValidationError, "
|
|
37
|
+
raise Core::ValidationError, "source_task_id is required" unless params[:source_task_id] || params["source_task_id"]
|
|
38
|
+
output_resolution = params[:output_resolution] || params["output_resolution"]
|
|
39
|
+
unless Types::OUTPUT_RESOLUTIONS.include?(output_resolution)
|
|
40
|
+
raise Core::ValidationError, "output_resolution must be one of: #{Types::OUTPUT_RESOLUTIONS.join(", ")}"
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
data/lib/runapi/veo_3_1/types.rb
CHANGED
|
@@ -4,9 +4,10 @@ module RunApi
|
|
|
4
4
|
module Veo31
|
|
5
5
|
module Types
|
|
6
6
|
MODELS = %w[veo-3.1 veo-3.1-fast].freeze
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
OUTPUT_RESOLUTIONS = %w[1080p 4k].freeze
|
|
8
|
+
INPUT_MODES = %w[text first_and_last_frames reference].freeze
|
|
9
9
|
ASPECT_RATIOS = %w[16:9 9:16 auto].freeze
|
|
10
|
+
DURATIONS = [4, 6, 8].freeze
|
|
10
11
|
|
|
11
12
|
class Video < RunApi::Core::BaseModel
|
|
12
13
|
optional :url, String
|
|
@@ -14,35 +15,42 @@ module RunApi
|
|
|
14
15
|
optional :has_audio
|
|
15
16
|
end
|
|
16
17
|
|
|
18
|
+
class Source < RunApi::Core::BaseModel
|
|
19
|
+
optional :url, String
|
|
20
|
+
end
|
|
21
|
+
|
|
17
22
|
class AsyncTaskResponse < RunApi::Core::TaskResponse
|
|
18
23
|
required :id, String
|
|
19
24
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
20
25
|
end
|
|
21
26
|
|
|
22
27
|
class TextToVideoResponse < AsyncTaskResponse
|
|
23
|
-
optional :videos, [
|
|
24
|
-
optional :
|
|
28
|
+
optional :videos, [-> { Video }]
|
|
29
|
+
optional :sources, [-> { Source }]
|
|
25
30
|
end
|
|
26
31
|
|
|
27
32
|
class ExtendVideoResponse < AsyncTaskResponse
|
|
28
|
-
optional :videos, [
|
|
29
|
-
optional :
|
|
33
|
+
optional :videos, [-> { Video }]
|
|
34
|
+
optional :sources, [-> { Source }]
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
class UpscaleVideoResponse < AsyncTaskResponse
|
|
33
|
-
optional :
|
|
38
|
+
optional :source_task_id, String
|
|
39
|
+
optional :videos, [-> { Video }]
|
|
40
|
+
optional :sources, [-> { Source }]
|
|
41
|
+
optional :media_ids, [String]
|
|
34
42
|
end
|
|
35
43
|
|
|
36
44
|
class CompletedTextToVideoResponse < TextToVideoResponse
|
|
37
|
-
required :videos, [
|
|
45
|
+
required :videos, [-> { Video }]
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
class CompletedExtendVideoResponse < ExtendVideoResponse
|
|
41
|
-
required :videos, [
|
|
49
|
+
required :videos, [-> { Video }]
|
|
42
50
|
end
|
|
43
51
|
|
|
44
52
|
class CompletedUpscaleVideoResponse < UpscaleVideoResponse
|
|
45
|
-
required :
|
|
53
|
+
required :videos, [-> { Video }]
|
|
46
54
|
end
|
|
47
55
|
end
|
|
48
56
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-veo-3.1
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
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:
|
|
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:
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.5
|
|
26
|
+
description: The veo api Ruby SDK is the language-specific package for Veo 3 on RunAPI.
|
|
27
|
+
Use this veo api package for text-to-video, image-to-video, video editing, and animation
|
|
28
|
+
flows when your application needs JSON request bodies, task status lookup, and consistent
|
|
29
|
+
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-veo_3_1.rb
|
|
35
40
|
- lib/runapi/veo_3_1.rb
|
|
36
41
|
- lib/runapi/veo_3_1/client.rb
|
|
@@ -43,7 +48,7 @@ licenses:
|
|
|
43
48
|
- Apache-2.0
|
|
44
49
|
metadata:
|
|
45
50
|
homepage_uri: https://runapi.ai/models/veo-3.1
|
|
46
|
-
documentation_uri: https://runapi
|
|
51
|
+
documentation_uri: https://github.com/runapi-ai/veo-3.1-sdk/blob/main/ruby/README.md
|
|
47
52
|
source_code_uri: https://github.com/runapi-ai/veo-3.1-sdk
|
|
48
53
|
changelog_uri: https://github.com/runapi-ai/veo-3.1-sdk/blob/main/CHANGELOG.md
|
|
49
54
|
rdoc_options: []
|
|
@@ -60,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
65
|
- !ruby/object:Gem::Version
|
|
61
66
|
version: '0'
|
|
62
67
|
requirements: []
|
|
63
|
-
rubygems_version: 4.0.
|
|
68
|
+
rubygems_version: 4.0.10
|
|
64
69
|
specification_version: 4
|
|
65
|
-
summary: Veo
|
|
70
|
+
summary: Veo API Ruby SDK for RunAPI
|
|
66
71
|
test_files: []
|