runapi-runway-aleph 0.2.4 → 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 +47 -0
- data/lib/runapi/runway_aleph/client.rb +15 -7
- data/lib/runapi/runway_aleph/resources/edit_video.rb +56 -0
- data/lib/runapi/runway_aleph/types.rb +18 -7
- data/lib/runapi/runway_aleph.rb +1 -1
- metadata +13 -8
- data/lib/runapi/runway_aleph/resources/video_to_video.rb +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cd1a2c7953995524e7ce7c3f88f2667e2b923ed82a239d62fa63e4b9a1870b3
|
|
4
|
+
data.tar.gz: d24449e7225a3550b3d4c060f05cdd39e36668cae35f0017b30de4d68afc879f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fc7b7a96bb69611bc2efb285636fe28eab811cf00ec7552d34caf9d77036bab3cbefc0af2a279f0f2ef2e137b874c1434adf6d12d95100643c1cc49e2cdbca73
|
|
7
|
+
data.tar.gz: b1b83c07f3af2882cfce0f564d53ad7cd39bd9e54d95ac0b4ab13a42bd9ec3785de2f14f383c00cbb71cfe0289526f85afbbd4d49553c6be0d33322bbbd746c0
|
data/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Runway Aleph API Ruby SDK for RunAPI
|
|
2
|
+
|
|
3
|
+
The runway aleph api Ruby SDK is the language-specific package for Runway Aleph on RunAPI. Use this runway aleph api package for prompt-guided video editing when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Ruby.
|
|
4
|
+
|
|
5
|
+
This runway aleph api README is the Ruby package guide inside the public `runway-aleph-sdk` repository. For the repository overview, start at `../README.md`; for model details, use https://runapi.ai/models/runway-aleph; for API reference, use https://runapi.ai/docs#runway-aleph; for SDK docs, use https://runapi.ai/docs#sdk-runway-aleph.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install runapi-runway_aleph
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
require "runapi-runway_aleph"
|
|
17
|
+
|
|
18
|
+
client = RunApi::RunwayAleph::Client.new
|
|
19
|
+
task = client.edit_video.create(
|
|
20
|
+
model: "runway-aleph",
|
|
21
|
+
prompt: "Transform the scene into a watercolor painting style",
|
|
22
|
+
video_url: "https://cdn.runapi.ai/public/samples/video.mp4"
|
|
23
|
+
)
|
|
24
|
+
status = client.edit_video.get(task.id)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
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.
|
|
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
|
+
|
|
31
|
+
## Language notes
|
|
32
|
+
|
|
33
|
+
Use Ruby keyword arguments and the `RunApi::RunwayAleph` error classes when building video jobs, Rails workers, or scripts. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
|
|
34
|
+
|
|
35
|
+
## Links
|
|
36
|
+
|
|
37
|
+
- Model page: https://runapi.ai/models/runway-aleph
|
|
38
|
+
- SDK docs: https://runapi.ai/docs#sdk-runway-aleph
|
|
39
|
+
- Product docs: https://runapi.ai/docs#runway-aleph
|
|
40
|
+
- Pricing and rate limits: https://runapi.ai/models/runway-aleph
|
|
41
|
+
- Provider comparison: https://runapi.ai/providers/runway
|
|
42
|
+
- Full catalog: https://runapi.ai/models
|
|
43
|
+
- Repository: https://github.com/runapi-ai/runway-aleph-sdk
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module RunwayAleph
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
# Runway Aleph prompt-driven video editing API client.
|
|
6
|
+
# Unlike generation from scratch, Runway Aleph transforms an existing video
|
|
7
|
+
# using a text prompt, with optional style reference images.
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# client = RunApi::RunwayAleph::Client.new(api_key: "your-api-key")
|
|
11
|
+
# result = client.edit_video.run(
|
|
12
|
+
# prompt: "Make it look like a watercolor painting",
|
|
13
|
+
# source_video_url: "https://example.com/input.mp4"
|
|
14
|
+
# )
|
|
15
|
+
class Client < RunApi::Core::Client
|
|
16
|
+
# @return [Resources::EditVideo] Prompt-driven video editing with optional style reference.
|
|
17
|
+
attr_reader :edit_video
|
|
7
18
|
|
|
8
19
|
def initialize(api_key: nil, **options)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
client_options = Core::ClientOptions.new(api_key: @api_key, **options)
|
|
12
|
-
http = client_options.http_client || Core::HttpClient.new(client_options)
|
|
13
|
-
@video_to_video = Resources::VideoToVideo.new(http)
|
|
20
|
+
super
|
|
21
|
+
@edit_video = Resources::EditVideo.new(http)
|
|
14
22
|
end
|
|
15
23
|
end
|
|
16
24
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module RunwayAleph
|
|
5
|
+
module Resources
|
|
6
|
+
# Runway Aleph video editing resource.
|
|
7
|
+
# Transform an existing video using a text prompt and optional style reference image.
|
|
8
|
+
class EditVideo
|
|
9
|
+
include RunApi::Core::ResourceHelpers
|
|
10
|
+
|
|
11
|
+
ENDPOINT = "/api/v1/runway_aleph/edit_video"
|
|
12
|
+
RESPONSE_CLASS = Types::TaskCreateResponse
|
|
13
|
+
COMPLETED_RESPONSE_CLASS = Types::CompletedEditVideoResponse
|
|
14
|
+
|
|
15
|
+
def initialize(http)
|
|
16
|
+
@http = http
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Transform a video and wait until complete.
|
|
20
|
+
#
|
|
21
|
+
# @param params [Hash] edit parameters
|
|
22
|
+
# @return [RunApi::RunwayAleph::Types::CompletedEditVideoResponse] completed task with videos
|
|
23
|
+
def run(**params)
|
|
24
|
+
task = create(**params)
|
|
25
|
+
poll_until_complete { get(task.id) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Start a video editing task.
|
|
29
|
+
#
|
|
30
|
+
# @param params [Hash] edit parameters
|
|
31
|
+
# @return [RunApi::RunwayAleph::Types::TaskCreateResponse] task creation result with id
|
|
32
|
+
def create(**params)
|
|
33
|
+
params = compact_params(params)
|
|
34
|
+
validate_params!(params)
|
|
35
|
+
request(:post, ENDPOINT, body: params)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get video editing task status by task ID.
|
|
39
|
+
#
|
|
40
|
+
# @param id [String] task ID
|
|
41
|
+
# @return [RunApi::RunwayAleph::Types::EditVideoResponse] current task status
|
|
42
|
+
def get(id)
|
|
43
|
+
request(:get, "#{ENDPOINT}/#{id}")
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def validate_params!(params)
|
|
49
|
+
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
50
|
+
raise Core::ValidationError, "source_video_url is required" unless param(params, :source_video_url)
|
|
51
|
+
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -2,27 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
module RunApi
|
|
4
4
|
module RunwayAleph
|
|
5
|
+
# Type definitions and constants for Runway Aleph video editing.
|
|
5
6
|
module Types
|
|
7
|
+
# Output aspect ratio options. Includes 21:9 ultra-wide for cinematic letterbox output.
|
|
6
8
|
ASPECT_RATIOS = %w[16:9 9:16 4:3 3:4 1:1 21:9].freeze
|
|
7
9
|
|
|
10
|
+
# A generated output video.
|
|
8
11
|
class Video < RunApi::Core::BaseModel
|
|
9
12
|
optional :id, String
|
|
10
13
|
required :url, String
|
|
11
14
|
end
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
# A reference or extracted image.
|
|
17
|
+
class Image < RunApi::Core::BaseModel
|
|
18
|
+
required :url, String
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Task status response for a video editing operation.
|
|
22
|
+
# Includes output videos and images when the task completes.
|
|
23
|
+
class EditVideoResponse < RunApi::Core::TaskResponse
|
|
14
24
|
required :id, String
|
|
15
25
|
optional :status, String, enum: -> { RunApi::Core::TaskResponse::Status::ALL }
|
|
16
|
-
optional :videos, [
|
|
17
|
-
optional :
|
|
18
|
-
optional :parent_task_id, String
|
|
26
|
+
optional :videos, [-> { Video }]
|
|
27
|
+
optional :images, [-> { Image }]
|
|
19
28
|
optional :error, String
|
|
20
29
|
end
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
# Initial response when a video editing task is created.
|
|
32
|
+
class TaskCreateResponse < EditVideoResponse; end
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
# Completed video editing response with guaranteed output videos.
|
|
35
|
+
class CompletedEditVideoResponse < EditVideoResponse
|
|
36
|
+
required :videos, [-> { Video }]
|
|
26
37
|
end
|
|
27
38
|
end
|
|
28
39
|
end
|
data/lib/runapi/runway_aleph.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: runapi-runway-aleph
|
|
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,33 +15,38 @@ 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.
|
|
26
|
-
description:
|
|
25
|
+
version: 0.2.6
|
|
26
|
+
description: The runway aleph api Ruby SDK is the language-specific package for Runway
|
|
27
|
+
Aleph on RunAPI. Use this runway aleph api package for prompt-guided video editing
|
|
28
|
+
when your application needs JSON request bodies, task status lookup, and consistent
|
|
29
|
+
RunAPI errors in Ruby.
|
|
27
30
|
email:
|
|
28
31
|
- support@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-runway_aleph.rb
|
|
35
40
|
- lib/runapi/runway_aleph.rb
|
|
36
41
|
- lib/runapi/runway_aleph/client.rb
|
|
37
|
-
- lib/runapi/runway_aleph/resources/
|
|
42
|
+
- lib/runapi/runway_aleph/resources/edit_video.rb
|
|
38
43
|
- lib/runapi/runway_aleph/types.rb
|
|
39
44
|
homepage: https://runapi.ai/models/runway-aleph
|
|
40
45
|
licenses:
|
|
41
46
|
- Apache-2.0
|
|
42
47
|
metadata:
|
|
43
48
|
homepage_uri: https://runapi.ai/models/runway-aleph
|
|
44
|
-
documentation_uri: https://github.com/runapi-ai/runway-aleph-sdk/blob/main/README.md
|
|
49
|
+
documentation_uri: https://github.com/runapi-ai/runway-aleph-sdk/blob/main/ruby/README.md
|
|
45
50
|
source_code_uri: https://github.com/runapi-ai/runway-aleph-sdk
|
|
46
51
|
changelog_uri: https://github.com/runapi-ai/runway-aleph-sdk/blob/main/CHANGELOG.md
|
|
47
52
|
rdoc_options: []
|
|
@@ -60,5 +65,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
60
65
|
requirements: []
|
|
61
66
|
rubygems_version: 4.0.10
|
|
62
67
|
specification_version: 4
|
|
63
|
-
summary: Runway Aleph API
|
|
68
|
+
summary: Runway Aleph API Ruby SDK for RunAPI
|
|
64
69
|
test_files: []
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RunApi
|
|
4
|
-
module RunwayAleph
|
|
5
|
-
module Resources
|
|
6
|
-
class VideoToVideo
|
|
7
|
-
include RunApi::Core::ResourceHelpers
|
|
8
|
-
|
|
9
|
-
ENDPOINT = "/api/v1/runway_aleph/video_to_video"
|
|
10
|
-
RESPONSE_CLASS = Types::TaskCreateResponse
|
|
11
|
-
COMPLETED_RESPONSE_CLASS = Types::CompletedVideoToVideoResponse
|
|
12
|
-
|
|
13
|
-
def initialize(http)
|
|
14
|
-
@http = http
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def run(**params)
|
|
18
|
-
task = create(**params)
|
|
19
|
-
poll_until_complete { get(task.id) }
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def create(**params)
|
|
23
|
-
params = compact_params(params)
|
|
24
|
-
validate_params!(params)
|
|
25
|
-
request(:post, ENDPOINT, body: params)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def get(id)
|
|
29
|
-
request(:get, "#{ENDPOINT}/#{id}")
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
def validate_params!(params)
|
|
35
|
-
raise Core::ValidationError, "prompt is required" unless param(params, :prompt)
|
|
36
|
-
raise Core::ValidationError, "video_url is required" unless param(params, :video_url)
|
|
37
|
-
validate_optional!(params, :aspect_ratio, Types::ASPECT_RATIOS)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|