runapi-kling 0.2.7 → 0.2.8

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: 584b5be5ffeeb256f9d0d2a33533132cce5d94a48ba70b67382f603e3f63993e
4
- data.tar.gz: 0e3421cbd6a27db1744dfb5b4f79ed94cc7cace043ea8cd0e3adad8423520df8
3
+ metadata.gz: '06496c392220522b5dedc8acd4f71436ba22fd51df6ac685d8600fc5a5f3d02f'
4
+ data.tar.gz: ba507498208a38a168ec79b1e7a1041c95101c5aa510f1ba11cd55a3cd6e4a1a
5
5
  SHA512:
6
- metadata.gz: ee240679da24f460d550384d362eb05b5547a3f96a6a96b188652bd51813c2237500daf89c6d236cc1d876560fbe17521deaf1590de946b020aad3b6bbc33fdd
7
- data.tar.gz: 13b5771791a2148eaf1d7535e633ce6d4f372413a76133376909f92d6dc07ea2355b2b0d8643cd0d4a0dac3265b7ea6011d57fe6946ba9bd2ae1cb78b888197f
6
+ metadata.gz: 361d632584c9a124c7e295bd3ae2f337f0434166ee76e13871afc5e17a96fc11e30f86802daa65724f1c8ee421cc4638ab97329cacce8dff1e14a701f12e0f89
7
+ data.tar.gz: 2a4358323094f9d1d2269b857107927042707cb003df73abb7855d3305cf30d1bcf5e09bda2799dec94da92ca85fc72d5eb5ac334e448de688749ac81a16daba
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::Kling` error classes when building video jobs, Rails workers, or scripts. The available resources include text-to-video, image-to-video, AI avatars, V2.1/V2.5 video variants, and motion controls. Keep `RUNAPI_API_KEY` in the environment or your secret manager; never commit API keys or callback secrets.
@@ -9,7 +9,7 @@ module RunApi
9
9
  # result = client.text_to_video.run(
10
10
  # model: "kling-3.0", prompt: "A cat walking through a garden"
11
11
  # )
12
- class Client
12
+ class Client < RunApi::Core::Client
13
13
  # @return [Resources::TextToVideo] Text-to-video operations.
14
14
  attr_reader :text_to_video
15
15
  # @return [Resources::AiAvatar] AI avatar generation operations.
@@ -20,10 +20,7 @@ module RunApi
20
20
  attr_reader :motion_control
21
21
 
22
22
  def initialize(api_key: nil, **options)
23
- @api_key = Core::Auth.resolve_api_key(api_key)
24
-
25
- client_options = Core::ClientOptions.new(api_key: @api_key, **options)
26
- http = client_options.http_client || Core::HttpClient.new(client_options)
23
+ super
27
24
  @text_to_video = Resources::TextToVideo.new(http)
28
25
  @ai_avatar = Resources::AiAvatar.new(http)
29
26
  @image_to_video = Resources::ImageToVideo.new(http)
@@ -2,13 +2,17 @@
2
2
 
3
3
  module RunApi
4
4
  module Kling
5
+ # Type definitions and constants for Kling video generation.
5
6
  module Types
7
+ # Text-to-video model variants. kling-3.0 supports multi-shot, sound, and elements;
8
+ # V2.x models support negative prompts and cfg_scale.
6
9
  TEXT_TO_VIDEO_MODELS = %w[
7
10
  kling-3.0
8
11
  kling-v2.5-turbo-text-to-video-pro
9
12
  kling-v2.1-master-text-to-video
10
13
  ].freeze
11
14
 
15
+ # AI avatar lip-sync quality tiers, from highest to fastest.
12
16
  AI_AVATAR_MODELS = %w[
13
17
  kling-ai-avatar-pro
14
18
  kling-ai-avatar-standard
@@ -16,6 +20,7 @@ module RunApi
16
20
  kling-v1-avatar-standard
17
21
  ].freeze
18
22
 
23
+ # Image-to-video model variants. V2.5 turbo and V2.1 pro support last-frame image control.
19
24
  IMAGE_TO_VIDEO_MODELS = %w[
20
25
  kling-v2.5-turbo-image-to-video-pro
21
26
  kling-v2.1-pro
@@ -23,26 +28,34 @@ module RunApi
23
28
  kling-v2.1-master-image-to-video
24
29
  ].freeze
25
30
 
31
+ # Output resolution options. 4k is highest quality but slowest.
26
32
  TEXT_TO_VIDEO_OUTPUT_RESOLUTIONS = %w[720p 1080p 4k].freeze
27
33
 
28
34
  MOTION_CONTROL_MODELS = %w[kling-3.0].freeze
29
35
 
30
36
  MOTION_CONTROL_OUTPUT_RESOLUTIONS = %w[720p 1080p].freeze
31
37
 
38
+ # Whether the character faces the direction from the video or the image.
32
39
  MOTION_CONTROL_CHARACTER_ORIENTATIONS = %w[video image].freeze
33
40
 
41
+ # Whether the background comes from the reference video or the subject image.
34
42
  MOTION_CONTROL_BACKGROUND_SOURCES = %w[video image].freeze
35
43
 
36
44
  ASPECT_RATIOS = %w[16:9 9:16 1:1].freeze
37
45
 
46
+ # Duration range for kling-3.0 (seconds).
38
47
  DURATION_RANGE = (3..15)
39
48
 
49
+ # Per-shot duration range in multi-shot mode (seconds).
40
50
  MULTI_PROMPT_DURATION_RANGE = (1..12)
41
51
 
52
+ # Fixed duration options for V2.x models (seconds).
42
53
  FIXED_DURATIONS = [5, 10].freeze
43
54
 
55
+ # Maximum character length for each multi-shot prompt segment.
44
56
  MULTI_PROMPT_MAX_LENGTH = 500
45
57
 
58
+ # A generated video file with a download URL.
46
59
  class Video < RunApi::Core::BaseModel
47
60
  optional :url, String
48
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runapi-kling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
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 kling ai api Ruby SDK is the language-specific package for Kling
27
27
  on RunAPI. Use this kling ai api package for text-to-video, image-to-video, video
28
28
  editing, and animation flows when your application needs JSON request bodies, task