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.
@@ -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,CAsIpE,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-preview",
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
- durationRules: {
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-preview",
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
- durationRules: {
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-preview",
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
- durationRules: {
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
- "google-veo-3": {
72
- modelId: "veo-3.0-generate-001",
73
- type: ["text-to-video", "image-to-video"],
74
- fields: {
75
- prompt: { required: true },
76
- aspectRatio: { allowedValues: ["16:9", "9:16"] }, // 16:9 as default
77
- resolution: { allowedValues: ["720p", "1080p"] }, // 720p as default
78
- duration: { allowedValues: [4, 6, 8] }, // in seconds, 8s as default
79
- imageUrl: {},
80
- negative_prompt: {},
81
- audio: {},
82
- },
83
- resolutionRules: {
84
- "720p": ["16:9", "9:16"],
85
- "1080p": ["16:9"],
86
- },
87
- // concurrentRequests: 1,
88
- requestPerMin: 10,
89
- cost: {
90
- perSecond: 0.4,
91
- },
92
- },
93
- "google-veo-3-fast": {
94
- modelId: "veo-3.0-fast-generate-001",
95
- type: ["text-to-video", "image-to-video"],
96
- fields: {
97
- prompt: { required: true },
98
- aspectRatio: { allowedValues: ["16:9", "9:16"] }, // 16:9 as default
99
- resolution: { allowedValues: ["720p", "1080p"] }, // 720p as default
100
- duration: { allowedValues: [4, 6, 8] }, // in seconds, 8s as default
101
- imageUrl: {},
102
- negative_prompt: {},
103
- audio: {},
104
- },
105
- resolutionRules: {
106
- "720p": ["16:9", "9:16"],
107
- "1080p": ["16:9"],
108
- },
109
- requestPerMin: 10,
110
- cost: {
111
- perResolution: { "720p": 0.10, "1080p": 0.12 },
112
- },
113
- },
114
- "google-veo-2": {
115
- modelId: "veo-2.0-generate-001",
116
- type: ["text-to-video", "image-to-video"],
117
- fields: {
118
- prompt: { required: true },
119
- aspectRatio: { allowedValues: ["16:9", "9:16"] }, // 16:9 as default
120
- resolution: { allowedValues: ["720p"] }, // 720p as default
121
- duration: { allowedValues: [5, 6, 8] }, // in seconds, 8s as default
122
- imageUrl: {},
123
- negative_prompt: {},
124
- },
125
- resolutionRules: {
126
- "720p": ["16:9", "9:16"],
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
- imageUrl: { required: true },
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
- videoUrl: { required: true },
42
- aspecetRatio: {
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;IAExE,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAsG3B,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"}
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: params.prompt,
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,CA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a,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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vidspotai-shared",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {