runapi-veo-3.1 0.2.6 → 0.2.7
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 +2 -0
- data/lib/runapi/veo_3_1/client.rb +2 -5
- data/lib/runapi/veo_3_1/resources/extend_video.rb +13 -0
- data/lib/runapi/veo_3_1/resources/text_to_video.rb +13 -0
- data/lib/runapi/veo_3_1/resources/upscale_video.rb +14 -1
- data/lib/runapi/veo_3_1/types.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5fa5bd7f269c8b608d55c11f90a388aa2df67624283c864c4f4a79c43e703b1c
|
|
4
|
+
data.tar.gz: 853aa5135a16d6ab5766a9057ac8e7417dd7a29f808a88a1ca21149d50552f67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddb090ed8af4a5e887c50f7061e89e9bbe76ce5757e7d21e870f086eb9e5038aa39dceb9744cfec01b639c2b258a6fd8fa9a074ef551b3e2aee8f959293312bc
|
|
7
|
+
data.tar.gz: 4624572eea7ce421e622d7d852bf5f08e14d8af862835c6c5cdd5372b61f445f9cda40218125620633fe4c1f6213f77b2faf9dc2e6ffbaaf6c3a2bcc5ea7ce35
|
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ status = client.generations.get(task.id)
|
|
|
24
24
|
|
|
25
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
26
|
|
|
27
|
+
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.
|
|
28
|
+
|
|
27
29
|
## Language notes
|
|
28
30
|
|
|
29
31
|
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.
|
|
@@ -9,17 +9,14 @@ module RunApi
|
|
|
9
9
|
# result = client.text_to_video.run(
|
|
10
10
|
# model: "veo-3.1-fast", prompt: "A drone shot over mountains at sunset"
|
|
11
11
|
# )
|
|
12
|
-
class Client
|
|
12
|
+
class Client < RunApi::Core::Client
|
|
13
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
|
|
17
17
|
|
|
18
18
|
def initialize(api_key: nil, **options)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
22
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
19
|
+
super
|
|
23
20
|
@text_to_video = Resources::TextToVideo.new(http)
|
|
24
21
|
@extend_video = Resources::ExtendVideo.new(http)
|
|
25
22
|
@upscale_video = Resources::UpscaleVideo.new(http)
|
|
@@ -4,6 +4,7 @@ module RunApi
|
|
|
4
4
|
module Veo31
|
|
5
5
|
module Resources
|
|
6
6
|
# Veo 3.1 video extension resource.
|
|
7
|
+
# Append additional footage to a completed text-to-video or extend-video task.
|
|
7
8
|
class ExtendVideo
|
|
8
9
|
include RunApi::Core::ResourceHelpers
|
|
9
10
|
|
|
@@ -16,17 +17,29 @@ module RunApi
|
|
|
16
17
|
@http = http
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
# Extend a video and wait until complete.
|
|
21
|
+
#
|
|
22
|
+
# @param params [Hash] extend-video parameters (requires source_task_id and prompt)
|
|
23
|
+
# @return [RunApi::Veo31::Types::CompletedExtendVideoResponse] completed task with videos
|
|
19
24
|
def run(**params)
|
|
20
25
|
task = create(**params)
|
|
21
26
|
poll_until_complete { get(task.id) }
|
|
22
27
|
end
|
|
23
28
|
|
|
29
|
+
# Create a video extension task without waiting.
|
|
30
|
+
#
|
|
31
|
+
# @param params [Hash] extend-video parameters
|
|
32
|
+
# @return [RunApi::Veo31::Types::ExtendVideoResponse] task creation result with id
|
|
24
33
|
def create(**params)
|
|
25
34
|
params = compact_params(params)
|
|
26
35
|
validate_params!(params)
|
|
27
36
|
request(:post, ENDPOINT, body: params)
|
|
28
37
|
end
|
|
29
38
|
|
|
39
|
+
# Get video extension task status by task ID.
|
|
40
|
+
#
|
|
41
|
+
# @param id [String] task ID
|
|
42
|
+
# @return [RunApi::Veo31::Types::ExtendVideoResponse] current task status
|
|
30
43
|
def get(id)
|
|
31
44
|
request(:get, "#{ENDPOINT}/#{id}")
|
|
32
45
|
end
|
|
@@ -4,6 +4,7 @@ module RunApi
|
|
|
4
4
|
module Veo31
|
|
5
5
|
module Resources
|
|
6
6
|
# Veo 3.1 text-to-video resource.
|
|
7
|
+
# Generate video from text, first/last frame images, or 1-3 reference images.
|
|
7
8
|
class TextToVideo
|
|
8
9
|
include RunApi::Core::ResourceHelpers
|
|
9
10
|
|
|
@@ -16,17 +17,29 @@ module RunApi
|
|
|
16
17
|
@http = http
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
# Generate a video and wait until complete.
|
|
21
|
+
#
|
|
22
|
+
# @param params [Hash] text-to-video parameters
|
|
23
|
+
# @return [RunApi::Veo31::Types::CompletedTextToVideoResponse] completed task with videos
|
|
19
24
|
def run(**params)
|
|
20
25
|
task = create(**params)
|
|
21
26
|
poll_until_complete { get(task.id) }
|
|
22
27
|
end
|
|
23
28
|
|
|
29
|
+
# Create a text-to-video task without waiting.
|
|
30
|
+
#
|
|
31
|
+
# @param params [Hash] text-to-video parameters
|
|
32
|
+
# @return [RunApi::Veo31::Types::TextToVideoResponse] task creation result with id
|
|
24
33
|
def create(**params)
|
|
25
34
|
params = compact_params(params)
|
|
26
35
|
validate_params!(params)
|
|
27
36
|
request(:post, ENDPOINT, body: params)
|
|
28
37
|
end
|
|
29
38
|
|
|
39
|
+
# Get text-to-video task status by task ID.
|
|
40
|
+
#
|
|
41
|
+
# @param id [String] task ID
|
|
42
|
+
# @return [RunApi::Veo31::Types::TextToVideoResponse] current task status
|
|
30
43
|
def get(id)
|
|
31
44
|
request(:get, "#{ENDPOINT}/#{id}")
|
|
32
45
|
end
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Veo31
|
|
5
5
|
module Resources
|
|
6
|
-
# Veo 3.1
|
|
6
|
+
# Veo 3.1 video upscaling resource.
|
|
7
|
+
# Increase resolution of a completed text-to-video or extend-video task to 1080p or 4K.
|
|
7
8
|
class UpscaleVideo
|
|
8
9
|
include RunApi::Core::ResourceHelpers
|
|
9
10
|
|
|
@@ -16,17 +17,29 @@ module RunApi
|
|
|
16
17
|
@http = http
|
|
17
18
|
end
|
|
18
19
|
|
|
20
|
+
# Upscale a video and wait until complete.
|
|
21
|
+
#
|
|
22
|
+
# @param params [Hash] upscale parameters (requires source_task_id and output_resolution)
|
|
23
|
+
# @return [RunApi::Veo31::Types::CompletedUpscaleVideoResponse] completed task with videos
|
|
19
24
|
def run(**params)
|
|
20
25
|
task = create(**params)
|
|
21
26
|
poll_until_complete { get(task.id) }
|
|
22
27
|
end
|
|
23
28
|
|
|
29
|
+
# Create a video upscale task without waiting.
|
|
30
|
+
#
|
|
31
|
+
# @param params [Hash] upscale parameters
|
|
32
|
+
# @return [RunApi::Veo31::Types::UpscaleVideoResponse] task creation result with id
|
|
24
33
|
def create(**params)
|
|
25
34
|
params = compact_params(params)
|
|
26
35
|
validate_params!(params)
|
|
27
36
|
request(:post, ENDPOINT, body: params)
|
|
28
37
|
end
|
|
29
38
|
|
|
39
|
+
# Get video upscale task status by task ID.
|
|
40
|
+
#
|
|
41
|
+
# @param id [String] task ID
|
|
42
|
+
# @return [RunApi::Veo31::Types::UpscaleVideoResponse] current task status
|
|
30
43
|
def get(id)
|
|
31
44
|
request(:get, "#{ENDPOINT}/#{id}")
|
|
32
45
|
end
|
data/lib/runapi/veo_3_1/types.rb
CHANGED
|
@@ -2,19 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module Veo31
|
|
5
|
+
# Type definitions and constants for Veo 3.1 video generation.
|
|
5
6
|
module Types
|
|
7
|
+
# Model variants: veo-3.1 (full quality, higher fidelity) and veo-3.1-fast (low latency).
|
|
6
8
|
MODELS = %w[veo-3.1 veo-3.1-fast].freeze
|
|
9
|
+
|
|
10
|
+
# Upscale target resolutions: 1080p (1920x1080) or 4k (3840x2160, higher detail and cost).
|
|
7
11
|
OUTPUT_RESOLUTIONS = %w[1080p 4k].freeze
|
|
12
|
+
|
|
13
|
+
# Generation input modes: text (default), first_and_last_frames (frame images),
|
|
14
|
+
# or reference (1-3 reference images, fast model only, 16:9 only).
|
|
8
15
|
INPUT_MODES = %w[text first_and_last_frames reference].freeze
|
|
16
|
+
|
|
17
|
+
# Video aspect ratios: 16:9 landscape, 9:16 portrait, auto (crop based on input dimensions).
|
|
9
18
|
ASPECT_RATIOS = %w[16:9 9:16 auto].freeze
|
|
19
|
+
|
|
20
|
+
# Allowed video durations in seconds.
|
|
10
21
|
DURATIONS = [4, 6, 8].freeze
|
|
11
22
|
|
|
23
|
+
# A generated video with its download URL and metadata.
|
|
12
24
|
class Video < RunApi::Core::BaseModel
|
|
13
25
|
optional :url, String
|
|
14
26
|
optional :resolution, String
|
|
15
27
|
optional :has_audio
|
|
16
28
|
end
|
|
17
29
|
|
|
30
|
+
# An input source (original image or video) referenced by the task.
|
|
18
31
|
class Source < RunApi::Core::BaseModel
|
|
19
32
|
optional :url, String
|
|
20
33
|
end
|
|
@@ -34,6 +47,7 @@ module RunApi
|
|
|
34
47
|
optional :sources, [-> { Source }]
|
|
35
48
|
end
|
|
36
49
|
|
|
50
|
+
# Upscale task response. Includes the source task reference and optional media identifiers.
|
|
37
51
|
class UpscaleVideoResponse < AsyncTaskResponse
|
|
38
52
|
optional :source_task_id, String
|
|
39
53
|
optional :videos, [-> { Video }]
|
|
@@ -41,6 +55,9 @@ module RunApi
|
|
|
41
55
|
optional :media_ids, [String]
|
|
42
56
|
end
|
|
43
57
|
|
|
58
|
+
# Narrowed responses returned by +run()+ methods once polling observes
|
|
59
|
+
# +status: "completed"+. +videos+ is required so consumers never have to
|
|
60
|
+
# null-check it on a successful task.
|
|
44
61
|
class CompletedTextToVideoResponse < TextToVideoResponse
|
|
45
62
|
required :videos, [-> { Video }]
|
|
46
63
|
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.7
|
|
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.
|
|
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.
|
|
25
|
+
version: 0.2.6
|
|
26
26
|
description: The veo api Ruby SDK is the language-specific package for Veo 3 on RunAPI.
|
|
27
27
|
Use this veo api package for text-to-video, image-to-video, video editing, and animation
|
|
28
28
|
flows when your application needs JSON request bodies, task status lookup, and consistent
|