@clipwright/core 0.75.0 → 0.75.1

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.
Files changed (2) hide show
  1. package/dist/prices.js +22 -9
  2. package/package.json +1 -1
package/dist/prices.js CHANGED
@@ -181,16 +181,18 @@ function buildPriceList(offer, diy) {
181
181
  const unit = EDIT_UNIT_PRICES;
182
182
  const parts = PARTS_FACE_TARIFF;
183
183
  const shotRates = parts.shotCreditsPerSecond ?? SHOT_CREDITS_PER_SECOND;
184
+ const shotLines = liveShots ? SHOT_ENGINES.flatMap((shot) => shotRates[shot] === undefined ? []
185
+ : [{ label: SHOT_ENGINE_LABELS[shot], unit: "face_second", credits: shotRates[shot] }]) : [];
186
+ const sceneLines = scenes ? [{ label: "scene made for the video", unit: "scene", credits: SCENE_CREDITS }] : [];
187
+ const musicLine = { label: "music under the voice", unit: "track", credits: MUSIC_BED_CREDITS };
184
188
  return [
185
189
  ...PRESENTER_ENGINES.map((engine) => paid({ tool: "make_ugc", route: "POST /v1/skills/make_ugc/run",
186
190
  variant: engine === "heygen" ? "HeyGen presenter" : "OmniHuman presenter", quote_tool: "quote_ugc", minimum_credits: parts.minimumCredits,
187
191
  lines: [{ label: PRESENTER_ENGINE_LABELS[engine], unit: "face_second", credits: parts.presenterCreditsPerSecond[engine] },
188
- ...(liveShots ? SHOT_ENGINES.flatMap((shot) => shotRates[shot] === undefined ? []
189
- : [{ label: SHOT_ENGINE_LABELS[shot], unit: "face_second", credits: shotRates[shot] }]) : []),
192
+ ...shotLines,
190
193
  { label: "production (voice and render)", unit: "second", credits: parts.productionCreditsPerSecond },
191
194
  { label: "live avatar on a call", unit: "still", credits: parts.liveAvatarStillCredits },
192
- ...(scenes ? [{ label: "scene made for the video", unit: "scene", credits: SCENE_CREDITS }] : []),
193
- { label: "music under the voice", unit: "track", credits: MUSIC_BED_CREDITS }],
195
+ ...sceneLines, musicLine],
194
196
  notes: "Short and long videos alike. Presenter seconds are the seconds a presenter take fills, covered by an insert, overlay, " +
195
197
  "window or template or not, counted once over the video and rounded up; the engine that renders each take sets its rate " +
196
198
  (engine === "heygen" ? "(today every take renders on HeyGen). " : "(no take renders on OmniHuman today). ") +
@@ -201,7 +203,9 @@ function buildPriceList(offer, diy) {
201
203
  ...(avatar6 ? [paid({ tool: "make_ugc", route: "POST /v1/skills/make_ugc/run", variant: "HeyGen Avatar 6 Turbo presenter",
202
204
  quote_tool: "quote_ugc", minimum_credits: PARTS_DURATION_TARIFF.minimumCredits,
203
205
  lines: [{ label: PRESENTER_ENGINE_LABELS.heygen_avatar6_turbo, unit: "face_second", credits: PRESENTER_CREDITS_PER_SECOND.heygen_avatar6_turbo },
204
- { label: "production (voice and render)", unit: "second", credits: PARTS_DURATION_TARIFF.productionCreditsPerSecond }],
206
+ ...shotLines,
207
+ { label: "production (voice and render)", unit: "second", credits: PARTS_DURATION_TARIFF.productionCreditsPerSecond },
208
+ ...sceneLines, musicLine],
205
209
  notes: "presenter_engine avatar6_turbo, the default of a 9:16 video, short or long, whose presenter picture is within 2% of 9:16, " +
206
210
  "with no call, interview, presenter_gaze or talking shot and no presenter part longer than about 36 s; any other video renders " +
207
211
  "on HeyGen Avatar IV. Presenter seconds are the seconds a presenter take fills, counted once over the video and rounded up; " +
@@ -315,6 +319,7 @@ const UNIT_TEXT = {
315
319
  };
316
320
  const LISTED_PRICES = 4;
317
321
  const RANGE_BASIS = { create_actor: "by quality and image kind" };
322
+ const ENGINE_PRICED = new Set(["make_ugc"]);
318
323
  export const priceText = (entry) => entry.lines.length === 0 ? entry.formula ?? "" :
319
324
  entry.lines.map(lineText).join(" plus ") + (entry.minimum_credits === null ? "" : `, at least ${entry.minimum_credits}`);
320
325
  const lineText = (line) => `${line.label === null ? "" : `${line.label} `}${line.credits} credits per ${UNIT_TEXT[line.unit]}`;
@@ -328,12 +333,20 @@ export function priceLine(tool, list) {
328
333
  ? [entry.lines[0].credits] : []));
329
334
  const rest = (entry) => JSON.stringify([entry.lines.slice(1), entry.minimum_credits]);
330
335
  const shared = entries.length > 1 && entries.every((entry) => entry.formula === null && entry.lines.length > 1 && rest(entry) === rest(first));
336
+ const production = (entry) => entry.lines.find((line) => line.unit === "second");
337
+ const base = (entry) => JSON.stringify([entry.lines[0]?.unit, production(entry), entry.minimum_credits]);
338
+ const engines = ENGINE_PRICED.has(tool) && entries.length > 1 &&
339
+ entries.every((entry) => entry.formula === null && production(entry) !== undefined && base(entry) === base(first));
331
340
  const text = unit !== undefined && single.length === entries.length && single.length > LISTED_PRICES
332
341
  ? `${Math.min(...single)} to ${Math.max(...single)} credits per ${UNIT_TEXT[unit]}, ${RANGE_BASIS[tool] ?? "by model and size"}`
333
- : shared
334
- ? `${entries.map((entry) => `${entry.variant === null ? "" : `${entry.variant}: `}${lineText(entry.lines[0])}`).join("; ")}; each plus ` +
335
- `${first.lines.slice(1).map(lineText).join(" plus ")}${first.minimum_credits === null ? "" : `, at least ${first.minimum_credits}`}`
336
- : entries.map((entry) => `${entry.variant === null ? "" : `${entry.variant}: `}${priceText(entry)}`).join("; ");
342
+ : engines
343
+ ? `starting at ${Math.min(...entries.map((entry) => entry.lines[0].credits))} credits per ${UNIT_TEXT[unit]}, by presenter engine, plus ` +
344
+ `${lineText(production(first))}${first.minimum_credits === null ? "" : `, at least ${first.minimum_credits}`}; ` +
345
+ "list_prices names each engine and add-on"
346
+ : shared
347
+ ? `${entries.map((entry) => `${entry.variant === null ? "" : `${entry.variant}: `}${lineText(entry.lines[0])}`).join("; ")}; each plus ` +
348
+ `${first.lines.slice(1).map(lineText).join(" plus ")}${first.minimum_credits === null ? "" : `, at least ${first.minimum_credits}`}`
349
+ : entries.map((entry) => `${entry.variant === null ? "" : `${entry.variant}: `}${priceText(entry)}`).join("; ");
337
350
  return `Price: ${text}. Quote first with ${first.quote_tool}.`;
338
351
  }
339
352
  export const withPriceLine = (tool, description, list) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipwright/core",
3
- "version": "0.75.0",
3
+ "version": "0.75.1",
4
4
  "description": "Zod schemas and the shared request/response contract of the Clipwright UGC video API",
5
5
  "repository": {
6
6
  "type": "git",