@shop-os/modelkit 0.7.7 → 0.7.8

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/dist/index.cjs CHANGED
@@ -5267,8 +5267,10 @@ var RAY_RESOLUTIONS = ["360p", "720p", "1080p"];
5267
5267
  var RAY_PROMPT = { referenceSyntax: "numbered", maxChars: 6e3 };
5268
5268
  var LUMA_VIDEO_MODELS = [
5269
5269
  {
5270
- // https://docs.agents.lumalabs.ai: type "video" with a fixed 5 s duration;
5271
- // firstFrame and lastFrame ride as start_frame and end_frame.
5270
+ // https://docs.agents.lumalabs.ai: type "video" with a 5 s or 10 s duration;
5271
+ // firstFrame and lastFrame ride as start_frame and end_frame. Luma bills a
5272
+ // 10 s clip at 3x the 5 s price; pro-backend prices it that way, so this row
5273
+ // must not offer 10 s before that pricing is deployed (ENG-3324).
5272
5274
  id: "ray-3.2",
5273
5275
  aliases: [],
5274
5276
  label: "Ray 3.2",
@@ -5280,7 +5282,7 @@ var LUMA_VIDEO_MODELS = [
5280
5282
  constraints: {
5281
5283
  aspectRatios: ["adaptive", ...RAY_RATIOS],
5282
5284
  resolutions: [...RAY_RESOLUTIONS],
5283
- durations: [5],
5285
+ durations: [5, 10],
5284
5286
  supports: ["lastFrame"],
5285
5287
  prompt: { ...RAY_PROMPT },
5286
5288
  audio: "never"
@@ -5290,7 +5292,7 @@ var LUMA_VIDEO_MODELS = [
5290
5292
  pricingKind: "video_per_second",
5291
5293
  display: {
5292
5294
  provider: "luma",
5293
- description: "Luma Ray 3.2 text- and image-to-video with optional first and last frames, 5-second clips at up to 1080p.",
5295
+ description: "Luma Ray 3.2 text- and image-to-video with optional first and last frames, 5- or 10-second clips at up to 1080p.",
5294
5296
  logo: LUMA_LOGO2
5295
5297
  },
5296
5298
  capabilities: {}
@@ -14268,6 +14270,21 @@ function imageUsage2(ctx) {
14268
14270
  };
14269
14271
  }
14270
14272
  var GENERATE_SECONDS = 5;
14273
+ var GENERATE_LENGTHS = [5, 10];
14274
+ function generateSeconds(req) {
14275
+ return req.durationSeconds ?? GENERATE_SECONDS;
14276
+ }
14277
+ function checkGenerateSeconds(req, ctx) {
14278
+ const seconds3 = generateSeconds(req);
14279
+ if (GENERATE_LENGTHS.includes(seconds3)) return;
14280
+ throw new ModelKitError({
14281
+ code: "unsupported_option",
14282
+ message: `${ctx.model.id} renders ${GENERATE_LENGTHS.join(" or ")} s clips, not ${seconds3} s`,
14283
+ provider: "luma",
14284
+ model: ctx.model.id,
14285
+ retryable: false
14286
+ });
14287
+ }
14271
14288
  var MAX_PLAUSIBLE_SECONDS = 60;
14272
14289
  function editedSeconds(req, bytes) {
14273
14290
  const measured = mp4DurationSeconds(bytes);
@@ -14333,7 +14350,7 @@ function videoBody(req, ctx, mode) {
14333
14350
  prompt,
14334
14351
  video: {
14335
14352
  ...req.resolution !== void 0 && { resolution: req.resolution },
14336
- duration: "5s",
14353
+ duration: `${generateSeconds(req)}s`,
14337
14354
  ...req.firstFrame !== void 0 && { start_frame: imageRef(req.firstFrame) },
14338
14355
  ...req.lastFrame !== void 0 && { end_frame: imageRef(req.lastFrame) }
14339
14356
  }
@@ -14442,7 +14459,7 @@ function lumaVideoJob(ctx, req, mode, id) {
14442
14459
  if (mode === "generate") {
14443
14460
  const result2 = {
14444
14461
  video: { url, expiresAt: new Date(Date.now() + OUTPUT_URL_TTL_MS) },
14445
- usage: videoUsage4(jobCtx, req, mode, GENERATE_SECONDS),
14462
+ usage: videoUsage4(jobCtx, req, mode, generateSeconds(req)),
14446
14463
  raw: { id }
14447
14464
  };
14448
14465
  return result2;
@@ -14470,6 +14487,7 @@ async function generateLumaVideo(req, ctx) {
14470
14487
  });
14471
14488
  }
14472
14489
  const mode = lumaVideoMode(ctx);
14490
+ if (mode === "generate") checkGenerateSeconds(req, ctx);
14473
14491
  const created = await submitGeneration(ctx, videoBody(req, ctx, mode));
14474
14492
  return lumaVideoJob(ctx, req, mode, created.id);
14475
14493
  }