vidspotai-shared 1.0.96 → 1.0.97

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.
@@ -23,6 +23,7 @@ export declare enum EVideoGenModels {
23
23
  KLING_V2_5_TURBO = "kling-v2.5-turbo",
24
24
  KLING_V2_6 = "kling-v2.6",
25
25
  KLING_V3_0 = "kling-v3.0",
26
+ KLING_V3_0_TURBO = "kling-v3.0-turbo",
26
27
  KLING_AVATAR = "kling-avatar",
27
28
  KLING_VIDEO_O1 = "kling-video-o1",
28
29
  KLING_V3_OMNI_VIDEO = "kling-v3-omni-video",
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../src/globals/aiModels/enums.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,0BAA0B,+BAA+B;IACzD,+BAA+B,oCAAoC;IACnE,0BAA0B,+BAA+B;IACzD,sBAAsB,2BAA2B;IACjD,2BAA2B,gCAAgC;IAC3D,cAAc,mBAAmB;IACjC,mBAAmB,wBAAwB;IAC3C,mBAAmB,wBAAwB;IAC3C,YAAY,iBAAiB;IAC7B,iBAAiB,sBAAsB;IACvC,YAAY,iBAAiB;IAC7B,aAAa,kBAAkB;IAC/B,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAE7B,cAAc,mBAAmB;IACjC,mBAAmB,wBAAwB;IAE3C,oBAAoB,yBAAyB;IAE7C,cAAc,mBAAmB;IAIjC,aAAa,kBAAkB;IAC/B,YAAY,iBAAiB;IAC7B,uBAAuB,4BAA4B;IACnD,kBAAkB,uBAAuB;I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kB,uBAAuB;CAC1C;AAED,oBAAY,cAAc;IAIxB,cAAc,mBAAmB;IACjC,mBAAmB,wBAAwB;IAC3C,iBAAiB,sBAAsB;IACvC,kBAAkB,uBAAuB;IAQzC,wBAAwB,6BAA6B;IACrD,yBAAyB,8BAA8B;IACvD,2BAA2B,gCAAgC;IAC3D,0BAA0B,+BAA+B;IAIzD,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;IAC/C,uBAAuB,4BAA4B;IACnD,qBAAqB,0BAA0B;CAChD;AAED;;;;GAIG;AACH,oBAAY,aAAa;IACvB,wBAAwB,6BAA6B;CACtD;AAED,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,aAAa,CAAC"}
@@ -27,6 +27,10 @@ var EVideoGenModels;
27
27
  EVideoGenModels["KLING_V2_5_TURBO"] = "kling-v2.5-turbo";
28
28
  EVideoGenModels["KLING_V2_6"] = "kling-v2.6";
29
29
  EVideoGenModels["KLING_V3_0"] = "kling-v3.0";
30
+ // Kling API 2.0 surface (POST /text-to-video/kling-3.0-turbo) — NOT the
31
+ // /v1/videos/* family every other Kling key above uses. See the config in
32
+ // globals/aiModels/providers/kling.ts for the full delta.
33
+ EVideoGenModels["KLING_V3_0_TURBO"] = "kling-v3.0-turbo";
30
34
  EVideoGenModels["KLING_AVATAR"] = "kling-avatar";
31
35
  // OmniVideo endpoint (/v1/videos/omni-video) — different from standard text2video/image2video
32
36
  EVideoGenModels["KLING_VIDEO_O1"] = "kling-video-o1";
@@ -1 +1 @@
1
- {"version":3,"file":"kling.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/kling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAsB,YAAY,EAAE,MAAM,UAAU,CAAC;AAqC5D,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CAsWnE,CAAC"}
1
+ {"version":3,"file":"kling.d.ts","sourceRoot":"","sources":["../../../../src/globals/aiModels/providers/kling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAsB,YAAY,EAAE,MAAM,UAAU,CAAC;AAqC5D,eAAO,MAAM,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,CA6bnE,CAAC"}
@@ -234,7 +234,15 @@ exports.klingConfigs = {
234
234
  },
235
235
  concurrentRequests: 10,
236
236
  // Verified 2026-05-20 from kling.ai/dev/pricing (V3 tab): std=$0.084/s, pro=$0.112/s, 4k=$0.42/s (no-audio).
237
- // With generate_audio=true: std=$0.126/s, pro=$0.168/s (1.5× upcharge); no separate table key yet.
237
+ // With generate_audio=true: std=$0.126/s, pro=$0.168/s (1.5× upcharge).
238
+ //
239
+ // ⚠️ The table below holds the NO-AUDIO base rates. The audio upcharge is
240
+ // NOT encoded here — it is applied in code at
241
+ // services/aiGen/providers/kling/klingCredits.ts:71-73 (`modelKey ===
242
+ // "kling-v3.0" && audio → cost *= 1.5`). Do NOT also add an `audio:` branch
243
+ // to this table: that would double-apply the 1.5× and overcharge every
244
+ // audio generation. If you ever move the upcharge into the table, delete
245
+ // the code path in the same commit.
238
246
  cost: {
239
247
  table: {
240
248
  std: { 5: 0.42, 10: 0.84 },
@@ -243,6 +251,82 @@ exports.klingConfigs = {
243
251
  },
244
252
  },
245
253
  },
254
+ // ─── Kling 3.0 Turbo — API 2.0 surface ──────────────────────────────────────
255
+ // ⚠️ This model does NOT speak the /v1/videos/* API the rest of this file
256
+ // targets. Kling shipped it on their new "API 2.0" surface, which differs in
257
+ // every layer. Verified 2026-07-22 against the official docs:
258
+ //
259
+ // submit POST /text-to-video/kling-3.0-turbo (model in the PATH, no
260
+ // POST /image-to-video/kling-3.0-turbo `model_name` field)
261
+ // body nested { contents[] | prompt, settings{}, options{} }
262
+ // — not the flat v1 body
263
+ // quality settings.resolution: "720p" | "1080p" — there is no `mode`
264
+ // poll GET /tasks?task_ids=<id> → data[] array
265
+ // status "succeeded" (NOT v1's "succeed" — a one-character difference that
266
+ // would silently hang a job forever if the v1 parser were reused)
267
+ // result data[0].outputs[] → find type === "video" → .url
268
+ //
269
+ // Handled by dedicated code paths: buildTurboVideoBody (klingRequests.ts),
270
+ // KlingService.generateTurboVideo, and checkTurboVideoStatus (klingStatus.ts).
271
+ // The v1 status prober must never be pointed at a turbo task id.
272
+ //
273
+ // Capability deltas vs kling-v3.0 (official capability map, 2026-07-22):
274
+ // • no 4K (720p/1080p only) • no first/last-frame (first_frame only)
275
+ // • no element control • no motion control / video reference
276
+ // • no camera control • no cfg_scale / negative_prompt fields
277
+ // • multi-shot is encoded IN THE PROMPT ("shot 1, 3s, …; shot 2, 4s, …"),
278
+ // not as a multi_prompt[] array — so `multiShot` is deliberately NOT
279
+ // declared here; the canonical adapter would emit the wrong shape.
280
+ "kling-v3.0-turbo": {
281
+ modelId: "kling-3.0-turbo", // also the URL path segment — keep exact
282
+ type: ["text-to-video", "image-to-video"],
283
+ tier: "T3",
284
+ fields: {
285
+ prompt: { required: true },
286
+ aspectRatio: { allowedValues: ["16:9", "9:16", "1:1"] },
287
+ duration: { allowedValues: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] },
288
+ // We keep `mode` as the canonical quality knob for UI/cost-table
289
+ // uniformity and map std→720p, pro→1080p at request-build time. That is
290
+ // Kling's own legacy mapping (their billing ledger documents
291
+ // "720p=std, 1080p=pro"). An explicit `resolution` param wins if passed.
292
+ mode: { allowedValues: ["std", "pro"] },
293
+ resolution: { allowedValues: ["720p", "1080p"] },
294
+ inputImageUrl: {}, // → contents[{ type: "first_frame", url }]
295
+ callbackUrl: {},
296
+ externalTaskId: {},
297
+ watermark: {},
298
+ },
299
+ concurrentRequests: 10,
300
+ // Verified 2026-07-22 from /document-api/pricing/base/video.
301
+ //
302
+ // Turbo has ONE price tier and native audio is always included — there is
303
+ // no audio/no-audio split and therefore NO 1.5× upcharge to apply (unlike
304
+ // kling-v3.0, whose upcharge lives in klingCredits.ts). Do not add one.
305
+ //
306
+ // 720p: 0.8 units/s = $0.112/s 1080p: 1.0 unit/s = $0.14/s
307
+ //
308
+ // So Turbo is cheaper than v3.0 ONLY when you want audio:
309
+ // with audio v3.0 std $0.126/s → turbo $0.112/s (-11%)
310
+ // v3.0 pro $0.168/s → turbo $0.14/s (-17%)
311
+ // without audio v3.0 std $0.084/s → turbo $0.112/s (+33% — WORSE)
312
+ // Route no-audio work to kling-v3.0, audio work here.
313
+ //
314
+ // Priced per-second rather than via a duration table because Turbo allows
315
+ // every duration 3–15s; a {5,10} table would miss 13 of 13 other values and
316
+ // fall through to the $1.00 fallback in getKlingCreditUsed.
317
+ cost: {
318
+ perMode: {
319
+ std: { perSecond: 0.112 },
320
+ pro: { perSecond: 0.14 },
321
+ },
322
+ },
323
+ guidance: {
324
+ quality: 4,
325
+ speed: 4,
326
+ bestFor: "Cheapest Kling tier with native audio. Prefer over kling-v3.0 whenever the scene needs sound.",
327
+ notes: "Audio is always on and always billed — for silent output kling-v3.0 std is 33% cheaper. No 4K, no last-frame, no camera control, no element/motion control.",
328
+ },
329
+ },
246
330
  "kling-v2.6": {
247
331
  modelId: "kling-v2-6",
248
332
  type: ["text-to-video", "image-to-video"],
@@ -41,4 +41,33 @@ export declare const MIN_CREDITS_PER_PAID_OP = 10;
41
41
  * MIN_CREDITS_PER_PAID_OP.
42
42
  */
43
43
  export declare const MIN_CREDITS_PER_IMAGE_OP = 2;
44
+ /**
45
+ * Credits granted on SIGNUP. Zero since 2026-07-22 — signing up no longer buys
46
+ * anything.
47
+ *
48
+ * It used to be 10 (= one full floored generation = $1.00 of provider cost),
49
+ * handed to every new account with no card, no email verification, and no
50
+ * device/IP dedup. Measured against production: 23,962 users, 15,021 of whom
51
+ * consumed credits, and only 88 who ever spent past the free grant — a 0.59%
52
+ * conversion on roughly $15k of given-away provider cost. Combined with the
53
+ * refund-on-failure path, single accounts reached 274 jobs and 100 delivered
54
+ * videos on a 10-credit balance.
55
+ *
56
+ * The free generation now lives behind the free trial, which requires a card
57
+ * (Stripe Checkout, `trialDays: 1` — payment.controller.ts). Same product
58
+ * experience, but the grant is tied to a payment instrument that Stripe can
59
+ * fingerprint, so it cannot be farmed by making another Google account.
60
+ *
61
+ * Set this back above zero ONLY together with an anti-abuse gate (verified
62
+ * email + App Check at minimum) — otherwise the farming loop reopens.
63
+ */
64
+ export declare const SIGNUP_GRANT_CREDITS = 0;
65
+ /**
66
+ * Credits granted when a card-backed free trial actually starts (the
67
+ * `isTrialInvoice` branch in payment.service.handleInvoiceSucceeded). This is
68
+ * the value the signup grant used to hand out for free, now earned by adding a
69
+ * payment method. Deliberately equal to MIN_CREDITS_PER_PAID_OP so the trial is
70
+ * exactly one full generation of any kind.
71
+ */
72
+ export declare const TRIAL_GRANT_CREDITS = 10;
44
73
  //# sourceMappingURL=creditUnit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"creditUnit.d.ts","sourceRoot":"","sources":["../../src/globals/creditUnit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iDAAiD;AACjD,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,0EAA0E;AAC1E,eAAO,MAAM,eAAe,QAAqB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC"}
1
+ {"version":3,"file":"creditUnit.d.ts","sourceRoot":"","sources":["../../src/globals/creditUnit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iDAAiD;AACjD,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,0EAA0E;AAC1E,eAAO,MAAM,eAAe,QAAqB,CAAC;AAElD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,KAA0B,CAAC"}
@@ -16,7 +16,7 @@
16
16
  * underlying cost. Both now derive from the values below.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.MIN_CREDITS_PER_IMAGE_OP = exports.MIN_CREDITS_PER_PAID_OP = exports.CREDITS_PER_USD = exports.USD_PER_CREDIT = void 0;
19
+ exports.TRIAL_GRANT_CREDITS = exports.SIGNUP_GRANT_CREDITS = exports.MIN_CREDITS_PER_IMAGE_OP = exports.MIN_CREDITS_PER_PAID_OP = exports.CREDITS_PER_USD = exports.USD_PER_CREDIT = void 0;
20
20
  /** Provider cost (USD) covered by one credit. */
21
21
  exports.USD_PER_CREDIT = 0.1;
22
22
  /** Credits per USD of provider cost. Equals 1 / USD_PER_CREDIT (= 10). */
@@ -44,3 +44,32 @@ exports.MIN_CREDITS_PER_PAID_OP = 10;
44
44
  * MIN_CREDITS_PER_PAID_OP.
45
45
  */
46
46
  exports.MIN_CREDITS_PER_IMAGE_OP = 2;
47
+ /**
48
+ * Credits granted on SIGNUP. Zero since 2026-07-22 — signing up no longer buys
49
+ * anything.
50
+ *
51
+ * It used to be 10 (= one full floored generation = $1.00 of provider cost),
52
+ * handed to every new account with no card, no email verification, and no
53
+ * device/IP dedup. Measured against production: 23,962 users, 15,021 of whom
54
+ * consumed credits, and only 88 who ever spent past the free grant — a 0.59%
55
+ * conversion on roughly $15k of given-away provider cost. Combined with the
56
+ * refund-on-failure path, single accounts reached 274 jobs and 100 delivered
57
+ * videos on a 10-credit balance.
58
+ *
59
+ * The free generation now lives behind the free trial, which requires a card
60
+ * (Stripe Checkout, `trialDays: 1` — payment.controller.ts). Same product
61
+ * experience, but the grant is tied to a payment instrument that Stripe can
62
+ * fingerprint, so it cannot be farmed by making another Google account.
63
+ *
64
+ * Set this back above zero ONLY together with an anti-abuse gate (verified
65
+ * email + App Check at minimum) — otherwise the farming loop reopens.
66
+ */
67
+ exports.SIGNUP_GRANT_CREDITS = 0;
68
+ /**
69
+ * Credits granted when a card-backed free trial actually starts (the
70
+ * `isTrialInvoice` branch in payment.service.handleInvoiceSucceeded). This is
71
+ * the value the signup grant used to hand out for free, now earned by adding a
72
+ * payment method. Deliberately equal to MIN_CREDITS_PER_PAID_OP so the trial is
73
+ * exactly one full generation of any kind.
74
+ */
75
+ exports.TRIAL_GRANT_CREDITS = exports.MIN_CREDITS_PER_PAID_OP;
@@ -1 +1 @@
1
- {"version":3,"file":"aiGenFactory.service.d.ts","sourceRoot":"","sources":["../../../src/services/aiGen/aiGenFactory.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EACL,iBAAiB,EAEjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAchC,KAAK,uBAAuB,GAAG,UAAU,wBAAwB,CAAC;AASlE,eAAO,MAAM,gBAAgB,EAAE,OAAO,CACpC,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC,CA+DjD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,iBAAiB,EACjB,uBAAuB,CA2CxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,eAAe,EACf,uBAAuB,CAMxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,aAAa,EACb,uBAAuB,CAGxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAsBzE,CAAC;AAEJ,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,GACpB,wBAAwB,CAmB1B"}
1
+ {"version":3,"file":"aiGenFactory.service.d.ts","sourceRoot":"","sources":["../../../src/services/aiGen/aiGenFactory.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EACL,iBAAiB,EAEjB,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAchC,KAAK,uBAAuB,GAAG,UAAU,wBAAwB,CAAC;AASlE,eAAO,MAAM,gBAAgB,EAAE,OAAO,CACpC,MAAM,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAgEjD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,iBAAiB,EACjB,uBAAuB,CA2CxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,eAAe,EACf,uBAAuB,CAMxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,aAAa,EACb,uBAAuB,CAGxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAsBzE,CAAC;AAEJ,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,GACpB,wBAAwB,CAmB1B"}
@@ -51,6 +51,7 @@ exports.videoServicesMap = {
51
51
  "kling-v2.1": kling_service_1.KlingService,
52
52
  "kling-v2.1-master": kling_service_1.KlingService,
53
53
  "kling-v3.0": kling_service_1.KlingService,
54
+ "kling-v3.0-turbo": kling_service_1.KlingService,
54
55
  "kling-avatar": kling_service_1.KlingService,
55
56
  "kling-video-o1": kling_service_1.KlingService,
56
57
  "kling-v3-omni-video": kling_service_1.KlingService,
@@ -1,7 +1,23 @@
1
1
  import { BaseAiGenProviderService } from "../baseAiGenProvider.service";
2
2
  import { CreditUsageParams, VideoGenerationParams, VideoGenerationResult, VideoStatusParams, VideoStatusResult } from "../types";
3
3
  /**
4
- * Kling provider. This class is the transport (JWT auth, IPv4-pinned agents,
4
+ * Kling runs TWO incompatible auth schemes, split by API surface. Verified
5
+ * against the live API 2026-07-22.
6
+ *
7
+ * "jwt" — the legacy AK/SK flow: an HS256 JWT signed per request from
8
+ * KLING_ACCESS_KEY + KLING_SECRET_KEY. Accepted by every
9
+ * /v1/videos/*, /v1/images/* and /account/* endpoint.
10
+ *
11
+ * "apiKey" — a static console-issued key sent verbatim as a bearer token,
12
+ * required by the API 2.0 surface (/text-to-video/*,
13
+ * /image-to-video/*, /tasks). Presenting a JWT there returns
14
+ * HTTP 401 code 1002: "The current API does not support AK/SK;
15
+ * please go to the console to create API key."
16
+ * Created at https://kling.ai/dev/api-key → env KLING_API_KEY.
17
+ */
18
+ export type KlingAuthMode = "jwt" | "apiKey";
19
+ /**
20
+ * Kling provider. This class is the transport (auth, IPv4-pinned agents,
5
21
  * timeout/retry) plus the per-endpoint submit dispatch. Request-body building
6
22
  * lives in ./klingRequests, status polling + result stashing in ./klingStatus,
7
23
  * and credit math in ./klingCredits.
@@ -15,6 +31,16 @@ export declare class KlingService extends BaseAiGenProviderService {
15
31
  constructor();
16
32
  private request;
17
33
  generateVideo(params: VideoGenerationParams): Promise<VideoGenerationResult>;
34
+ /**
35
+ * kling-3.0-turbo submit. Kling shipped this model on their "API 2.0"
36
+ * surface, which shares no shape with the /v1/videos/* endpoints the rest of
37
+ * this class targets:
38
+ * • the model is a PATH SEGMENT, not a `model_name` body field
39
+ * • the body is nested (contents/settings/options)
40
+ * • the submit response carries the task id at `data.id`, not `data.task_id`
41
+ * Polling likewise goes to checkTurboVideoStatus, never the v1 prober.
42
+ */
43
+ private generateTurboVideo;
18
44
  /**
19
45
  * Extend a previously-generated Kling video by ~4-5s. Takes the Kling task id
20
46
  * of the source video (must have been generated by this Kling account).
@@ -27,6 +53,15 @@ export declare class KlingService extends BaseAiGenProviderService {
27
53
  private generateAvatarVideo;
28
54
  private requestWithTimeoutRetry;
29
55
  checkVideoStatus(params: VideoStatusParams): Promise<VideoStatusResult>;
56
+ /**
57
+ * Pick the credential for the surface being called. The API 2.0 key is
58
+ * optional in env — only kling-v3.0-turbo needs it — so its absence must not
59
+ * break the JWT models that make up the rest of the catalog. Failing here
60
+ * (rather than letting Kling return an opaque 401) means the scene fails at
61
+ * SUBMIT with no task id, which our refund policy treats as never-billed →
62
+ * the user is refunded in full.
63
+ */
64
+ private resolveAuthToken;
30
65
  encodeJwtToken(): string;
31
66
  getCreditUsed(params: CreditUsageParams): number;
32
67
  }
@@ -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;AAsBlB;;;;;GAKG;AACH,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;IASxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkD;IAC9E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmD;;YAWlE,OAAO;IAgCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAoDjC;;;;OAIG;YACW,WAAW;YA6BX,iBAAiB;YA6BjB,qBAAqB;YAgCrB,eAAe;YAkDf,mBAAmB;YAgCnB,uBAAuB;IAqI/B,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAW7E,cAAc,IAAI,MAAM;IAexB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAGjD"}
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;AAyBlB;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE7C;;;;;GAKG;AACH,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;IASxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkD;IAC9E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmD;;YAWlE,OAAO;IAiCf,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IA0DjC;;;;;;;;OAQG;YACW,kBAAkB;IAgChC;;;;OAIG;YACW,WAAW;YA6BX,iBAAiB;YA6BjB,qBAAqB;YAgCrB,eAAe;YAkDf,mBAAmB;YAgCnB,uBAAuB;IAsI/B,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAiB7E;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAiBxB,cAAc,IAAI,MAAM;IAexB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAGjD"}
@@ -19,7 +19,7 @@ const klingRequests_1 = require("./klingRequests");
19
19
  const klingCredits_1 = require("./klingCredits");
20
20
  const klingStatus_1 = require("./klingStatus");
21
21
  /**
22
- * Kling provider. This class is the transport (JWT auth, IPv4-pinned agents,
22
+ * Kling provider. This class is the transport (auth, IPv4-pinned agents,
23
23
  * timeout/retry) plus the per-endpoint submit dispatch. Request-body building
24
24
  * lives in ./klingRequests, status polling + result stashing in ./klingStatus,
25
25
  * and credit math in ./klingCredits.
@@ -43,12 +43,12 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
43
43
  throw new Error("Missing KLING_SECRET_KEY or KLING_ACCESS_KEY in environment variables");
44
44
  }
45
45
  }
46
- async request(endpoint, method, body, timeout = this.generateTimeout) {
46
+ async request(endpoint, method, body, timeout = this.generateTimeout, authMode = "jwt") {
47
47
  const config = {
48
48
  method,
49
49
  url: `${this.baseUrl}${endpoint}`,
50
50
  headers: {
51
- Authorization: `Bearer ${this.encodeJwtToken()}`,
51
+ Authorization: `Bearer ${this.resolveAuthToken(authMode)}`,
52
52
  "Content-Type": "application/json",
53
53
  },
54
54
  timeout,
@@ -77,6 +77,9 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
77
77
  params.modelKey === "kling-v3-omni-video") {
78
78
  return this.generateOmniVideo(params);
79
79
  }
80
+ if (params.modelKey === "kling-v3.0-turbo") {
81
+ return this.generateTurboVideo(params);
82
+ }
80
83
  if (params.endpoint === "extend") {
81
84
  return this.extendVideo(params);
82
85
  }
@@ -95,6 +98,35 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
95
98
  });
96
99
  return { task: task.data.task_id, status: types_1.EVideoSceneStatus.TRIGGERED };
97
100
  }
101
+ // ─── Kling 3.0 Turbo (API 2.0: /text-to-video|/image-to-video/<modelId>) ────
102
+ /**
103
+ * kling-3.0-turbo submit. Kling shipped this model on their "API 2.0"
104
+ * surface, which shares no shape with the /v1/videos/* endpoints the rest of
105
+ * this class targets:
106
+ * • the model is a PATH SEGMENT, not a `model_name` body field
107
+ * • the body is nested (contents/settings/options)
108
+ * • the submit response carries the task id at `data.id`, not `data.task_id`
109
+ * Polling likewise goes to checkTurboVideoStatus, never the v1 prober.
110
+ */
111
+ async generateTurboVideo(params) {
112
+ const modelId = aiModels_1.aiModelConfigs[params.modelKey]?.modelId;
113
+ if (!modelId)
114
+ throw new Error(`Unknown modelKey: ${params.modelKey}`);
115
+ // Kling exposes T2V and I2V as two distinct paths (no shared endpoint with
116
+ // an optional image field, as v1 had).
117
+ const kind = params.inputImageUrl ? "image-to-video" : "text-to-video";
118
+ const body = (0, klingRequests_1.buildTurboVideoBody)(params);
119
+ const starttime = Date.now();
120
+ const task = await this.requestWithTimeoutRetry(`/${kind}/${modelId}`, "POST", body, 4, this.generateTimeout, "apiKey");
121
+ logger_1.logger.info("Kling generateTurboVideo submitted", {
122
+ modelKey: params.modelKey,
123
+ modelId,
124
+ kind,
125
+ taskId: task.data.id,
126
+ durationMs: Date.now() - starttime,
127
+ });
128
+ return { task: task.data.id, status: types_1.EVideoSceneStatus.TRIGGERED };
129
+ }
98
130
  /**
99
131
  * Extend a previously-generated Kling video by ~4-5s. Takes the Kling task id
100
132
  * of the source video (must have been generated by this Kling account).
@@ -196,10 +228,10 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
196
228
  });
197
229
  return { task: task.data.task_id, status: types_1.EVideoSceneStatus.TRIGGERED };
198
230
  }
199
- async requestWithTimeoutRetry(endpoint, method, body, maxAttempts = 4, timeout = this.statusTimeout) {
231
+ async requestWithTimeoutRetry(endpoint, method, body, maxAttempts = 4, timeout = this.statusTimeout, authMode = "jwt") {
200
232
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
201
233
  try {
202
- return await this.request(endpoint, method, body, timeout);
234
+ return await this.request(endpoint, method, body, timeout, authMode);
203
235
  }
204
236
  catch (err) {
205
237
  const httpStatus = err.response?.status;
@@ -314,8 +346,33 @@ class KlingService extends baseAiGenProvider_service_1.BaseAiGenProviderService
314
346
  if (params.modelKey === "kling-avatar") {
315
347
  return (0, klingStatus_1.checkAvatarVideoStatus)(deps, params);
316
348
  }
349
+ // API 2.0 task — different endpoint, array response, and "succeeded" vs
350
+ // v1's "succeed". The v1 prober would 404 down its whole endpoint list and
351
+ // report the task missing.
352
+ if (params.modelKey === "kling-v3.0-turbo") {
353
+ return (0, klingStatus_1.checkTurboVideoStatus)(deps, params);
354
+ }
317
355
  return (0, klingStatus_1.checkRegularVideoStatus)(deps, params);
318
356
  }
357
+ /**
358
+ * Pick the credential for the surface being called. The API 2.0 key is
359
+ * optional in env — only kling-v3.0-turbo needs it — so its absence must not
360
+ * break the JWT models that make up the rest of the catalog. Failing here
361
+ * (rather than letting Kling return an opaque 401) means the scene fails at
362
+ * SUBMIT with no task id, which our refund policy treats as never-billed →
363
+ * the user is refunded in full.
364
+ */
365
+ resolveAuthToken(mode) {
366
+ if (mode === "jwt")
367
+ return this.encodeJwtToken();
368
+ const apiKey = process.env.KLING_API_KEY;
369
+ if (!apiKey) {
370
+ // Operator detail goes to Loki/Slack; the user sees only the safe copy.
371
+ logger_1.logger.error("KLING_API_KEY is not set — Kling API 2.0 models (kling-v3.0-turbo) need a console-issued API key from https://kling.ai/dev/api-key. The legacy AK/SK JWT is rejected by that surface with HTTP 401 code 1002.");
372
+ throw new errors_1.UserFacingError("This model is temporarily unavailable. Please pick another model.", errors_1.USER_FACING_ERROR_CODES.PROVIDER_AUTH_ERROR);
373
+ }
374
+ return apiKey;
375
+ }
319
376
  encodeJwtToken() {
320
377
  const payload = {
321
378
  iss: process.env.KLING_ACCESS_KEY,
@@ -1 +1 @@
1
- {"version":3,"file":"klingCredits.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingCredits.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,IAA8B,EAC9B,QAAY,EACZ,SAAiB,EACjB,KAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,MAAM,CAuD5B"}
1
+ {"version":3,"file":"klingCredits.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingCredits.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,IAA8B,EAC9B,QAAY,EACZ,SAAiB,EACjB,KAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,MAAM,CAoE5B"}
@@ -23,6 +23,18 @@ function getKlingCreditUsed({ modelKey, mode = types_1.EVideoMode.PROFESSIONAL,
23
23
  const billedSeconds = Math.ceil(duration / 5) * 5;
24
24
  return (0, helpers_1.getCreditsFromCost)(perSecond * billedSeconds, applyFloor);
25
25
  }
26
+ // kling-3.0-turbo: one flat per-second rate by resolution, native audio
27
+ // always included. Priced per-second (not via a duration table) because
28
+ // Turbo allows every duration 3–15s — a {5,10} table would miss 13 of the 15
29
+ // legal values and silently fall through to the $1.00 fallback below.
30
+ // There is deliberately NO audio multiplier: Kling publishes a single tier
31
+ // for this model, so applying v3.0's 1.5× here would overcharge every call.
32
+ if (modelKey === "kling-v3.0-turbo") {
33
+ const perSecond = modelConfig?.cost?.perMode?.[mode]?.perSecond
34
+ ?? modelConfig?.cost?.perMode?.["std"]?.perSecond
35
+ ?? 0.112;
36
+ return (0, helpers_1.getCreditsFromCost)(perSecond * duration, applyFloor);
37
+ }
26
38
  // v2.6 splits cost by audio/noAudio tier (audio is 2× upcharge).
27
39
  if (modelKey === "kling-v2.6") {
28
40
  const branch = audio ? modelConfig?.cost?.audio : modelConfig?.cost?.noAudio;
@@ -1,5 +1,5 @@
1
1
  import { VideoGenerationParams } from "../types";
2
- import { KlingAvatarGenerateRequest, KlingImageToVideoRequest, KlingLipSyncRequest, KlingMotionControlRequest, KlingOmniVideoRequest, KlingVideoGenerateRequest } from "./types";
2
+ import { KlingAvatarGenerateRequest, KlingImageToVideoRequest, KlingLipSyncRequest, KlingMotionControlRequest, KlingOmniVideoRequest, KlingTurboImageToVideoRequest, KlingTurboTextToVideoRequest, KlingVideoGenerateRequest } from "./types";
3
3
  /**
4
4
  * Pure request-body builders mapping our provider-agnostic
5
5
  * VideoGenerationParams onto Kling's per-endpoint request shapes. No I/O —
@@ -29,4 +29,17 @@ export declare function buildLipSyncBody(params: VideoGenerationParams, sessionI
29
29
  face_id: string;
30
30
  start_time: number;
31
31
  }): KlingLipSyncRequest;
32
+ /**
33
+ * kling-3.0-turbo body (Kling API 2.0). Shares nothing with
34
+ * buildVideoGenerateRequest above — the surface is nested
35
+ * (`contents`/`settings`/`options`), the model lives in the URL path rather
36
+ * than a `model_name` field, and quality is `resolution` rather than `mode`.
37
+ *
38
+ * Deliberately drops params Turbo does not accept: negativePrompt, cfgScale,
39
+ * cameraControl, lastFrameImageUrl, staticMaskUrl, dynamicMasks, multiShot,
40
+ * and any audio toggle (native audio is always on and always billed). Silently
41
+ * ignoring them is intended — the config's `fields` is what gates the UI, and
42
+ * an agent-authored scene may carry extras from a prior model.
43
+ */
44
+ export declare function buildTurboVideoBody(params: VideoGenerationParams): KlingTurboTextToVideoRequest | KlingTurboImageToVideoRequest;
32
45
  //# sourceMappingURL=klingRequests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"klingRequests.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingRequests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAEL,0BAA0B,EAE1B,wBAAwB,EACxB,mBAAmB,EAEnB,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AAEH;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,GAAG,wBAAwB,CAmDtD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,qBAAqB,CA8CvB;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,CAW3B;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,GAC5B,0BAA0B,CAS5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5C,mBAAmB,CAgBrB"}
1
+ {"version":3,"file":"klingRequests.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingRequests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAEL,0BAA0B,EAE1B,wBAAwB,EACxB,mBAAmB,EAEnB,yBAAyB,EACzB,qBAAqB,EAErB,6BAA6B,EAI7B,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;;;;GAMG;AAEH;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,GAAG,wBAAwB,CAmDtD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,qBAAqB,CA8CvB;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,GACd,yBAAyB,CAW3B;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,GAC5B,0BAA0B,CAS5B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC5C,mBAAmB,CAgBrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,qBAAqB,GAC5B,4BAA4B,GAAG,6BAA6B,CA+B9D"}
@@ -6,6 +6,7 @@ exports.buildOmniVideoBody = buildOmniVideoBody;
6
6
  exports.buildMotionControlBody = buildMotionControlBody;
7
7
  exports.buildAvatarRequest = buildAvatarRequest;
8
8
  exports.buildLipSyncBody = buildLipSyncBody;
9
+ exports.buildTurboVideoBody = buildTurboVideoBody;
9
10
  const types_1 = require("../../types");
10
11
  const cameraAdapter_1 = require("./cameraAdapter");
11
12
  /**
@@ -192,3 +193,46 @@ function buildLipSyncBody(params, sessionId, face) {
192
193
  ...(params.externalTaskId ? { external_task_id: params.externalTaskId } : {}),
193
194
  };
194
195
  }
196
+ /**
197
+ * kling-3.0-turbo body (Kling API 2.0). Shares nothing with
198
+ * buildVideoGenerateRequest above — the surface is nested
199
+ * (`contents`/`settings`/`options`), the model lives in the URL path rather
200
+ * than a `model_name` field, and quality is `resolution` rather than `mode`.
201
+ *
202
+ * Deliberately drops params Turbo does not accept: negativePrompt, cfgScale,
203
+ * cameraControl, lastFrameImageUrl, staticMaskUrl, dynamicMasks, multiShot,
204
+ * and any audio toggle (native audio is always on and always billed). Silently
205
+ * ignoring them is intended — the config's `fields` is what gates the UI, and
206
+ * an agent-authored scene may carry extras from a prior model.
207
+ */
208
+ function buildTurboVideoBody(params) {
209
+ const settings = {
210
+ // Explicit resolution wins; otherwise map our canonical mode using Kling's
211
+ // own legacy equivalence (std=720p, pro=1080p).
212
+ resolution: params.resolution ??
213
+ (params.mode === types_1.EVideoMode.PROFESSIONAL ? "1080p" : "720p"),
214
+ duration: params.duration ?? 5,
215
+ };
216
+ if (params.aspectRatio) {
217
+ settings.aspect_ratio = params.aspectRatio;
218
+ }
219
+ const options = {};
220
+ if (params.callbackUrl)
221
+ options.callback_url = params.callbackUrl;
222
+ if (params.externalTaskId)
223
+ options.external_task_id = params.externalTaskId;
224
+ if (params.watermark !== undefined) {
225
+ options.watermark_info = { enabled: Boolean(params.watermark) };
226
+ }
227
+ const maybeOptions = Object.keys(options).length ? { options } : {};
228
+ if (params.inputImageUrl) {
229
+ // I2V: prompt and image BOTH ride inside contents[].
230
+ const contents = [];
231
+ if (params.prompt)
232
+ contents.push({ type: "prompt", text: params.prompt });
233
+ contents.push({ type: "first_frame", url: params.inputImageUrl });
234
+ return { contents, settings, ...maybeOptions };
235
+ }
236
+ // T2V: prompt is a top-level string on this endpoint (not contents[]).
237
+ return { prompt: params.prompt, settings, ...maybeOptions };
238
+ }
@@ -1,4 +1,5 @@
1
1
  import { VideoStatusParams, VideoStatusResult } from "../types";
2
+ import type { KlingAuthMode } from "./kling.service";
2
3
  /**
3
4
  * Kling status polling + result stashing. Extracted from KlingService so the
4
5
  * class stays a thin transport/dispatch layer. These take a `request` dep (the
@@ -7,10 +8,21 @@ import { VideoStatusParams, VideoStatusResult } from "../types";
7
8
  */
8
9
  export interface KlingStatusDeps {
9
10
  /** Bound KlingService.requestWithTimeoutRetry. */
10
- request: <T>(endpoint: string, method: "POST" | "GET", body?: any, maxAttempts?: number, timeout?: number) => Promise<T>;
11
+ request: <T>(endpoint: string, method: "POST" | "GET", body?: any, maxAttempts?: number, timeout?: number,
12
+ /** "apiKey" for the API 2.0 surface (/tasks); defaults to the AK/SK JWT. */
13
+ authMode?: KlingAuthMode) => Promise<T>;
11
14
  /** Submit-endpoint timeout (also used for the potentially-large video download). */
12
15
  generateTimeout: number;
13
16
  }
17
+ /**
18
+ * kling-3.0-turbo polling (Kling API 2.0). Separate from the v1 poller for
19
+ * three reasons, any one of which would break if the v1 path were reused:
20
+ * • the endpoint is GET /tasks?task_ids=<id>, not /v1/videos/<kind>/<id>
21
+ * • `data` is an ARRAY of tasks, not a single object
22
+ * • success is spelled "succeeded" here and "succeed" on v1
23
+ * It also means turbo needs no endpoint probing — one call, no 404 fan-out.
24
+ */
25
+ export declare function checkTurboVideoStatus(deps: KlingStatusDeps, { task, outputFilename, outputFilePath }: VideoStatusParams): Promise<VideoStatusResult>;
14
26
  export declare function checkRegularVideoStatus(deps: KlingStatusDeps, { task, outputFilename, outputFilePath }: VideoStatusParams): Promise<VideoStatusResult>;
15
27
  export declare function checkAvatarVideoStatus(deps: KlingStatusDeps, { task, outputFilename, outputFilePath }: VideoStatusParams): Promise<VideoStatusResult>;
16
28
  //# sourceMappingURL=klingStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"klingStatus.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingStatus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGhE;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,OAAO,EAAE,CAAC,CAAC,EACT,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,KAAK,EACtB,IAAI,CAAC,EAAE,GAAG,EACV,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,CAAC,CAAC,CAAC;IAChB,oFAAoF;IACpF,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,cAAc,EAAE,cAAyB,EAAE,EAAE,iBAAiB,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAyE5B;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,cAAc,EAAE,cAAyB,EAAE,EAAE,iBAAiB,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAqG5B"}
1
+ {"version":3,"file":"klingStatus.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/klingStatus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kDAAkD;IAClD,OAAO,EAAE,CAAC,CAAC,EACT,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,KAAK,EACtB,IAAI,CAAC,EAAE,GAAG,EACV,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,aAAa,KACrB,OAAO,CAAC,CAAC,CAAC,CAAC;IAChB,oFAAoF;IACpF,eAAe,EAAE,MAAM,CAAC;CACzB;AA4ED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,cAAc,EAAE,cAAyB,EAAE,EAAE,iBAAiB,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAuD5B;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,cAAc,EAAE,cAAyB,EAAE,EAAE,iBAAiB,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAyE5B;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,eAAe,EACrB,EAAE,IAAI,EAAE,cAAc,EAAE,cAAyB,EAAE,EAAE,iBAAiB,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAqG5B"}
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.checkTurboVideoStatus = checkTurboVideoStatus;
6
7
  exports.checkRegularVideoStatus = checkRegularVideoStatus;
7
8
  exports.checkAvatarVideoStatus = checkAvatarVideoStatus;
8
9
  const axios_1 = __importDefault(require("axios"));
@@ -11,6 +12,116 @@ const https_1 = __importDefault(require("https"));
11
12
  const types_1 = require("../../../../globals/types");
12
13
  const firebase_1 = require("../../../../libs/firebase");
13
14
  const logger_1 = require("../../../../utils/logger");
15
+ /**
16
+ * Download a finished Kling video and re-host it in GCS, returning a signed
17
+ * URL. Bounded retry + IPv4 pinning: Kling's CDN hostnames frequently resolve
18
+ * to an IPv6 PoP that is dead or geo-blocked for us, which surfaces as
19
+ * AggregateError(ETIMEDOUT) with both happy-eyeballs sockets failing.
20
+ *
21
+ * Extracted from checkAvatarVideoStatus, which had the hardened version. The
22
+ * regular (v1) poller still has its own unretried copy inline — left alone
23
+ * deliberately so this change doesn't touch a working prod path; it can adopt
24
+ * this helper in a separate commit.
25
+ */
26
+ async function stashVideoToGcs(videoUrl, outputFilePath, outputFilename, timeout, logContext) {
27
+ const file = (0, firebase_1.getBucket)().file(`${outputFilePath}/${outputFilename}.mp4`);
28
+ const maxAttempts = 3;
29
+ let lastErr;
30
+ let downloadHost = "unknown";
31
+ try {
32
+ downloadHost = new URL(videoUrl).host;
33
+ }
34
+ catch {
35
+ /* leave as unknown */
36
+ }
37
+ const v4Http = new http_1.default.Agent({ family: 4, keepAlive: true });
38
+ const v4Https = new https_1.default.Agent({ family: 4, keepAlive: true });
39
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
40
+ try {
41
+ const videoResp = await axios_1.default.get(videoUrl, {
42
+ responseType: "arraybuffer",
43
+ timeout,
44
+ httpAgent: v4Http,
45
+ httpsAgent: v4Https,
46
+ });
47
+ await file.save(Buffer.from(videoResp.data), { contentType: "video/mp4" });
48
+ const [signedUrl] = await file.getSignedUrl({
49
+ action: "read",
50
+ expires: "03-09-2491",
51
+ });
52
+ return signedUrl;
53
+ }
54
+ catch (err) {
55
+ lastErr = err;
56
+ const isErr = err instanceof Error;
57
+ logger_1.logger.warn("Kling post-success stash failed", {
58
+ ...logContext,
59
+ attempt,
60
+ maxAttempts,
61
+ downloadHost,
62
+ errName: isErr ? err.name : typeof err,
63
+ errCode: isErr ? err.code : undefined,
64
+ httpStatus: isErr ? err.response?.status : undefined,
65
+ msg: isErr ? err.message : String(err),
66
+ });
67
+ if (attempt < maxAttempts) {
68
+ await new Promise((r) => setTimeout(r, 2000 * 2 ** (attempt - 1)));
69
+ }
70
+ }
71
+ }
72
+ // Throw rather than returning FAILED: the generation SUCCEEDED and was
73
+ // billed; only our re-hosting failed. The outer TaskPoller retries the whole
74
+ // checkVideoStatus call with its own budget, so a transient GCS/CDN blip
75
+ // doesn't cost the user a video they already paid for.
76
+ throw lastErr instanceof Error
77
+ ? lastErr
78
+ : new Error(`Kling stash failed after ${maxAttempts} attempts`);
79
+ }
80
+ /**
81
+ * kling-3.0-turbo polling (Kling API 2.0). Separate from the v1 poller for
82
+ * three reasons, any one of which would break if the v1 path were reused:
83
+ * • the endpoint is GET /tasks?task_ids=<id>, not /v1/videos/<kind>/<id>
84
+ * • `data` is an ARRAY of tasks, not a single object
85
+ * • success is spelled "succeeded" here and "succeed" on v1
86
+ * It also means turbo needs no endpoint probing — one call, no 404 fan-out.
87
+ */
88
+ async function checkTurboVideoStatus(deps, { task, outputFilename, outputFilePath = "videos" }) {
89
+ const startTime = Date.now();
90
+ const result = await deps.request(`/tasks?task_ids=${encodeURIComponent(task)}`, "GET", undefined, undefined, undefined, "apiKey");
91
+ const taskData = result?.data?.[0];
92
+ logger_1.logger.info("Kling checkTurboVideoStatus polled", {
93
+ task,
94
+ durationMs: Date.now() - startTime,
95
+ status: taskData?.status,
96
+ statusMsg: taskData?.message || undefined,
97
+ });
98
+ if (!taskData) {
99
+ return {
100
+ status: types_1.EVideoSceneStatus.FAILED,
101
+ errorMessage: `Turbo task ${task} not found`,
102
+ };
103
+ }
104
+ if (taskData.status === "succeeded") {
105
+ const videoUrl = taskData.outputs?.find((o) => o.type === "video")?.url;
106
+ if (!videoUrl) {
107
+ return {
108
+ status: types_1.EVideoSceneStatus.FAILED,
109
+ errorMessage: "No video output in Kling turbo response",
110
+ };
111
+ }
112
+ const signedUrl = await stashVideoToGcs(videoUrl, outputFilePath, outputFilename, deps.generateTimeout, { task, surface: "turbo" });
113
+ return { videoUrl: signedUrl, status: types_1.EVideoSceneStatus.COMPLETED };
114
+ }
115
+ if (taskData.status === "failed") {
116
+ return {
117
+ status: types_1.EVideoSceneStatus.FAILED,
118
+ errorMessage: taskData.message ||
119
+ result.message ||
120
+ "Kling turbo task failed (no reason provided)",
121
+ };
122
+ }
123
+ return { status: types_1.EVideoSceneStatus.PENDING };
124
+ }
14
125
  async function checkRegularVideoStatus(deps, { task, outputFilename, outputFilePath = "videos" }) {
15
126
  const startTime = Date.now();
16
127
  // Try each Kling status endpoint in order until one returns non-404.
@@ -188,4 +188,75 @@ export interface KlingAvatarGenerateRequest {
188
188
  callback_url?: string;
189
189
  external_task_id?: string;
190
190
  }
191
+ export type KlingTurboResolution = "720p" | "1080p";
192
+ /** contents[] entry — API 2.0 folds prompt and image into one typed array. */
193
+ export interface KlingTurboContent {
194
+ type: "prompt" | "first_frame";
195
+ /** Set when type === "prompt". Max 2500 chars. */
196
+ text?: string;
197
+ /** Set when type === "first_frame". */
198
+ url?: string;
199
+ }
200
+ export interface KlingTurboSettings {
201
+ resolution?: KlingTurboResolution;
202
+ aspect_ratio?: KlingAspectRatio;
203
+ /** 3–15s inclusive. */
204
+ duration?: number;
205
+ }
206
+ export interface KlingTurboOptions {
207
+ callback_url?: string;
208
+ external_task_id?: string;
209
+ watermark_info?: {
210
+ enabled: boolean;
211
+ };
212
+ }
213
+ /** T2V body — prompt is a top-level string on this endpoint. */
214
+ export interface KlingTurboTextToVideoRequest {
215
+ prompt: string;
216
+ settings?: KlingTurboSettings;
217
+ options?: KlingTurboOptions;
218
+ }
219
+ /** I2V body — prompt AND image both travel inside contents[]. */
220
+ export interface KlingTurboImageToVideoRequest {
221
+ contents: KlingTurboContent[];
222
+ settings?: KlingTurboSettings;
223
+ options?: KlingTurboOptions;
224
+ }
225
+ /**
226
+ * API 2.0 task status. Note "succeeded" — the v1 surface spells the same state
227
+ * "succeed". Reusing the v1 comparison here would never match, and the scene
228
+ * would poll until it timed out.
229
+ */
230
+ export type KlingTurboTaskStatus = "submitted" | "processing" | "succeeded" | "failed";
231
+ export interface KlingTurboOutput {
232
+ type: "video" | "image" | "audio" | "element" | "voice";
233
+ id?: string;
234
+ url?: string;
235
+ watermark_url?: string;
236
+ duration?: string;
237
+ }
238
+ export interface KlingTurboTask {
239
+ id: string;
240
+ status: KlingTurboTaskStatus;
241
+ /** Failure reason when status === "failed" (e.g. risk-control rejection). */
242
+ message?: string;
243
+ create_time?: number;
244
+ update_time?: number;
245
+ external_id?: string;
246
+ outputs?: KlingTurboOutput[];
247
+ }
248
+ /** Submit response — a single task object under `data`. */
249
+ export interface KlingTurboSubmitResponse {
250
+ code: number;
251
+ message: string;
252
+ request_id: string;
253
+ data: KlingTurboTask;
254
+ }
255
+ /** GET /tasks response — `data` is an ARRAY (batch query is supported). */
256
+ export interface KlingTurboTasksResponse {
257
+ code: number;
258
+ message: string;
259
+ request_id: string;
260
+ data: KlingTurboTask[];
261
+ }
191
262
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/kling/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IAC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": "1.0.97",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "exports": {