runapi-kling 0.2.10 → 0.2.11
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52976b2c6ead958e307eb73e1074e9dae605dce26e58d3320aa0df15f3eb2d7d
|
|
4
|
+
data.tar.gz: 4c6255e788fa2950a268419a646e7d7c07c8bd2344f0f7925ef8a760b7773c25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f3a374bb8b623a477b6656f2fccb06eba3e0ebb3b6b97ead65ae491fa21fd67a64c83715ed806e79027e0ca6031f6371f69c085a085281ec3c60068547b8263
|
|
7
|
+
data.tar.gz: a233a64e104565e7be3bef7181944756460c78c3c7f9e647f1826b6ce440860fa4ee9fcc1cd6c3368b69a4c40813646b3e0278f168e548aec5f3305ca101c99e
|
data/lib/runapi/kling/client.rb
CHANGED
|
@@ -18,6 +18,7 @@ module RunApi
|
|
|
18
18
|
attr_reader :image_to_video
|
|
19
19
|
# @return [Resources::MotionControl] Motion control operations.
|
|
20
20
|
attr_reader :motion_control
|
|
21
|
+
attr_reader :extend_video
|
|
21
22
|
|
|
22
23
|
def initialize(api_key: nil, **options)
|
|
23
24
|
super
|
|
@@ -25,6 +26,7 @@ module RunApi
|
|
|
25
26
|
@ai_avatar = Resources::AiAvatar.new(http)
|
|
26
27
|
@image_to_video = Resources::ImageToVideo.new(http)
|
|
27
28
|
@motion_control = Resources::MotionControl.new(http)
|
|
29
|
+
@extend_video = Resources::ExtendVideo.new(http)
|
|
28
30
|
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
@@ -64,8 +64,29 @@ module RunApi
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"extend-video" => {
|
|
68
|
+
"models" => ["kling-v2.5-turbo-image-to-video-pro", "kling-v2.5-turbo-text-to-video-pro"],
|
|
69
|
+
"fields_by_model" => {
|
|
70
|
+
"kling-v2.5-turbo-image-to-video-pro" => {
|
|
71
|
+
"mode" => {
|
|
72
|
+
"enum" => ["std", "pro"]
|
|
73
|
+
},
|
|
74
|
+
"source_task_id" => {
|
|
75
|
+
"required" => true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"kling-v2.5-turbo-text-to-video-pro" => {
|
|
79
|
+
"mode" => {
|
|
80
|
+
"enum" => ["std", "pro"]
|
|
81
|
+
},
|
|
82
|
+
"source_task_id" => {
|
|
83
|
+
"required" => true
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
67
88
|
"image-to-video" => {
|
|
68
|
-
"models" => ["kling-v2.1-master-image-to-video", "kling-v2.1-pro", "kling-v2.1-standard", "kling-v2.5-turbo-image-to-video-pro", "kling-v2.6", "kling-v3-turbo-image-to-video"],
|
|
89
|
+
"models" => ["kling-v2.1-master-image-to-video", "kling-v2.1-pro", "kling-v2.1-standard", "kling-v2.5-turbo-image-to-video-pro", "kling-v2.6", "kling-v3-omni", "kling-v3-turbo-image-to-video"],
|
|
69
90
|
"fields_by_model" => {
|
|
70
91
|
"kling-v2.1-master-image-to-video" => {
|
|
71
92
|
"duration_seconds" => {
|
|
@@ -151,6 +172,30 @@ module RunApi
|
|
|
151
172
|
"length" => true
|
|
152
173
|
}
|
|
153
174
|
},
|
|
175
|
+
"kling-v3-omni" => {
|
|
176
|
+
"aspect_ratio" => {
|
|
177
|
+
"enum" => ["16:9", "9:16", "1:1"]
|
|
178
|
+
},
|
|
179
|
+
"duration_seconds" => {
|
|
180
|
+
"enum" => [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
181
|
+
"type" => "integer"
|
|
182
|
+
},
|
|
183
|
+
"first_frame_image_url" => {
|
|
184
|
+
"required" => true
|
|
185
|
+
},
|
|
186
|
+
"model" => {
|
|
187
|
+
"required" => true
|
|
188
|
+
},
|
|
189
|
+
"output_resolution" => {
|
|
190
|
+
"enum" => ["720p", "1080p", "4k"]
|
|
191
|
+
},
|
|
192
|
+
"prompt" => {
|
|
193
|
+
"required" => true,
|
|
194
|
+
"min" => 1,
|
|
195
|
+
"max" => 2500,
|
|
196
|
+
"length" => true
|
|
197
|
+
}
|
|
198
|
+
},
|
|
154
199
|
"kling-v3-turbo-image-to-video" => {
|
|
155
200
|
"duration_seconds" => {
|
|
156
201
|
"enum" => [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
@@ -177,32 +222,37 @@ module RunApi
|
|
|
177
222
|
"when" => {
|
|
178
223
|
"model" => "kling-v2.1-master-image-to-video"
|
|
179
224
|
},
|
|
180
|
-
"forbidden" => ["output_resolution", "
|
|
225
|
+
"forbidden" => ["output_resolution", "enable_sound"]
|
|
181
226
|
}, {
|
|
182
227
|
"when" => {
|
|
183
228
|
"model" => "kling-v2.1-pro"
|
|
184
229
|
},
|
|
185
|
-
"forbidden" => ["output_resolution", "
|
|
230
|
+
"forbidden" => ["output_resolution", "enable_sound"]
|
|
186
231
|
}, {
|
|
187
232
|
"when" => {
|
|
188
233
|
"model" => "kling-v2.1-standard"
|
|
189
234
|
},
|
|
190
|
-
"forbidden" => ["output_resolution", "
|
|
235
|
+
"forbidden" => ["output_resolution", "enable_sound"]
|
|
191
236
|
}, {
|
|
192
237
|
"when" => {
|
|
193
238
|
"model" => "kling-v2.5-turbo-image-to-video-pro"
|
|
194
239
|
},
|
|
195
|
-
"forbidden" => ["output_resolution", "
|
|
240
|
+
"forbidden" => ["output_resolution", "enable_sound"]
|
|
196
241
|
}, {
|
|
197
242
|
"when" => {
|
|
198
243
|
"model" => "kling-v2.6"
|
|
199
244
|
},
|
|
200
245
|
"forbidden" => ["output_resolution", "negative_prompt", "cfg_scale"]
|
|
246
|
+
}, {
|
|
247
|
+
"when" => {
|
|
248
|
+
"model" => "kling-v3-omni"
|
|
249
|
+
},
|
|
250
|
+
"forbidden" => ["negative_prompt", "cfg_scale"]
|
|
201
251
|
}, {
|
|
202
252
|
"when" => {
|
|
203
253
|
"model" => "kling-v3-turbo-image-to-video"
|
|
204
254
|
},
|
|
205
|
-
"forbidden" => ["
|
|
255
|
+
"forbidden" => ["enable_sound", "aspect_ratio", "negative_prompt", "cfg_scale", "last_frame_image_url"]
|
|
206
256
|
}]
|
|
207
257
|
},
|
|
208
258
|
"motion-control" => {
|
|
@@ -231,7 +281,7 @@ module RunApi
|
|
|
231
281
|
}
|
|
232
282
|
},
|
|
233
283
|
"text-to-video" => {
|
|
234
|
-
"models" => ["kling-3.0", "kling-v2.1-master-text-to-video", "kling-v2.5-turbo-text-to-video-pro", "kling-v2.6", "kling-v3-turbo-text-to-video"],
|
|
284
|
+
"models" => ["kling-3.0", "kling-v2.1-master-text-to-video", "kling-v2.5-turbo-text-to-video-pro", "kling-v2.6", "kling-v3-omni", "kling-v3-turbo-text-to-video"],
|
|
235
285
|
"fields_by_model" => {
|
|
236
286
|
"kling-3.0" => {
|
|
237
287
|
"aspect_ratio" => {
|
|
@@ -293,6 +343,27 @@ module RunApi
|
|
|
293
343
|
"length" => true
|
|
294
344
|
}
|
|
295
345
|
},
|
|
346
|
+
"kling-v3-omni" => {
|
|
347
|
+
"aspect_ratio" => {
|
|
348
|
+
"enum" => ["16:9", "9:16", "1:1"]
|
|
349
|
+
},
|
|
350
|
+
"duration_seconds" => {
|
|
351
|
+
"enum" => [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
352
|
+
"type" => "integer"
|
|
353
|
+
},
|
|
354
|
+
"model" => {
|
|
355
|
+
"required" => true
|
|
356
|
+
},
|
|
357
|
+
"output_resolution" => {
|
|
358
|
+
"enum" => ["720p", "1080p", "4k"]
|
|
359
|
+
},
|
|
360
|
+
"prompt" => {
|
|
361
|
+
"required" => true,
|
|
362
|
+
"min" => 1,
|
|
363
|
+
"max" => 2500,
|
|
364
|
+
"length" => true
|
|
365
|
+
}
|
|
366
|
+
},
|
|
296
367
|
"kling-v3-turbo-text-to-video" => {
|
|
297
368
|
"aspect_ratio" => {
|
|
298
369
|
"enum" => ["16:9", "9:16", "1:1"]
|
|
@@ -316,16 +387,6 @@ module RunApi
|
|
|
316
387
|
}
|
|
317
388
|
},
|
|
318
389
|
"rules" => [{
|
|
319
|
-
"when" => {
|
|
320
|
-
"model" => "kling-3.0"
|
|
321
|
-
},
|
|
322
|
-
"forbidden" => ["mode"]
|
|
323
|
-
}, {
|
|
324
|
-
"when" => {
|
|
325
|
-
"model" => "kling-v2.1-master-text-to-video"
|
|
326
|
-
},
|
|
327
|
-
"forbidden" => ["mode"]
|
|
328
|
-
}, {
|
|
329
390
|
"when" => {
|
|
330
391
|
"model" => "kling-v2.5-turbo-text-to-video-pro"
|
|
331
392
|
},
|
|
@@ -335,11 +396,16 @@ module RunApi
|
|
|
335
396
|
"model" => "kling-v2.6"
|
|
336
397
|
},
|
|
337
398
|
"forbidden" => ["output_resolution", "negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
399
|
+
}, {
|
|
400
|
+
"when" => {
|
|
401
|
+
"model" => "kling-v3-omni"
|
|
402
|
+
},
|
|
403
|
+
"forbidden" => ["negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
338
404
|
}, {
|
|
339
405
|
"when" => {
|
|
340
406
|
"model" => "kling-v3-turbo-text-to-video"
|
|
341
407
|
},
|
|
342
|
-
"forbidden" => ["
|
|
408
|
+
"forbidden" => ["enable_sound", "negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
343
409
|
}]
|
|
344
410
|
}
|
|
345
411
|
}.freeze
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RunApi
|
|
4
|
+
module Kling
|
|
5
|
+
module Resources
|
|
6
|
+
# Continue a completed Kling V2.5 Turbo video task.
|
|
7
|
+
class ExtendVideo
|
|
8
|
+
include RunApi::Core::ResourceHelpers
|
|
9
|
+
|
|
10
|
+
ENDPOINT = "/api/v1/kling/extend_video"
|
|
11
|
+
|
|
12
|
+
def initialize(http)
|
|
13
|
+
@http = http
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run(options: nil, **params)
|
|
17
|
+
task = create(options: options, **params)
|
|
18
|
+
poll_until_complete { get(task.id, options: options) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create(options: nil, **params)
|
|
22
|
+
params = compact_params(params)
|
|
23
|
+
validate_contract!(CONTRACT["extend-video"], params)
|
|
24
|
+
request(:post, ENDPOINT, body: params, options: options)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get(id, options: nil)
|
|
28
|
+
request(:get, "#{ENDPOINT}/#{id}", options: options)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -13,6 +13,7 @@ module RunApi
|
|
|
13
13
|
RESPONSE_CLASS = Types::ImageToVideoResponse
|
|
14
14
|
COMPLETED_RESPONSE_CLASS = Types::CompletedImageToVideoResponse
|
|
15
15
|
V26_MODEL = "kling-v2.6"
|
|
16
|
+
V3_OMNI_MODEL = "kling-v3-omni"
|
|
16
17
|
V3_TURBO_MODEL = "kling-v3-turbo-image-to-video"
|
|
17
18
|
V3_TURBO_UNSUPPORTED_FIELDS = %i[
|
|
18
19
|
aspect_ratio
|
|
@@ -58,12 +59,16 @@ module RunApi
|
|
|
58
59
|
reject_unsupported_v3_turbo_fields!(params)
|
|
59
60
|
validate_contract!(CONTRACT["image-to-video"], params)
|
|
60
61
|
|
|
61
|
-
# Bespoke
|
|
62
|
-
# (model-gating, not expressible as a contract enum/required rule).
|
|
62
|
+
# Bespoke last-frame rules that the generated contract cannot express.
|
|
63
63
|
model = param(params, :model)
|
|
64
64
|
last_frame_image_url = param(params, :last_frame_image_url)
|
|
65
65
|
if model == V26_MODEL
|
|
66
66
|
validate_v26_params!(params, last_frame_image_url)
|
|
67
|
+
elsif last_frame_image_url && model == V3_OMNI_MODEL
|
|
68
|
+
duration_seconds = param(params, :duration_seconds) || 5
|
|
69
|
+
return if duration_seconds.to_i == 5
|
|
70
|
+
|
|
71
|
+
raise Core::ValidationError, "last_frame_image_url requires duration_seconds 5 for #{V3_OMNI_MODEL}"
|
|
67
72
|
elsif last_frame_image_url && !%w[kling-v2.5-turbo-image-to-video-pro kling-v2.1-pro].include?(model)
|
|
68
73
|
raise Core::ValidationError, "last_frame_image_url is only supported by kling-v2.5-turbo-image-to-video-pro and kling-v2.1-pro"
|
|
69
74
|
end
|
data/lib/runapi/kling.rb
CHANGED
|
@@ -7,6 +7,7 @@ require_relative "kling/resources/text_to_video"
|
|
|
7
7
|
require_relative "kling/resources/ai_avatar"
|
|
8
8
|
require_relative "kling/resources/image_to_video"
|
|
9
9
|
require_relative "kling/resources/motion_control"
|
|
10
|
+
require_relative "kling/resources/extend_video"
|
|
10
11
|
require_relative "kling/client"
|
|
11
12
|
|
|
12
13
|
module RunApi
|
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.
|
|
4
|
+
version: 0.2.11
|
|
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.15
|
|
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.15
|
|
26
26
|
description: The Kling Ruby SDK is the language-specific package for Kling on RunAPI.
|
|
27
27
|
Use this package for video generation, animation, and video editing workflows when
|
|
28
28
|
your application needs request bodies, task status lookup, and consistent RunAPI
|
|
@@ -41,6 +41,7 @@ files:
|
|
|
41
41
|
- lib/runapi/kling/client.rb
|
|
42
42
|
- lib/runapi/kling/contract_gen.rb
|
|
43
43
|
- lib/runapi/kling/resources/ai_avatar.rb
|
|
44
|
+
- lib/runapi/kling/resources/extend_video.rb
|
|
44
45
|
- lib/runapi/kling/resources/image_to_video.rb
|
|
45
46
|
- lib/runapi/kling/resources/motion_control.rb
|
|
46
47
|
- lib/runapi/kling/resources/text_to_video.rb
|
|
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
70
|
- !ruby/object:Gem::Version
|
|
70
71
|
version: '0'
|
|
71
72
|
requirements: []
|
|
72
|
-
rubygems_version: 4.0.
|
|
73
|
+
rubygems_version: 4.0.17
|
|
73
74
|
specification_version: 4
|
|
74
75
|
summary: Kling API Ruby SDK for RunAPI
|
|
75
76
|
test_files: []
|