vidspotai-shared 1.0.48 → 1.0.50
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/lib/globals/aiModels/providers/google.d.ts.map +1 -1
- package/lib/globals/aiModels/providers/google.js +62 -83
- package/lib/globals/aiModels/providers/runway.js +3 -3
- package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts +1 -0
- package/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/bytedance/bytedance.service.js +13 -1
- package/lib/services/aiGen/providers/kling/kling.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/kling/kling.service.js +11 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,eAAO,MAAM,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAiHpE,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.googleConfigs = void 0;
|
|
4
4
|
exports.googleConfigs = {
|
|
5
5
|
"google-veo-3.1": {
|
|
6
|
-
modelId: "veo-3.1-generate-
|
|
6
|
+
modelId: "veo-3.1-generate-001",
|
|
7
7
|
type: ["text-to-video", "image-to-video"],
|
|
8
8
|
fields: {
|
|
9
9
|
prompt: { required: true },
|
|
@@ -14,18 +14,13 @@ exports.googleConfigs = {
|
|
|
14
14
|
negative_prompt: {},
|
|
15
15
|
audio: {},
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
4: ["720p"],
|
|
19
|
-
6: ["720p"],
|
|
20
|
-
8: ["720p", "1080p"],
|
|
21
|
-
},
|
|
22
|
-
requestPerMin: 10,
|
|
17
|
+
requestPerMin: 50,
|
|
23
18
|
cost: {
|
|
24
19
|
perSecond: 0.4,
|
|
25
20
|
},
|
|
26
21
|
},
|
|
27
22
|
"google-veo-3.1-fast": {
|
|
28
|
-
modelId: "veo-3.1-fast-generate-
|
|
23
|
+
modelId: "veo-3.1-fast-generate-001",
|
|
29
24
|
type: ["text-to-video", "image-to-video"],
|
|
30
25
|
fields: {
|
|
31
26
|
prompt: { required: true },
|
|
@@ -36,18 +31,13 @@ exports.googleConfigs = {
|
|
|
36
31
|
negative_prompt: {},
|
|
37
32
|
audio: {},
|
|
38
33
|
},
|
|
39
|
-
|
|
40
|
-
4: ["720p"],
|
|
41
|
-
6: ["720p"],
|
|
42
|
-
8: ["720p", "1080p"],
|
|
43
|
-
},
|
|
44
|
-
requestPerMin: 10,
|
|
34
|
+
requestPerMin: 50,
|
|
45
35
|
cost: {
|
|
46
36
|
perResolution: { "720p": 0.10, "1080p": 0.12 },
|
|
47
37
|
},
|
|
48
38
|
},
|
|
49
39
|
"google-veo-3.1-lite": {
|
|
50
|
-
modelId: "veo-3.1-lite-generate-
|
|
40
|
+
modelId: "veo-3.1-lite-generate-001",
|
|
51
41
|
type: ["text-to-video", "image-to-video"],
|
|
52
42
|
fields: {
|
|
53
43
|
prompt: { required: true },
|
|
@@ -58,76 +48,65 @@ exports.googleConfigs = {
|
|
|
58
48
|
negative_prompt: {},
|
|
59
49
|
audio: {},
|
|
60
50
|
},
|
|
61
|
-
|
|
62
|
-
4: ["720p"],
|
|
63
|
-
6: ["720p"],
|
|
64
|
-
8: ["720p", "1080p"],
|
|
65
|
-
},
|
|
66
|
-
requestPerMin: 10,
|
|
51
|
+
requestPerMin: 50,
|
|
67
52
|
cost: {
|
|
68
53
|
perResolution: { "720p": 0.05, "1080p": 0.08 },
|
|
69
54
|
},
|
|
70
55
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
requestPerMin: 10,
|
|
129
|
-
cost: {
|
|
130
|
-
perSecond: 0.35,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
56
|
+
// Deprecated by Google — migrate to veo-3.1-generate-001 before June 30, 2026
|
|
57
|
+
// "google-veo-3": {
|
|
58
|
+
// modelId: "veo-3.0-generate-001",
|
|
59
|
+
// type: ["text-to-video", "image-to-video"],
|
|
60
|
+
// fields: {
|
|
61
|
+
// prompt: { required: true },
|
|
62
|
+
// aspectRatio: { allowedValues: ["16:9", "9:16"] },
|
|
63
|
+
// resolution: { allowedValues: ["720p", "1080p"] },
|
|
64
|
+
// duration: { allowedValues: [4, 6, 8] },
|
|
65
|
+
// imageUrl: {},
|
|
66
|
+
// negative_prompt: {},
|
|
67
|
+
// audio: {},
|
|
68
|
+
// },
|
|
69
|
+
// resolutionRules: {
|
|
70
|
+
// "720p": ["16:9", "9:16"],
|
|
71
|
+
// "1080p": ["16:9"],
|
|
72
|
+
// },
|
|
73
|
+
// requestPerMin: 10,
|
|
74
|
+
// cost: { perSecond: 0.4 },
|
|
75
|
+
// },
|
|
76
|
+
// Deprecated by Google — migrate to veo-3.1-fast-generate-001 before June 30, 2026
|
|
77
|
+
// "google-veo-3-fast": {
|
|
78
|
+
// modelId: "veo-3.0-fast-generate-001",
|
|
79
|
+
// type: ["text-to-video", "image-to-video"],
|
|
80
|
+
// fields: {
|
|
81
|
+
// prompt: { required: true },
|
|
82
|
+
// aspectRatio: { allowedValues: ["16:9", "9:16"] },
|
|
83
|
+
// resolution: { allowedValues: ["720p", "1080p"] },
|
|
84
|
+
// duration: { allowedValues: [4, 6, 8] },
|
|
85
|
+
// imageUrl: {},
|
|
86
|
+
// negative_prompt: {},
|
|
87
|
+
// audio: {},
|
|
88
|
+
// },
|
|
89
|
+
// resolutionRules: {
|
|
90
|
+
// "720p": ["16:9", "9:16"],
|
|
91
|
+
// "1080p": ["16:9"],
|
|
92
|
+
// },
|
|
93
|
+
// requestPerMin: 10,
|
|
94
|
+
// cost: { perResolution: { "720p": 0.10, "1080p": 0.12 } },
|
|
95
|
+
// },
|
|
96
|
+
// Deprecated by Google — migrate to veo-3.1-generate-001 before June 30, 2026
|
|
97
|
+
// "google-veo-2": {
|
|
98
|
+
// modelId: "veo-2.0-generate-001",
|
|
99
|
+
// type: ["text-to-video", "image-to-video"],
|
|
100
|
+
// fields: {
|
|
101
|
+
// prompt: { required: true },
|
|
102
|
+
// aspectRatio: { allowedValues: ["16:9", "9:16"] },
|
|
103
|
+
// resolution: { allowedValues: ["720p"] },
|
|
104
|
+
// duration: { allowedValues: [5, 6, 8] },
|
|
105
|
+
// imageUrl: {},
|
|
106
|
+
// negative_prompt: {},
|
|
107
|
+
// },
|
|
108
|
+
// resolutionRules: { "720p": ["16:9", "9:16"] },
|
|
109
|
+
// requestPerMin: 10,
|
|
110
|
+
// cost: { perSecond: 0.35 },
|
|
111
|
+
// },
|
|
133
112
|
};
|
|
@@ -20,7 +20,7 @@ exports.runwayConfigs = {
|
|
|
20
20
|
type: ["image-to-video"],
|
|
21
21
|
fields: {
|
|
22
22
|
prompt: { required: true },
|
|
23
|
-
|
|
23
|
+
inputImageUrl: { required: true },
|
|
24
24
|
aspectRatio: {
|
|
25
25
|
allowedValues: types_1.GEN4_TURBO_RATIOS,
|
|
26
26
|
},
|
|
@@ -38,8 +38,8 @@ exports.runwayConfigs = {
|
|
|
38
38
|
type: ["video-to-video"],
|
|
39
39
|
fields: {
|
|
40
40
|
prompt: { required: true },
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
inputVideoUrl: { required: true },
|
|
42
|
+
aspectRatio: {
|
|
43
43
|
allowedValues: types_1.GEN4_ALEPH_RATIOS,
|
|
44
44
|
},
|
|
45
45
|
duration: { allowedValues: types_1.GEN4_ALEPH_DURATIONS }, // in seconds
|
|
@@ -2,6 +2,7 @@ import { BaseAiGenProviderService } from "../baseAiGenProvider.service";
|
|
|
2
2
|
import { CreditUsageParams, VideoGenerationParams, VideoGenerationResult, VideoStatusParams, VideoStatusResult } from "../types";
|
|
3
3
|
export declare class ByteDanceService extends BaseAiGenProviderService {
|
|
4
4
|
private readonly baseUrl;
|
|
5
|
+
private sanitizePrompt;
|
|
5
6
|
generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
|
|
6
7
|
checkVideoStatus({ task, outputFilename, outputFilePath, }: VideoStatusParams): Promise<VideoStatusResult>;
|
|
7
8
|
getCreditUsed(params: CreditUsageParams): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;
|
|
1
|
+
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAI9E,OAAO,CAAC,cAAc;IAOhB,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA6G3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA8FjD,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAoCjD"}
|
|
@@ -19,14 +19,26 @@ class ByteDanceService extends baseAiGenProvider_service_1.BaseAiGenProviderServ
|
|
|
19
19
|
super(...arguments);
|
|
20
20
|
this.baseUrl = "https://ark.ap-southeast.bytepluses.com/api/v3/contents/generations/tasks";
|
|
21
21
|
}
|
|
22
|
+
// Bytedance Seedance only accepts ASCII printable characters and CJK (Chinese) characters.
|
|
23
|
+
// Strip everything else (emojis, en-dashes, special Unicode, etc.) and collapse whitespace.
|
|
24
|
+
sanitizePrompt(text) {
|
|
25
|
+
return text
|
|
26
|
+
.replace(/[^\x20-\x7E一-鿿㐀-䶿]/g, " ")
|
|
27
|
+
.replace(/\s+/g, " ")
|
|
28
|
+
.trim();
|
|
29
|
+
}
|
|
22
30
|
async generateVideo(params) {
|
|
23
31
|
(0, helpers_1.validateParams)(params);
|
|
24
32
|
const modelConfig = aiModels_1.aiModelConfigs[params.modelKey];
|
|
25
33
|
const modelId = modelConfig.modelId;
|
|
34
|
+
const sanitizedPrompt = this.sanitizePrompt(params.prompt ?? "");
|
|
35
|
+
if (!sanitizedPrompt) {
|
|
36
|
+
throw new errors_1.UserFacingError("Your prompt could not be processed. Please use English or Chinese text and try again.");
|
|
37
|
+
}
|
|
26
38
|
const content = [
|
|
27
39
|
{
|
|
28
40
|
type: "text",
|
|
29
|
-
text:
|
|
41
|
+
text: sanitizedPrompt,
|
|
30
42
|
},
|
|
31
43
|
];
|
|
32
44
|
// Optional image → Image-to-Video (first frame)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kling.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/kling.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"kling.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/kling.service.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAalB,qBAAa,YAAa,SAAQ,wBAAwB;IACxD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAW;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAU;;YAW1B,OAAO;IA8Bf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;YAqCnB,mBAAmB;YAqCnB,uBAAuB;IAwF/B,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;YAO/D,uBAAuB;YAgEvB,sBAAsB;IA6DpC,cAAc,IAAI,MAAM;IAexB,aAAa,CAAC,EACZ,QAAQ,EACR,IAA8B,EAC9B,QAAY,EACZ,SAAiB,GAClB,EAAE,iBAAiB,GAAG,MAAM;CAmB9B"}
|
|
@@ -15,6 +15,7 @@ const helpers_1 = require("../../helpers");
|
|
|
15
15
|
const types_2 = require("../../types");
|
|
16
16
|
const baseAiGenProvider_service_1 = require("../baseAiGenProvider.service");
|
|
17
17
|
const helpers_2 = require("../../../../utils/helpers");
|
|
18
|
+
const errors_1 = require("../../../../utils/errors");
|
|
18
19
|
class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService {
|
|
19
20
|
constructor() {
|
|
20
21
|
super();
|
|
@@ -107,6 +108,8 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
107
108
|
// Kling returns HTTP 429 for this, but it is NOT a transient rate-limit —
|
|
108
109
|
// retrying will always fail until the account is topped up.
|
|
109
110
|
const isInsufficientBalance = klingCode === 1102;
|
|
111
|
+
// Kling code 1201 covers two distinct audio rejections — check the message to distinguish.
|
|
112
|
+
const isAudioError = klingCode === 1201;
|
|
110
113
|
// True rate-limit (HTTP 429 without the balance code) — worth retrying with backoff.
|
|
111
114
|
const isRateLimit = httpStatus === 429 && !isInsufficientBalance;
|
|
112
115
|
const isRetryable = (isTimeout || isNetworkError || isRateLimit) && !isInsufficientBalance;
|
|
@@ -120,6 +123,14 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
|
|
|
120
123
|
});
|
|
121
124
|
throw err;
|
|
122
125
|
}
|
|
126
|
+
// Audio rejected by Kling — pick the user message based on which 1201 variant it is.
|
|
127
|
+
if (isAudioError) {
|
|
128
|
+
const klingMsg = (err.response?.data?.message ?? "").toLowerCase();
|
|
129
|
+
const userMessage = klingMsg.includes("size")
|
|
130
|
+
? "Your audio file is too large for this avatar generation. Please use a shorter audio clip and try again."
|
|
131
|
+
: "Your audio format is not supported. Please upload an MP3 or WAV file and try again.";
|
|
132
|
+
throw new errors_1.UserFacingError(userMessage);
|
|
133
|
+
}
|
|
123
134
|
if (!isRetryable || attempt === maxAttempts) {
|
|
124
135
|
logger_1.logger.error("Kling API request failed (non-retryable or max attempts reached)", {
|
|
125
136
|
endpoint,
|