runapi-kling 0.2.9 → 0.2.10
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: e320ba4bacde45051ec892890b4538a8fe2c415d86facc8c3c950bfeb43bd94e
|
|
4
|
+
data.tar.gz: 4ae9148e0a4b579a47f65c6b02ba40d3cc1c95bec9254fd423bf45b442ea99f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1bc8ee1eb14d11292751fa2c24318335bb07b4a7bfa02b82454c30f9da7889281bf29067d5fc34d7d29c337d12fbadf934924c9a61c7df34b64bfe6ad937939
|
|
7
|
+
data.tar.gz: e64c06c27bebb03e97c45801a268ad752ab63a3b22cd24e85b7d3baf9d8fc4f7b16cb0547336c820c7a5c560a326fbf49614bf6806e6e9d3e9ec4561e486265d
|
|
@@ -65,7 +65,7 @@ module RunApi
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"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-v3-turbo-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"],
|
|
69
69
|
"fields_by_model" => {
|
|
70
70
|
"kling-v2.1-master-image-to-video" => {
|
|
71
71
|
"duration_seconds" => {
|
|
@@ -127,6 +127,30 @@ module RunApi
|
|
|
127
127
|
"required" => true
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
|
+
"kling-v2.6" => {
|
|
131
|
+
"aspect_ratio" => {
|
|
132
|
+
"enum" => ["16:9", "9:16", "1:1"]
|
|
133
|
+
},
|
|
134
|
+
"duration_seconds" => {
|
|
135
|
+
"enum" => [5, 10],
|
|
136
|
+
"type" => "integer"
|
|
137
|
+
},
|
|
138
|
+
"first_frame_image_url" => {
|
|
139
|
+
"required" => true
|
|
140
|
+
},
|
|
141
|
+
"mode" => {
|
|
142
|
+
"enum" => ["std", "pro"]
|
|
143
|
+
},
|
|
144
|
+
"model" => {
|
|
145
|
+
"required" => true
|
|
146
|
+
},
|
|
147
|
+
"prompt" => {
|
|
148
|
+
"required" => true,
|
|
149
|
+
"min" => 1,
|
|
150
|
+
"max" => 2500,
|
|
151
|
+
"length" => true
|
|
152
|
+
}
|
|
153
|
+
},
|
|
130
154
|
"kling-v3-turbo-image-to-video" => {
|
|
131
155
|
"duration_seconds" => {
|
|
132
156
|
"enum" => [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
|
@@ -153,27 +177,32 @@ module RunApi
|
|
|
153
177
|
"when" => {
|
|
154
178
|
"model" => "kling-v2.1-master-image-to-video"
|
|
155
179
|
},
|
|
156
|
-
"forbidden" => ["output_resolution"]
|
|
180
|
+
"forbidden" => ["output_resolution", "mode", "enable_sound"]
|
|
157
181
|
}, {
|
|
158
182
|
"when" => {
|
|
159
183
|
"model" => "kling-v2.1-pro"
|
|
160
184
|
},
|
|
161
|
-
"forbidden" => ["output_resolution"]
|
|
185
|
+
"forbidden" => ["output_resolution", "mode", "enable_sound"]
|
|
162
186
|
}, {
|
|
163
187
|
"when" => {
|
|
164
188
|
"model" => "kling-v2.1-standard"
|
|
165
189
|
},
|
|
166
|
-
"forbidden" => ["output_resolution"]
|
|
190
|
+
"forbidden" => ["output_resolution", "mode", "enable_sound"]
|
|
167
191
|
}, {
|
|
168
192
|
"when" => {
|
|
169
193
|
"model" => "kling-v2.5-turbo-image-to-video-pro"
|
|
170
194
|
},
|
|
171
|
-
"forbidden" => ["output_resolution"]
|
|
195
|
+
"forbidden" => ["output_resolution", "mode", "enable_sound"]
|
|
196
|
+
}, {
|
|
197
|
+
"when" => {
|
|
198
|
+
"model" => "kling-v2.6"
|
|
199
|
+
},
|
|
200
|
+
"forbidden" => ["output_resolution", "negative_prompt", "cfg_scale"]
|
|
172
201
|
}, {
|
|
173
202
|
"when" => {
|
|
174
203
|
"model" => "kling-v3-turbo-image-to-video"
|
|
175
204
|
},
|
|
176
|
-
"forbidden" => ["aspect_ratio", "negative_prompt", "cfg_scale", "last_frame_image_url"]
|
|
205
|
+
"forbidden" => ["mode", "enable_sound", "aspect_ratio", "negative_prompt", "cfg_scale", "last_frame_image_url"]
|
|
177
206
|
}]
|
|
178
207
|
},
|
|
179
208
|
"motion-control" => {
|
|
@@ -202,7 +231,7 @@ module RunApi
|
|
|
202
231
|
}
|
|
203
232
|
},
|
|
204
233
|
"text-to-video" => {
|
|
205
|
-
"models" => ["kling-3.0", "kling-v2.1-master-text-to-video", "kling-v2.5-turbo-text-to-video-pro", "kling-v3-turbo-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"],
|
|
206
235
|
"fields_by_model" => {
|
|
207
236
|
"kling-3.0" => {
|
|
208
237
|
"aspect_ratio" => {
|
|
@@ -243,6 +272,27 @@ module RunApi
|
|
|
243
272
|
"required" => true
|
|
244
273
|
}
|
|
245
274
|
},
|
|
275
|
+
"kling-v2.6" => {
|
|
276
|
+
"aspect_ratio" => {
|
|
277
|
+
"enum" => ["16:9", "9:16", "1:1"]
|
|
278
|
+
},
|
|
279
|
+
"duration_seconds" => {
|
|
280
|
+
"enum" => [5, 10],
|
|
281
|
+
"type" => "integer"
|
|
282
|
+
},
|
|
283
|
+
"mode" => {
|
|
284
|
+
"enum" => ["std", "pro"]
|
|
285
|
+
},
|
|
286
|
+
"model" => {
|
|
287
|
+
"required" => true
|
|
288
|
+
},
|
|
289
|
+
"prompt" => {
|
|
290
|
+
"required" => true,
|
|
291
|
+
"min" => 1,
|
|
292
|
+
"max" => 2500,
|
|
293
|
+
"length" => true
|
|
294
|
+
}
|
|
295
|
+
},
|
|
246
296
|
"kling-v3-turbo-text-to-video" => {
|
|
247
297
|
"aspect_ratio" => {
|
|
248
298
|
"enum" => ["16:9", "9:16", "1:1"]
|
|
@@ -266,10 +316,30 @@ module RunApi
|
|
|
266
316
|
}
|
|
267
317
|
},
|
|
268
318
|
"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
|
+
"when" => {
|
|
330
|
+
"model" => "kling-v2.5-turbo-text-to-video-pro"
|
|
331
|
+
},
|
|
332
|
+
"forbidden" => ["mode"]
|
|
333
|
+
}, {
|
|
334
|
+
"when" => {
|
|
335
|
+
"model" => "kling-v2.6"
|
|
336
|
+
},
|
|
337
|
+
"forbidden" => ["output_resolution", "negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
338
|
+
}, {
|
|
269
339
|
"when" => {
|
|
270
340
|
"model" => "kling-v3-turbo-text-to-video"
|
|
271
341
|
},
|
|
272
|
-
"forbidden" => ["enable_sound", "negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
342
|
+
"forbidden" => ["mode", "enable_sound", "negative_prompt", "cfg_scale", "multi_shots", "multi_prompt", "first_frame_image_url", "last_frame_image_url", "kling_elements"]
|
|
273
343
|
}]
|
|
274
344
|
}
|
|
275
345
|
}.freeze
|
|
@@ -12,6 +12,7 @@ module RunApi
|
|
|
12
12
|
|
|
13
13
|
RESPONSE_CLASS = Types::ImageToVideoResponse
|
|
14
14
|
COMPLETED_RESPONSE_CLASS = Types::CompletedImageToVideoResponse
|
|
15
|
+
V26_MODEL = "kling-v2.6"
|
|
15
16
|
V3_TURBO_MODEL = "kling-v3-turbo-image-to-video"
|
|
16
17
|
V3_TURBO_UNSUPPORTED_FIELDS = %i[
|
|
17
18
|
aspect_ratio
|
|
@@ -61,11 +62,28 @@ module RunApi
|
|
|
61
62
|
# (model-gating, not expressible as a contract enum/required rule).
|
|
62
63
|
model = param(params, :model)
|
|
63
64
|
last_frame_image_url = param(params, :last_frame_image_url)
|
|
64
|
-
if
|
|
65
|
+
if model == V26_MODEL
|
|
66
|
+
validate_v26_params!(params, last_frame_image_url)
|
|
67
|
+
elsif last_frame_image_url && !%w[kling-v2.5-turbo-image-to-video-pro kling-v2.1-pro].include?(model)
|
|
65
68
|
raise Core::ValidationError, "last_frame_image_url is only supported by kling-v2.5-turbo-image-to-video-pro and kling-v2.1-pro"
|
|
66
69
|
end
|
|
67
70
|
end
|
|
68
71
|
|
|
72
|
+
def validate_v26_params!(params, last_frame_image_url)
|
|
73
|
+
mode = param(params, :mode) || "std"
|
|
74
|
+
if param(params, :enable_sound) == true && mode != "pro"
|
|
75
|
+
raise Core::ValidationError, "enable_sound requires mode pro for #{V26_MODEL}"
|
|
76
|
+
end
|
|
77
|
+
return unless last_frame_image_url
|
|
78
|
+
|
|
79
|
+
raise Core::ValidationError, "last_frame_image_url requires mode pro for #{V26_MODEL}" unless mode == "pro"
|
|
80
|
+
|
|
81
|
+
duration_seconds = param(params, :duration_seconds) || 5
|
|
82
|
+
return if duration_seconds.to_i == 5
|
|
83
|
+
|
|
84
|
+
raise Core::ValidationError, "last_frame_image_url requires duration_seconds 5 for #{V26_MODEL}"
|
|
85
|
+
end
|
|
86
|
+
|
|
69
87
|
def reject_unsupported_v3_turbo_fields!(params)
|
|
70
88
|
return unless param(params, :model) == V3_TURBO_MODEL
|
|
71
89
|
|
|
@@ -12,6 +12,7 @@ module RunApi
|
|
|
12
12
|
|
|
13
13
|
RESPONSE_CLASS = Types::TextToVideoResponse
|
|
14
14
|
COMPLETED_RESPONSE_CLASS = Types::CompletedTextToVideoResponse
|
|
15
|
+
V26_MODEL = "kling-v2.6"
|
|
15
16
|
V3_TURBO_MODEL = "kling-v3-turbo-text-to-video"
|
|
16
17
|
V3_TURBO_UNSUPPORTED_FIELDS = %i[
|
|
17
18
|
enable_sound
|
|
@@ -60,6 +61,7 @@ module RunApi
|
|
|
60
61
|
def validate_params!(params)
|
|
61
62
|
reject_unsupported_v3_turbo_fields!(params)
|
|
62
63
|
validate_contract!(CONTRACT["text-to-video"], params)
|
|
64
|
+
validate_v26_params!(params)
|
|
63
65
|
|
|
64
66
|
# Bespoke cross-field rules the contract cannot express.
|
|
65
67
|
multi_shots = param(params, :multi_shots) == true
|
|
@@ -75,6 +77,13 @@ module RunApi
|
|
|
75
77
|
end
|
|
76
78
|
end
|
|
77
79
|
|
|
80
|
+
def validate_v26_params!(params)
|
|
81
|
+
return unless param(params, :model) == V26_MODEL
|
|
82
|
+
return unless param(params, :enable_sound) == true && param(params, :mode) != "pro"
|
|
83
|
+
|
|
84
|
+
raise Core::ValidationError, "enable_sound requires mode pro for #{V26_MODEL}"
|
|
85
|
+
end
|
|
86
|
+
|
|
78
87
|
def reject_unsupported_v3_turbo_fields!(params)
|
|
79
88
|
return unless param(params, :model) == V3_TURBO_MODEL
|
|
80
89
|
|
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.10
|
|
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.14
|
|
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.14
|
|
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
|