@koda-sl/baker-cli 0.149.0-dev.183ac88ea → 0.149.0-dev.328f015d3

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.
@@ -1119,6 +1119,7 @@ var OPENROUTER_IMAGE_SIZE = ["1K", "2K", "4K"];
1119
1119
  var OPENROUTER_IMAGE_SIZE_EXTENDED = ["0.5K", ...OPENROUTER_IMAGE_SIZE];
1120
1120
  var OPENROUTER_IMAGE_QUALITY = ["auto", "low", "medium", "high"];
1121
1121
  var SEEDANCE_DURATIONS = [4, 5, 6, 8, 10, 12, 15];
1122
+ var KLING_DURATIONS = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
1122
1123
  var ELEVENLABS_OUTPUT_FORMATS = [
1123
1124
  "mp3_22050_32",
1124
1125
  "mp3_44100_32",
@@ -1412,7 +1413,7 @@ var MODEL_REGISTRY = {
1412
1413
  prompt: { kind: "string" },
1413
1414
  negative_prompt: { kind: "string" },
1414
1415
  aspect_ratio: { kind: "string", enum: ["16:9", "9:16"] },
1415
- resolution: { kind: "string", enum: ["720p", "1080p"] },
1416
+ resolution: { kind: "string", enum: ["720p", "1080p", "4K"] },
1416
1417
  duration: { kind: "number", enum: [4, 6, 8] },
1417
1418
  seed: { kind: "number" },
1418
1419
  generate_audio: { kind: "boolean" },
@@ -1424,9 +1425,14 @@ var MODEL_REGISTRY = {
1424
1425
  "kwaivgi/kling-v3.0-pro": {
1425
1426
  // Motion-transfer / dynamic multi-shot beats. Reachable through the default
1426
1427
  // OpenRouter gateway (generic video body — no google-vertex block), so it
1427
- // needs no direct-provider exception. Cost is usage-based (known from the
1428
- // provider response), so it has no pre-flight cost estimate. `cfg_scale`
1429
- // trades prompt adherence vs motion freedom; higher = closer to prompt.
1428
+ // needs no direct-provider exception. `cfg_scale` trades prompt adherence
1429
+ // vs motion freedom; higher = closer to prompt.
1430
+ //
1431
+ // Params below are the ones OpenRouter actually advertises for this model
1432
+ // (GET /api/v1/videos/models). Three were wrong before and each was a free
1433
+ // 400 or a silently unsupported knob: it renders 720p ONLY (1080p was
1434
+ // offered and rejected), it takes ANY duration from 3-15s (we allowed just
1435
+ // 5 and 10), and it does not support `seed` at all.
1430
1436
  label: "Kling 3.0",
1431
1437
  inputs: [],
1432
1438
  optional_inputs: [{ kind: "image", mimes: OPENROUTER_IMAGE_MIMES }],
@@ -1436,10 +1442,9 @@ var MODEL_REGISTRY = {
1436
1442
  // over-length prompt fails validate (free) not the billed call.
1437
1443
  prompt: { kind: "string", maxLength: 2500 },
1438
1444
  negative_prompt: { kind: "string" },
1439
- aspect_ratio: { kind: "string", enum: ["1:1", "16:9", "9:16"] },
1440
- resolution: { kind: "string", enum: ["720p", "1080p"] },
1441
- duration: { kind: "number", enum: [5, 10] },
1442
- seed: { kind: "number" },
1445
+ aspect_ratio: { kind: "string", enum: ["16:9", "9:16", "1:1"] },
1446
+ resolution: { kind: "string", enum: ["720p"] },
1447
+ duration: { kind: "number", enum: KLING_DURATIONS },
1443
1448
  generate_audio: { kind: "boolean" },
1444
1449
  cfg_scale: { kind: "number", min: 0, max: 1 }
1445
1450
  }
@@ -1455,7 +1460,7 @@ var MODEL_REGISTRY = {
1455
1460
  prompt: { kind: "string" },
1456
1461
  negative_prompt: { kind: "string" },
1457
1462
  aspect_ratio: { kind: "string", enum: ["16:9", "9:16"] },
1458
- resolution: { kind: "string", enum: ["720p", "1080p"] },
1463
+ resolution: { kind: "string", enum: ["720p", "1080p", "4K"] },
1459
1464
  duration: { kind: "number", enum: [4, 6, 8] },
1460
1465
  seed: { kind: "number" },
1461
1466
  generate_audio: { kind: "boolean" },
@@ -1777,6 +1782,41 @@ function validateValue(key, value, schema, model) {
1777
1782
  }
1778
1783
  }
1779
1784
 
1785
+ // ../canvas-contract/src/videoCost.ts
1786
+ var CREDITS_PER_USD = 100;
1787
+ var SEEDANCE_USD_PER_SECOND = {
1788
+ "480p": 0.18,
1789
+ "720p": 0.5,
1790
+ "1080p": 0.62,
1791
+ "4k": 0.62
1792
+ };
1793
+ var DEFAULT_VIDEO_RESOLUTION = "720p";
1794
+ var DEFAULT_VIDEO_DURATION_S = 5;
1795
+ function isSeedanceModel(model) {
1796
+ return model.startsWith("bytedance/seedance");
1797
+ }
1798
+ var FALLBACK_USD_PER_SECOND = 0.5;
1799
+ function seedanceUsdPerSecond(resolution) {
1800
+ return SEEDANCE_USD_PER_SECOND[resolution ?? DEFAULT_VIDEO_RESOLUTION] ?? FALLBACK_USD_PER_SECOND;
1801
+ }
1802
+ var USD_PER_SECOND = {
1803
+ "kwaivgi/kling-v3.0-pro": { silent: 0.112, audio: 0.168 },
1804
+ "google/veo-3.1": { silent: 0.2, audio: 0.4 },
1805
+ "google/veo-3.1-fast": { silent: 0.1, audio: 0.12 }
1806
+ };
1807
+ function estimateVideoCostUsd({ model, duration, resolution, generateAudio }) {
1808
+ const seconds = duration ?? DEFAULT_VIDEO_DURATION_S;
1809
+ if (isSeedanceModel(model)) return seedanceUsdPerSecond(resolution) * seconds;
1810
+ const published = USD_PER_SECOND[model];
1811
+ if (published) return (generateAudio ? published.audio : published.silent) * seconds;
1812
+ const dearestKnownRate = Math.max(...Object.values(SEEDANCE_USD_PER_SECOND));
1813
+ return dearestKnownRate * seconds;
1814
+ }
1815
+ function estimateVideoCredits(input) {
1816
+ const credits = estimateVideoCostUsd(input) * CREDITS_PER_USD;
1817
+ return Math.ceil(Number(credits.toFixed(6)));
1818
+ }
1819
+
1780
1820
  // src/engine/lib/concurrency.ts
1781
1821
  var DEFAULT_CONCURRENCY = 8;
1782
1822
  function resolveConcurrency(...candidates) {
@@ -2573,7 +2613,7 @@ function looksLikeHttpUrl(value) {
2573
2613
  var VEO_PERSON_GENERATION = "allow_adult";
2574
2614
  var VEO_NEGATIVE_PROMPT = "subtitles, captions, on-screen text, watermark, logo, warped face, distorted hands, extra fingers, low quality";
2575
2615
  var VEO_DURATIONS = [4, 6, 8];
2576
- var KLING_DURATIONS = [5, 10];
2616
+ var KLING_DURATIONS2 = [5, 10];
2577
2617
  var KLING_NEGATIVE_PROMPT = "warped face, distorted hands, extra fingers, morphing, flicker, on-screen text, watermark, low quality";
2578
2618
  var KLING_CFG_SCALE = 0.7;
2579
2619
  var SPEAKS_PROSE = (line) => `The person speaks to camera; lip-sync follows the dialogue verbatim, with delivery and emotion carried in the wording itself (no bracketed cues). Dialogue: "${line}"`;
@@ -2619,7 +2659,7 @@ var KLING_PROFILE = {
2619
2659
  // Kling takes a negative_prompt PARAM instead (paramDefaults).
2620
2660
  keyframeInstruction: "Preserve the composition and colors of the first frame; animate the motion described.",
2621
2661
  wordBudget: 200,
2622
- durationSet: KLING_DURATIONS,
2662
+ durationSet: KLING_DURATIONS2,
2623
2663
  paramDefaults: { negative_prompt: KLING_NEGATIVE_PROMPT, cfg_scale: KLING_CFG_SCALE }
2624
2664
  };
2625
2665
  function clipProfileFor(modelId) {
@@ -7453,12 +7493,30 @@ var videoGenerateNode = delegated({
7453
7493
  inputs: z28.object({
7454
7494
  first_frame: ImageRef.optional(),
7455
7495
  last_frame: ImageRef.optional(),
7456
- reference: ImageRef.optional()
7496
+ reference: ImageRef.optional(),
7497
+ /**
7498
+ * Reference-to-video: several images the model uses as visual guidance
7499
+ * (this person, this product) instead of an exact opening frame. Mutually
7500
+ * exclusive with `first_frame` — OpenRouter treats a request carrying both
7501
+ * as image-to-video and ignores these, so wire one or the other.
7502
+ */
7503
+ references: z28.array(ImageRef).optional()
7457
7504
  }).loose(),
7458
7505
  params: VideoGenerateParams,
7459
7506
  outputs: z28.object({ video: VideoRef }).strict(),
7460
7507
  outputKinds: { video: "video" },
7461
- cost: () => ({ credits: 50, seconds_estimate: 120 })
7508
+ // Priced from the shared contract, so `validate`'s quote and the charge the
7509
+ // backend applies come from ONE table. A flat number here under-quoted a
7510
+ // 1080p 8s clip by ~10x, and the agent reads this out to the user as "this
7511
+ // will cost N" before spending it.
7512
+ cost: ({ params }) => ({
7513
+ credits: estimateVideoCredits({
7514
+ model: params.model,
7515
+ duration: params.duration,
7516
+ resolution: params.resolution
7517
+ }),
7518
+ seconds_estimate: 120
7519
+ })
7462
7520
  });
7463
7521
 
7464
7522
  // src/engine/nodes/remote/videoBackgroundRemove.ts
@@ -7941,4 +7999,4 @@ export {
7941
7999
  defaultRegistry,
7942
8000
  createEngineFromEnv
7943
8001
  };
7944
- //# sourceMappingURL=chunk-JBDSJZBZ.js.map
8002
+ //# sourceMappingURL=chunk-O3VYLCJK.js.map