@ai-sdk/klingai 4.0.0-beta.3 → 4.0.0-beta.30
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/CHANGELOG.md +214 -0
- package/README.md +2 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +134 -143
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/src/klingai-provider.ts +7 -7
- package/src/klingai-video-model.ts +13 -13
- package/dist/index.d.mts +0 -211
- package/dist/index.mjs +0 -630
- package/dist/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,48 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
createKlingAI: () => createKlingAI,
|
|
24
|
-
klingai: () => klingai
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
1
|
// src/klingai-provider.ts
|
|
29
|
-
|
|
30
|
-
|
|
2
|
+
import {
|
|
3
|
+
NoSuchModelError as NoSuchModelError2
|
|
4
|
+
} from "@ai-sdk/provider";
|
|
5
|
+
import {
|
|
6
|
+
withoutTrailingSlash,
|
|
7
|
+
withUserAgentSuffix
|
|
8
|
+
} from "@ai-sdk/provider-utils";
|
|
31
9
|
|
|
32
10
|
// src/klingai-auth.ts
|
|
33
|
-
|
|
11
|
+
import { loadSetting } from "@ai-sdk/provider-utils";
|
|
34
12
|
var base64url = (str) => btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
35
13
|
async function generateKlingAIAuthToken({
|
|
36
14
|
accessKey,
|
|
37
15
|
secretKey
|
|
38
16
|
}) {
|
|
39
|
-
const ak =
|
|
17
|
+
const ak = loadSetting({
|
|
40
18
|
settingValue: accessKey,
|
|
41
19
|
settingName: "accessKey",
|
|
42
20
|
environmentVariableName: "KLINGAI_ACCESS_KEY",
|
|
43
21
|
description: "KlingAI access key"
|
|
44
22
|
});
|
|
45
|
-
const sk =
|
|
23
|
+
const sk = loadSetting({
|
|
46
24
|
settingValue: secretKey,
|
|
47
25
|
settingName: "secretKey",
|
|
48
26
|
environmentVariableName: "KLINGAI_SECRET_KEY",
|
|
@@ -81,18 +59,32 @@ async function generateKlingAIAuthToken({
|
|
|
81
59
|
}
|
|
82
60
|
|
|
83
61
|
// src/klingai-video-model.ts
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
62
|
+
import {
|
|
63
|
+
AISDKError,
|
|
64
|
+
NoSuchModelError
|
|
65
|
+
} from "@ai-sdk/provider";
|
|
66
|
+
import {
|
|
67
|
+
combineHeaders,
|
|
68
|
+
convertUint8ArrayToBase64,
|
|
69
|
+
createJsonResponseHandler,
|
|
70
|
+
delay,
|
|
71
|
+
getFromApi,
|
|
72
|
+
lazySchema,
|
|
73
|
+
parseProviderOptions,
|
|
74
|
+
postJsonToApi,
|
|
75
|
+
resolve,
|
|
76
|
+
zodSchema
|
|
77
|
+
} from "@ai-sdk/provider-utils";
|
|
78
|
+
import { z as z2 } from "zod/v4";
|
|
87
79
|
|
|
88
80
|
// src/klingai-error.ts
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var klingaiErrorDataSchema =
|
|
92
|
-
code:
|
|
93
|
-
message:
|
|
81
|
+
import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
|
|
82
|
+
import { z } from "zod/v4";
|
|
83
|
+
var klingaiErrorDataSchema = z.object({
|
|
84
|
+
code: z.number(),
|
|
85
|
+
message: z.string()
|
|
94
86
|
});
|
|
95
|
-
var klingaiFailedResponseHandler =
|
|
87
|
+
var klingaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
96
88
|
errorSchema: klingaiErrorDataSchema,
|
|
97
89
|
errorToMessage: (data) => data.message
|
|
98
90
|
});
|
|
@@ -102,7 +94,7 @@ function detectMode(modelId) {
|
|
|
102
94
|
if (modelId.endsWith("-t2v")) return "t2v";
|
|
103
95
|
if (modelId.endsWith("-i2v")) return "i2v";
|
|
104
96
|
if (modelId.endsWith("-motion-control")) return "motion-control";
|
|
105
|
-
throw new
|
|
97
|
+
throw new NoSuchModelError({ modelId, modelType: "videoModel" });
|
|
106
98
|
}
|
|
107
99
|
var modeEndpointMap = {
|
|
108
100
|
t2v: "/v1/videos/text2video",
|
|
@@ -114,69 +106,69 @@ function getApiModelName(modelId, mode) {
|
|
|
114
106
|
const baseName = modelId.slice(0, -suffix.length);
|
|
115
107
|
return baseName.replace(/\.0$/, "").replace(/\./g, "-");
|
|
116
108
|
}
|
|
117
|
-
var klingaiVideoModelOptionsSchema =
|
|
118
|
-
() =>
|
|
119
|
-
|
|
120
|
-
mode:
|
|
121
|
-
pollIntervalMs:
|
|
122
|
-
pollTimeoutMs:
|
|
109
|
+
var klingaiVideoModelOptionsSchema = lazySchema(
|
|
110
|
+
() => zodSchema(
|
|
111
|
+
z2.object({
|
|
112
|
+
mode: z2.enum(["std", "pro"]).nullish(),
|
|
113
|
+
pollIntervalMs: z2.number().positive().nullish(),
|
|
114
|
+
pollTimeoutMs: z2.number().positive().nullish(),
|
|
123
115
|
// T2V and I2V
|
|
124
|
-
negativePrompt:
|
|
125
|
-
sound:
|
|
126
|
-
cfgScale:
|
|
127
|
-
cameraControl:
|
|
128
|
-
type:
|
|
116
|
+
negativePrompt: z2.string().nullish(),
|
|
117
|
+
sound: z2.enum(["on", "off"]).nullish(),
|
|
118
|
+
cfgScale: z2.number().nullish(),
|
|
119
|
+
cameraControl: z2.object({
|
|
120
|
+
type: z2.enum([
|
|
129
121
|
"simple",
|
|
130
122
|
"down_back",
|
|
131
123
|
"forward_up",
|
|
132
124
|
"right_turn_forward",
|
|
133
125
|
"left_turn_forward"
|
|
134
126
|
]),
|
|
135
|
-
config:
|
|
136
|
-
horizontal:
|
|
137
|
-
vertical:
|
|
138
|
-
pan:
|
|
139
|
-
tilt:
|
|
140
|
-
roll:
|
|
141
|
-
zoom:
|
|
127
|
+
config: z2.object({
|
|
128
|
+
horizontal: z2.number().nullish(),
|
|
129
|
+
vertical: z2.number().nullish(),
|
|
130
|
+
pan: z2.number().nullish(),
|
|
131
|
+
tilt: z2.number().nullish(),
|
|
132
|
+
roll: z2.number().nullish(),
|
|
133
|
+
zoom: z2.number().nullish()
|
|
142
134
|
}).nullish()
|
|
143
135
|
}).nullish(),
|
|
144
136
|
// v3.0 multi-shot
|
|
145
|
-
multiShot:
|
|
146
|
-
shotType:
|
|
147
|
-
multiPrompt:
|
|
148
|
-
|
|
149
|
-
index:
|
|
150
|
-
prompt:
|
|
151
|
-
duration:
|
|
137
|
+
multiShot: z2.boolean().nullish(),
|
|
138
|
+
shotType: z2.enum(["customize", "intelligence"]).nullish(),
|
|
139
|
+
multiPrompt: z2.array(
|
|
140
|
+
z2.object({
|
|
141
|
+
index: z2.number(),
|
|
142
|
+
prompt: z2.string(),
|
|
143
|
+
duration: z2.string()
|
|
152
144
|
})
|
|
153
145
|
).nullish(),
|
|
154
146
|
// v3.0 element control (I2V)
|
|
155
|
-
elementList:
|
|
156
|
-
|
|
157
|
-
element_id:
|
|
147
|
+
elementList: z2.array(
|
|
148
|
+
z2.object({
|
|
149
|
+
element_id: z2.number()
|
|
158
150
|
})
|
|
159
151
|
).nullish(),
|
|
160
152
|
// v3.0 voice control
|
|
161
|
-
voiceList:
|
|
162
|
-
|
|
163
|
-
voice_id:
|
|
153
|
+
voiceList: z2.array(
|
|
154
|
+
z2.object({
|
|
155
|
+
voice_id: z2.string()
|
|
164
156
|
})
|
|
165
157
|
).nullish(),
|
|
166
158
|
// I2V-specific
|
|
167
|
-
imageTail:
|
|
168
|
-
staticMask:
|
|
169
|
-
dynamicMasks:
|
|
170
|
-
|
|
171
|
-
mask:
|
|
172
|
-
trajectories:
|
|
159
|
+
imageTail: z2.string().nullish(),
|
|
160
|
+
staticMask: z2.string().nullish(),
|
|
161
|
+
dynamicMasks: z2.array(
|
|
162
|
+
z2.object({
|
|
163
|
+
mask: z2.string(),
|
|
164
|
+
trajectories: z2.array(z2.object({ x: z2.number(), y: z2.number() }))
|
|
173
165
|
})
|
|
174
166
|
).nullish(),
|
|
175
167
|
// Motion-control-specific
|
|
176
|
-
videoUrl:
|
|
177
|
-
characterOrientation:
|
|
178
|
-
keepOriginalSound:
|
|
179
|
-
watermarkEnabled:
|
|
168
|
+
videoUrl: z2.string().nullish(),
|
|
169
|
+
characterOrientation: z2.enum(["image", "video"]).nullish(),
|
|
170
|
+
keepOriginalSound: z2.enum(["yes", "no"]).nullish(),
|
|
171
|
+
watermarkEnabled: z2.boolean().nullish()
|
|
180
172
|
}).passthrough()
|
|
181
173
|
)
|
|
182
174
|
);
|
|
@@ -205,7 +197,7 @@ var KlingAIVideoModel = class {
|
|
|
205
197
|
constructor(modelId, config) {
|
|
206
198
|
this.modelId = modelId;
|
|
207
199
|
this.config = config;
|
|
208
|
-
this.specificationVersion = "
|
|
200
|
+
this.specificationVersion = "v4";
|
|
209
201
|
this.maxVideosPerCall = 1;
|
|
210
202
|
}
|
|
211
203
|
get provider() {
|
|
@@ -216,7 +208,7 @@ var KlingAIVideoModel = class {
|
|
|
216
208
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
217
209
|
const warnings = [];
|
|
218
210
|
const mode = detectMode(this.modelId);
|
|
219
|
-
const klingaiOptions = await
|
|
211
|
+
const klingaiOptions = await parseProviderOptions({
|
|
220
212
|
provider: "klingai",
|
|
221
213
|
providerOptions: options.providerOptions,
|
|
222
214
|
schema: klingaiVideoModelOptionsSchema
|
|
@@ -258,14 +250,14 @@ var KlingAIVideoModel = class {
|
|
|
258
250
|
});
|
|
259
251
|
}
|
|
260
252
|
const endpointPath = modeEndpointMap[mode];
|
|
261
|
-
const { value: createResponse, responseHeaders: createHeaders } = await
|
|
253
|
+
const { value: createResponse, responseHeaders: createHeaders } = await postJsonToApi({
|
|
262
254
|
url: `${this.config.baseURL}${endpointPath}`,
|
|
263
|
-
headers:
|
|
264
|
-
await
|
|
255
|
+
headers: combineHeaders(
|
|
256
|
+
await resolve(this.config.headers),
|
|
265
257
|
options.headers
|
|
266
258
|
),
|
|
267
259
|
body,
|
|
268
|
-
successfulResponseHandler:
|
|
260
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
269
261
|
klingaiCreateTaskSchema
|
|
270
262
|
),
|
|
271
263
|
failedResponseHandler: klingaiFailedResponseHandler,
|
|
@@ -274,7 +266,7 @@ var KlingAIVideoModel = class {
|
|
|
274
266
|
});
|
|
275
267
|
const taskId = (_d = createResponse.data) == null ? void 0 : _d.task_id;
|
|
276
268
|
if (!taskId) {
|
|
277
|
-
throw new
|
|
269
|
+
throw new AISDKError({
|
|
278
270
|
name: "KLINGAI_VIDEO_GENERATION_ERROR",
|
|
279
271
|
message: `No task_id returned from KlingAI API. Response: ${JSON.stringify(createResponse)}`
|
|
280
272
|
});
|
|
@@ -285,20 +277,20 @@ var KlingAIVideoModel = class {
|
|
|
285
277
|
let finalResponse;
|
|
286
278
|
let responseHeaders = createHeaders;
|
|
287
279
|
while (true) {
|
|
288
|
-
await
|
|
280
|
+
await delay(pollIntervalMs, { abortSignal: options.abortSignal });
|
|
289
281
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
290
|
-
throw new
|
|
282
|
+
throw new AISDKError({
|
|
291
283
|
name: "KLINGAI_VIDEO_GENERATION_TIMEOUT",
|
|
292
284
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
293
285
|
});
|
|
294
286
|
}
|
|
295
|
-
const { value: statusResponse, responseHeaders: pollHeaders } = await
|
|
287
|
+
const { value: statusResponse, responseHeaders: pollHeaders } = await getFromApi({
|
|
296
288
|
url: `${this.config.baseURL}${endpointPath}/${taskId}`,
|
|
297
|
-
headers:
|
|
298
|
-
await
|
|
289
|
+
headers: combineHeaders(
|
|
290
|
+
await resolve(this.config.headers),
|
|
299
291
|
options.headers
|
|
300
292
|
),
|
|
301
|
-
successfulResponseHandler:
|
|
293
|
+
successfulResponseHandler: createJsonResponseHandler(
|
|
302
294
|
klingaiTaskStatusSchema
|
|
303
295
|
),
|
|
304
296
|
failedResponseHandler: klingaiFailedResponseHandler,
|
|
@@ -312,14 +304,14 @@ var KlingAIVideoModel = class {
|
|
|
312
304
|
break;
|
|
313
305
|
}
|
|
314
306
|
if (taskStatus === "failed") {
|
|
315
|
-
throw new
|
|
307
|
+
throw new AISDKError({
|
|
316
308
|
name: "KLINGAI_VIDEO_GENERATION_FAILED",
|
|
317
309
|
message: `Video generation failed: ${(_i = (_h = statusResponse.data) == null ? void 0 : _h.task_status_msg) != null ? _i : "Unknown error"}`
|
|
318
310
|
});
|
|
319
311
|
}
|
|
320
312
|
}
|
|
321
313
|
if (!((_l = (_k = (_j = finalResponse == null ? void 0 : finalResponse.data) == null ? void 0 : _j.task_result) == null ? void 0 : _k.videos) == null ? void 0 : _l.length)) {
|
|
322
|
-
throw new
|
|
314
|
+
throw new AISDKError({
|
|
323
315
|
name: "KLINGAI_VIDEO_GENERATION_ERROR",
|
|
324
316
|
message: `No videos in response. Response: ${JSON.stringify(finalResponse)}`
|
|
325
317
|
});
|
|
@@ -342,7 +334,7 @@ var KlingAIVideoModel = class {
|
|
|
342
334
|
}
|
|
343
335
|
}
|
|
344
336
|
if (videos.length === 0) {
|
|
345
|
-
throw new
|
|
337
|
+
throw new AISDKError({
|
|
346
338
|
name: "KLINGAI_VIDEO_GENERATION_ERROR",
|
|
347
339
|
message: "No valid video URLs in response"
|
|
348
340
|
});
|
|
@@ -429,7 +421,7 @@ var KlingAIVideoModel = class {
|
|
|
429
421
|
if (options.image.type === "url") {
|
|
430
422
|
body.image = options.image.url;
|
|
431
423
|
} else {
|
|
432
|
-
body.image = typeof options.image.data === "string" ? options.image.data :
|
|
424
|
+
body.image = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase64(options.image.data);
|
|
433
425
|
}
|
|
434
426
|
}
|
|
435
427
|
if ((klingaiOptions == null ? void 0 : klingaiOptions.imageTail) != null) {
|
|
@@ -489,7 +481,7 @@ var KlingAIVideoModel = class {
|
|
|
489
481
|
}
|
|
490
482
|
buildMotionControlBody(options, klingaiOptions, warnings) {
|
|
491
483
|
if (!(klingaiOptions == null ? void 0 : klingaiOptions.videoUrl) || !(klingaiOptions == null ? void 0 : klingaiOptions.characterOrientation) || !(klingaiOptions == null ? void 0 : klingaiOptions.mode)) {
|
|
492
|
-
throw new
|
|
484
|
+
throw new AISDKError({
|
|
493
485
|
name: "KLINGAI_VIDEO_MISSING_OPTIONS",
|
|
494
486
|
message: "KlingAI Motion Control requires providerOptions.klingai with videoUrl, characterOrientation, and mode."
|
|
495
487
|
});
|
|
@@ -508,7 +500,7 @@ var KlingAIVideoModel = class {
|
|
|
508
500
|
if (options.image.type === "url") {
|
|
509
501
|
body.image_url = options.image.url;
|
|
510
502
|
} else {
|
|
511
|
-
body.image_url = typeof options.image.data === "string" ? options.image.data :
|
|
503
|
+
body.image_url = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase64(options.image.data);
|
|
512
504
|
}
|
|
513
505
|
}
|
|
514
506
|
if (klingaiOptions.keepOriginalSound != null) {
|
|
@@ -546,44 +538,44 @@ var KlingAIVideoModel = class {
|
|
|
546
538
|
}
|
|
547
539
|
}
|
|
548
540
|
};
|
|
549
|
-
var klingaiCreateTaskSchema =
|
|
550
|
-
code:
|
|
551
|
-
message:
|
|
552
|
-
request_id:
|
|
553
|
-
data:
|
|
554
|
-
task_id:
|
|
555
|
-
task_status:
|
|
556
|
-
task_info:
|
|
557
|
-
external_task_id:
|
|
541
|
+
var klingaiCreateTaskSchema = z2.object({
|
|
542
|
+
code: z2.number(),
|
|
543
|
+
message: z2.string(),
|
|
544
|
+
request_id: z2.string().nullish(),
|
|
545
|
+
data: z2.object({
|
|
546
|
+
task_id: z2.string(),
|
|
547
|
+
task_status: z2.string().nullish(),
|
|
548
|
+
task_info: z2.object({
|
|
549
|
+
external_task_id: z2.string().nullish()
|
|
558
550
|
}).nullish(),
|
|
559
|
-
created_at:
|
|
560
|
-
updated_at:
|
|
551
|
+
created_at: z2.number().nullish(),
|
|
552
|
+
updated_at: z2.number().nullish()
|
|
561
553
|
}).nullish()
|
|
562
554
|
});
|
|
563
|
-
var klingaiTaskStatusSchema =
|
|
564
|
-
code:
|
|
565
|
-
message:
|
|
566
|
-
request_id:
|
|
567
|
-
data:
|
|
568
|
-
task_id:
|
|
569
|
-
task_status:
|
|
570
|
-
task_status_msg:
|
|
571
|
-
task_info:
|
|
572
|
-
external_task_id:
|
|
555
|
+
var klingaiTaskStatusSchema = z2.object({
|
|
556
|
+
code: z2.number(),
|
|
557
|
+
message: z2.string(),
|
|
558
|
+
request_id: z2.string().nullish(),
|
|
559
|
+
data: z2.object({
|
|
560
|
+
task_id: z2.string(),
|
|
561
|
+
task_status: z2.string(),
|
|
562
|
+
task_status_msg: z2.string().nullish(),
|
|
563
|
+
task_info: z2.object({
|
|
564
|
+
external_task_id: z2.string().nullish()
|
|
573
565
|
}).nullish(),
|
|
574
|
-
watermark_info:
|
|
575
|
-
enabled:
|
|
566
|
+
watermark_info: z2.object({
|
|
567
|
+
enabled: z2.boolean().nullish()
|
|
576
568
|
}).nullish(),
|
|
577
|
-
final_unit_deduction:
|
|
578
|
-
created_at:
|
|
579
|
-
updated_at:
|
|
580
|
-
task_result:
|
|
581
|
-
videos:
|
|
582
|
-
|
|
583
|
-
id:
|
|
584
|
-
url:
|
|
585
|
-
watermark_url:
|
|
586
|
-
duration:
|
|
569
|
+
final_unit_deduction: z2.string().nullish(),
|
|
570
|
+
created_at: z2.number().nullish(),
|
|
571
|
+
updated_at: z2.number().nullish(),
|
|
572
|
+
task_result: z2.object({
|
|
573
|
+
videos: z2.array(
|
|
574
|
+
z2.object({
|
|
575
|
+
id: z2.string().nullish(),
|
|
576
|
+
url: z2.string().nullish(),
|
|
577
|
+
watermark_url: z2.string().nullish(),
|
|
578
|
+
duration: z2.string().nullish()
|
|
587
579
|
})
|
|
588
580
|
).nullish()
|
|
589
581
|
}).nullish()
|
|
@@ -591,19 +583,19 @@ var klingaiTaskStatusSchema = import_v42.z.object({
|
|
|
591
583
|
});
|
|
592
584
|
|
|
593
585
|
// src/version.ts
|
|
594
|
-
var VERSION = "4.0.0-beta.
|
|
586
|
+
var VERSION = "4.0.0-beta.30";
|
|
595
587
|
|
|
596
588
|
// src/klingai-provider.ts
|
|
597
589
|
var defaultBaseURL = "https://api-singapore.klingai.com";
|
|
598
590
|
function createKlingAI(options = {}) {
|
|
599
591
|
var _a, _b;
|
|
600
|
-
const baseURL = (_b =
|
|
592
|
+
const baseURL = (_b = withoutTrailingSlash((_a = options.baseURL) != null ? _a : defaultBaseURL)) != null ? _b : defaultBaseURL;
|
|
601
593
|
const getHeaders = async () => {
|
|
602
594
|
const token = await generateKlingAIAuthToken({
|
|
603
595
|
accessKey: options.accessKey,
|
|
604
596
|
secretKey: options.secretKey
|
|
605
597
|
});
|
|
606
|
-
return
|
|
598
|
+
return withUserAgentSuffix(
|
|
607
599
|
{
|
|
608
600
|
Authorization: `Bearer ${token}`,
|
|
609
601
|
...options.headers
|
|
@@ -618,10 +610,10 @@ function createKlingAI(options = {}) {
|
|
|
618
610
|
fetch: options.fetch
|
|
619
611
|
});
|
|
620
612
|
const noSuchModel = (modelId, modelType) => {
|
|
621
|
-
throw new
|
|
613
|
+
throw new NoSuchModelError2({ modelId, modelType });
|
|
622
614
|
};
|
|
623
615
|
const provider = {
|
|
624
|
-
specificationVersion: "
|
|
616
|
+
specificationVersion: "v4",
|
|
625
617
|
video: createVideoModel,
|
|
626
618
|
videoModel: createVideoModel,
|
|
627
619
|
languageModel: (modelId) => noSuchModel(modelId, "languageModel"),
|
|
@@ -631,9 +623,8 @@ function createKlingAI(options = {}) {
|
|
|
631
623
|
return provider;
|
|
632
624
|
}
|
|
633
625
|
var klingai = createKlingAI();
|
|
634
|
-
|
|
635
|
-
0 && (module.exports = {
|
|
626
|
+
export {
|
|
636
627
|
createKlingAI,
|
|
637
628
|
klingai
|
|
638
|
-
}
|
|
629
|
+
};
|
|
639
630
|
//# sourceMappingURL=index.js.map
|