@runapi.ai/kling 0.3.4 → 0.4.0
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.
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +56 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskResponse, AsyncTaskStatus,
|
|
1
|
+
import { TaskResponse, AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
4
|
declare const modelValues: {
|
|
@@ -298,7 +298,7 @@ interface AsyncTaskResponse extends TaskResponse {
|
|
|
298
298
|
id: string;
|
|
299
299
|
status: AsyncTaskStatus;
|
|
300
300
|
}
|
|
301
|
-
interface TaskCreateResponse
|
|
301
|
+
interface TaskCreateResponse {
|
|
302
302
|
id: string;
|
|
303
303
|
}
|
|
304
304
|
interface VideoMetadata {
|
|
@@ -345,10 +345,10 @@ interface MotionControlCommonParams {
|
|
|
345
345
|
prompt?: string;
|
|
346
346
|
callback_url?: string;
|
|
347
347
|
}
|
|
348
|
-
/** Kling 3.0 motion transfer with optional orientation and background controls. */
|
|
348
|
+
/** Kling 3.0 motion transfer with explicit resolution and optional orientation and background controls. */
|
|
349
349
|
interface Kling3MotionControlParams extends MotionControlCommonParams {
|
|
350
350
|
model: (typeof modelValues.motionControl.KLING_3_0);
|
|
351
|
-
output_resolution
|
|
351
|
+
output_resolution: '720p' | '1080p';
|
|
352
352
|
/** Whether the character faces the direction from the video or the image. */
|
|
353
353
|
character_orientation?: 'video' | 'image';
|
|
354
354
|
/** Whether the background comes from the video or the image. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TaskResponse, AsyncTaskStatus,
|
|
1
|
+
import { TaskResponse, AsyncTaskStatus, HttpClient, RequestOptions, PollingOptions, BaseClient, ClientOptions } from '@runapi.ai/core';
|
|
2
2
|
export { AuthenticationError, InsufficientCreditsError, NetworkError, NotFoundError, RateLimitError, RunApiError, ServiceUnavailableError, TaskFailedError, TaskTimeoutError, TimeoutError, ValidationError } from '@runapi.ai/core';
|
|
3
3
|
|
|
4
4
|
declare const modelValues: {
|
|
@@ -298,7 +298,7 @@ interface AsyncTaskResponse extends TaskResponse {
|
|
|
298
298
|
id: string;
|
|
299
299
|
status: AsyncTaskStatus;
|
|
300
300
|
}
|
|
301
|
-
interface TaskCreateResponse
|
|
301
|
+
interface TaskCreateResponse {
|
|
302
302
|
id: string;
|
|
303
303
|
}
|
|
304
304
|
interface VideoMetadata {
|
|
@@ -345,10 +345,10 @@ interface MotionControlCommonParams {
|
|
|
345
345
|
prompt?: string;
|
|
346
346
|
callback_url?: string;
|
|
347
347
|
}
|
|
348
|
-
/** Kling 3.0 motion transfer with optional orientation and background controls. */
|
|
348
|
+
/** Kling 3.0 motion transfer with explicit resolution and optional orientation and background controls. */
|
|
349
349
|
interface Kling3MotionControlParams extends MotionControlCommonParams {
|
|
350
350
|
model: (typeof modelValues.motionControl.KLING_3_0);
|
|
351
|
-
output_resolution
|
|
351
|
+
output_resolution: '720p' | '1080p';
|
|
352
352
|
/** Whether the character faces the direction from the video or the image. */
|
|
353
353
|
character_orientation?: 'video' | 'image';
|
|
354
354
|
/** Whether the background comes from the video or the image. */
|
package/dist/index.js
CHANGED
|
@@ -813,6 +813,17 @@ var contract = {
|
|
|
813
813
|
"preserve_reference_video_audio"
|
|
814
814
|
]
|
|
815
815
|
},
|
|
816
|
+
{
|
|
817
|
+
"enum": {
|
|
818
|
+
"enable_sound": [
|
|
819
|
+
false
|
|
820
|
+
]
|
|
821
|
+
},
|
|
822
|
+
"when": {
|
|
823
|
+
"mode": "std",
|
|
824
|
+
"model": "kling-v2.6"
|
|
825
|
+
}
|
|
826
|
+
},
|
|
816
827
|
{
|
|
817
828
|
"when": {
|
|
818
829
|
"model": "kling-v2.6"
|
|
@@ -827,6 +838,19 @@ var contract = {
|
|
|
827
838
|
"preserve_reference_video_audio"
|
|
828
839
|
]
|
|
829
840
|
},
|
|
841
|
+
{
|
|
842
|
+
"enum": {
|
|
843
|
+
"enable_sound": [
|
|
844
|
+
false
|
|
845
|
+
]
|
|
846
|
+
},
|
|
847
|
+
"when": {
|
|
848
|
+
"mode": {
|
|
849
|
+
"present": false
|
|
850
|
+
},
|
|
851
|
+
"model": "kling-v2.6"
|
|
852
|
+
}
|
|
853
|
+
},
|
|
830
854
|
{
|
|
831
855
|
"when": {
|
|
832
856
|
"model": "kling-v3-omni"
|
|
@@ -884,7 +908,8 @@ var contract = {
|
|
|
884
908
|
"enum": [
|
|
885
909
|
"720p",
|
|
886
910
|
"1080p"
|
|
887
|
-
]
|
|
911
|
+
],
|
|
912
|
+
"required": true
|
|
888
913
|
},
|
|
889
914
|
"reference_video_url": {
|
|
890
915
|
"required": true
|
|
@@ -1297,6 +1322,30 @@ var contract = {
|
|
|
1297
1322
|
"preserve_reference_video_audio"
|
|
1298
1323
|
]
|
|
1299
1324
|
},
|
|
1325
|
+
{
|
|
1326
|
+
"enum": {
|
|
1327
|
+
"enable_sound": [
|
|
1328
|
+
false
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
"when": {
|
|
1332
|
+
"mode": "std",
|
|
1333
|
+
"model": "kling-v2.6"
|
|
1334
|
+
}
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
"enum": {
|
|
1338
|
+
"enable_sound": [
|
|
1339
|
+
false
|
|
1340
|
+
]
|
|
1341
|
+
},
|
|
1342
|
+
"when": {
|
|
1343
|
+
"mode": {
|
|
1344
|
+
"present": false
|
|
1345
|
+
},
|
|
1346
|
+
"model": "kling-v2.6"
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1300
1349
|
{
|
|
1301
1350
|
"when": {
|
|
1302
1351
|
"model": "kling-v3-omni"
|
|
@@ -1550,7 +1599,6 @@ function parseIpv6Half(value) {
|
|
|
1550
1599
|
|
|
1551
1600
|
// src/resources/text-to-video.ts
|
|
1552
1601
|
var ENDPOINT = "/api/v1/kling/text_to_video";
|
|
1553
|
-
var V26_MODEL = "kling-v2.6";
|
|
1554
1602
|
var V3_TURBO_MODEL = "kling-v3-turbo-text-to-video";
|
|
1555
1603
|
var V3_TURBO_UNSUPPORTED_FIELDS = [
|
|
1556
1604
|
"enable_sound",
|
|
@@ -1591,7 +1639,6 @@ var TextToVideo = class {
|
|
|
1591
1639
|
const body = (0, import_core2.compactParams)(params);
|
|
1592
1640
|
rejectUnsupportedV3TurboFields(body);
|
|
1593
1641
|
(0, import_core2.validateParams)(contract["text-to-video"], body);
|
|
1594
|
-
validateV26Params(body);
|
|
1595
1642
|
validateKlingO1References(body);
|
|
1596
1643
|
return this.http.request("POST", ENDPOINT, {
|
|
1597
1644
|
body,
|
|
@@ -1610,12 +1657,6 @@ var TextToVideo = class {
|
|
|
1610
1657
|
});
|
|
1611
1658
|
}
|
|
1612
1659
|
};
|
|
1613
|
-
function validateV26Params(body) {
|
|
1614
|
-
if (body.model !== V26_MODEL) return;
|
|
1615
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1616
|
-
throw new import_core2.ValidationError(`enable_sound requires mode pro for ${V26_MODEL}`);
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
1660
|
function rejectUnsupportedV3TurboFields(body) {
|
|
1620
1661
|
if (body.model !== V3_TURBO_MODEL) return;
|
|
1621
1662
|
const field = V3_TURBO_UNSUPPORTED_FIELDS.find((candidate) => fieldPresent(body, candidate));
|
|
@@ -1643,7 +1684,7 @@ function presentValue(value) {
|
|
|
1643
1684
|
var import_core3 = require("@runapi.ai/core");
|
|
1644
1685
|
var import_internal2 = require("@runapi.ai/core/internal");
|
|
1645
1686
|
var ENDPOINT2 = "/api/v1/kling/image_to_video";
|
|
1646
|
-
var
|
|
1687
|
+
var V26_MODEL = "kling-v2.6";
|
|
1647
1688
|
var V3_OMNI_MODEL = "kling-v3-omni";
|
|
1648
1689
|
var V3_TURBO_MODEL2 = "kling-v3-turbo-image-to-video";
|
|
1649
1690
|
var V3_TURBO_UNSUPPORTED_FIELDS2 = [
|
|
@@ -1681,7 +1722,7 @@ var ImageToVideo = class {
|
|
|
1681
1722
|
const body = (0, import_core3.compactParams)(params);
|
|
1682
1723
|
rejectUnsupportedV3TurboFields2(body);
|
|
1683
1724
|
(0, import_core3.validateParams)(contract["image-to-video"], body);
|
|
1684
|
-
|
|
1725
|
+
validateV26Params(body);
|
|
1685
1726
|
validateV3OmniFields(body);
|
|
1686
1727
|
validateKlingO1References(body);
|
|
1687
1728
|
return this.http.request("POST", ENDPOINT2, {
|
|
@@ -1701,17 +1742,14 @@ var ImageToVideo = class {
|
|
|
1701
1742
|
});
|
|
1702
1743
|
}
|
|
1703
1744
|
};
|
|
1704
|
-
function
|
|
1705
|
-
if (body.model !==
|
|
1706
|
-
if (body.enable_sound === true && body.mode !== "pro") {
|
|
1707
|
-
throw new import_core3.ValidationError(`enable_sound requires mode pro for ${V26_MODEL2}`);
|
|
1708
|
-
}
|
|
1745
|
+
function validateV26Params(body) {
|
|
1746
|
+
if (body.model !== V26_MODEL) return;
|
|
1709
1747
|
if (!fieldPresent2(body, "last_frame_image_url")) return;
|
|
1710
1748
|
if (body.mode !== "pro") {
|
|
1711
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires mode pro for ${
|
|
1749
|
+
throw new import_core3.ValidationError(`last_frame_image_url requires mode pro for ${V26_MODEL}`);
|
|
1712
1750
|
}
|
|
1713
1751
|
if (body.duration_seconds !== void 0 && body.duration_seconds !== 5) {
|
|
1714
|
-
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${
|
|
1752
|
+
throw new import_core3.ValidationError(`last_frame_image_url requires duration_seconds 5 for ${V26_MODEL}`);
|
|
1715
1753
|
}
|
|
1716
1754
|
}
|
|
1717
1755
|
function validateV3OmniFields(body) {
|