@clipwright/core 0.71.0 → 0.73.0

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 (83) hide show
  1. package/dist/ad-guide.js +3 -2
  2. package/dist/ads.js +2 -3
  3. package/dist/api-failure.d.ts +1 -4
  4. package/dist/api-failure.js +6 -16
  5. package/dist/assets.d.ts +6 -0
  6. package/dist/billing-terms.d.ts +12 -0
  7. package/dist/contract-dispositions.d.ts +19 -1
  8. package/dist/contract-dispositions.js +2 -0
  9. package/dist/contracts/v1/workflow-brief.d.ts +10 -0
  10. package/dist/contracts/v1/workflow-catalog.d.ts +10 -0
  11. package/dist/contracts/v1/workflow-client.d.ts +5 -0
  12. package/dist/contracts/v1/workflow-execution.d.ts +16 -0
  13. package/dist/contracts/v1/workflow-plan.d.ts +15 -0
  14. package/dist/contracts/v1/workflow-run-read.d.ts +11 -0
  15. package/dist/cuts.js +2 -2
  16. package/dist/edit-music.js +5 -5
  17. package/dist/endpoint-notes.js +2 -0
  18. package/dist/endpoints.js +3 -0
  19. package/dist/errors.d.ts +2 -29
  20. package/dist/errors.js +2 -13
  21. package/dist/face-billing.d.ts +11 -1
  22. package/dist/face-billing.js +5 -2
  23. package/dist/faceless-price.d.ts +1 -0
  24. package/dist/faceless-price.js +1 -0
  25. package/dist/faceless-public.d.ts +29 -1
  26. package/dist/faceless-public.js +12 -24
  27. package/dist/film-cut.d.ts +0 -4
  28. package/dist/film-cut.js +2 -4
  29. package/dist/film-drafts.d.ts +11 -0
  30. package/dist/film-drafts.js +8 -0
  31. package/dist/film-guide.d.ts +10 -49
  32. package/dist/film-guide.js +37 -3
  33. package/dist/generations-output.d.ts +5 -0
  34. package/dist/generations-output.js +2 -0
  35. package/dist/generations.d.ts +25 -0
  36. package/dist/generations.js +3 -1
  37. package/dist/idempotency.d.ts +1 -0
  38. package/dist/idempotency.js +7 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/index.js +3 -0
  41. package/dist/mascots.d.ts +110 -1
  42. package/dist/mascots.js +38 -1
  43. package/dist/mcp-ugc-descriptions.d.ts +1 -1
  44. package/dist/mcp-ugc-descriptions.js +1 -1
  45. package/dist/music.d.ts +1 -0
  46. package/dist/music.js +1 -0
  47. package/dist/openapi.js +13 -8
  48. package/dist/own-agent-price.d.ts +20 -3
  49. package/dist/own-agent-price.js +39 -8
  50. package/dist/own-agent-runs.d.ts +77 -23
  51. package/dist/own-agent-runs.js +26 -12
  52. package/dist/parts-pricing.d.ts +14 -5
  53. package/dist/parts-pricing.js +27 -14
  54. package/dist/presenter-engine.d.ts +17 -0
  55. package/dist/presenter-engine.js +35 -0
  56. package/dist/prices.d.ts +7 -3
  57. package/dist/prices.js +66 -20
  58. package/dist/reference-analysis.d.ts +47 -0
  59. package/dist/reference-analysis.js +7 -0
  60. package/dist/reference-display.js +3 -0
  61. package/dist/reference-film-kit.d.ts +43 -0
  62. package/dist/reference-film-kit.js +22 -0
  63. package/dist/render-backend.d.ts +1 -0
  64. package/dist/runs.d.ts +12 -0
  65. package/dist/skill-theme-explainer.js +3 -1
  66. package/dist/skill-theme.js +5 -0
  67. package/dist/skills.d.ts +58 -1
  68. package/dist/skills.js +70 -33
  69. package/dist/upscale.d.ts +120 -0
  70. package/dist/upscale.js +116 -0
  71. package/dist/voice-admission.d.ts +14 -0
  72. package/dist/voice-admission.js +9 -0
  73. package/dist/voice-listing.js +1 -1
  74. package/dist/voices.d.ts +1 -0
  75. package/dist/workflows/methods/faceless-explainer.d.ts +2 -0
  76. package/dist/workflows/methods/kinetic-launch.d.ts +4 -0
  77. package/dist/workflows/methods/product-image-story.d.ts +2 -0
  78. package/dist/workflows/methods/reference-remake.d.ts +2 -0
  79. package/dist/workflows/methods/shared.d.ts +2 -0
  80. package/dist/workflows/methods/ugc-faq-answer.d.ts +2 -0
  81. package/dist/workflows/methods/ugc-product-intro.d.ts +2 -0
  82. package/dist/workflows/methods/website-proof-demo.d.ts +4 -0
  83. package/package.json +1 -1
@@ -16,6 +16,8 @@ export declare const TAKE_CHECKS_QUOTE_PATH = "/v1/take-checks/quote";
16
16
  export declare const TAKE_CHECKS_PATH = "/v1/take-checks";
17
17
  export declare const FILM_RUN_PATH = "/v1/film-runs/:id";
18
18
  export declare const OWN_AGENT_FILM_TASK = "own-agent-film";
19
+ export declare const OWN_AGENT_CUT_TASK = "own-agent-cut";
20
+ export declare const OWN_AGENT_CUT_PREVIEW_TASK = "own-agent-cut-preview";
19
21
  export declare const FILM_STILL_FPS = 30, FILM_RENDER_FPS = 25;
20
22
  export declare const FILM_STILL_ANCHOR_LAG_SEC = 0.25;
21
23
  export declare const FILM_TAIL_SEC = 0.8;
@@ -36,34 +38,18 @@ export declare const filmStillsInput: z.ZodObject<{
36
38
  occurrence: z.ZodOptional<z.ZodNumber>;
37
39
  }, z.core.$strict>]>;
38
40
  }, z.core.$strict>>>;
41
+ scene_video: z.ZodOptional<z.ZodObject<{
42
+ asset_id: z.ZodOptional<z.ZodString>;
43
+ run_id: z.ZodOptional<z.ZodString>;
44
+ from: z.ZodDefault<z.ZodNumber>;
45
+ }, z.core.$strict>>;
39
46
  max_credits: z.ZodOptional<z.ZodNumber>;
40
47
  }, z.core.$strict>;
41
48
  export type FilmStillsInput = z.infer<typeof filmStillsInput>;
42
49
  export type FilmStillsRequest = z.input<typeof filmStillsInput>;
43
50
  export declare const filmVoiceInput: z.ZodObject<{
44
51
  text: z.ZodString;
45
- voice: z.ZodOptional<z.ZodEnum<{
46
- narrator_en_brisk_man: "narrator_en_brisk_man";
47
- narrator_en_deep_gentleman: "narrator_en_deep_gentleman";
48
- narrator_en_firm_lady: "narrator_en_firm_lady";
49
- narrator_en_gentle_man: "narrator_en_gentle_man";
50
- narrator_en_kind_girl: "narrator_en_kind_girl";
51
- narrator_en_storyteller: "narrator_en_storyteller";
52
- narrator_en_wise_lady: "narrator_en_wise_lady";
53
- narrator_es_serene_woman: "narrator_es_serene_woman";
54
- narrator_es_storyteller: "narrator_es_storyteller";
55
- narrator_fr_classic_man: "narrator_fr_classic_man";
56
- narrator_it_calm_woman: "narrator_it_calm_woman";
57
- narrator_it_classic_man: "narrator_it_classic_man";
58
- narrator_pt_storyteller: "narrator_pt_storyteller";
59
- narrator_pt_wise_lady: "narrator_pt_wise_lady";
60
- narrator_ru_ambitious_woman: "narrator_ru_ambitious_woman";
61
- narrator_ru_bright_queen: "narrator_ru_bright_queen";
62
- narrator_ru_deep_man: "narrator_ru_deep_man";
63
- narrator_ru_reliable_man: "narrator_ru_reliable_man";
64
- narrator_tr_confident_woman: "narrator_tr_confident_woman";
65
- narrator_tr_mature_man: "narrator_tr_mature_man";
66
- }>>;
52
+ voice: z.ZodOptional<z.ZodString>;
67
53
  cut_id: z.ZodOptional<z.ZodString>;
68
54
  max_credits: z.ZodOptional<z.ZodNumber>;
69
55
  }, z.core.$strict>;
@@ -82,6 +68,72 @@ export declare const filmRenderInput: z.ZodObject<{
82
68
  occurrence: z.ZodOptional<z.ZodNumber>;
83
69
  }, z.core.$strict>]>;
84
70
  }, z.core.$strict>>>;
71
+ scene_video: z.ZodOptional<z.ZodObject<{
72
+ asset_id: z.ZodOptional<z.ZodString>;
73
+ run_id: z.ZodOptional<z.ZodString>;
74
+ from: z.ZodDefault<z.ZodNumber>;
75
+ }, z.core.$strict>>;
76
+ music: z.ZodOptional<z.ZodObject<{
77
+ track: z.ZodOptional<z.ZodEnum<{
78
+ acoustic_calm: "acoustic_calm";
79
+ acoustic_driving: "acoustic_driving";
80
+ acoustic_piano: "acoustic_piano";
81
+ ambient_calm: "ambient_calm";
82
+ ambient_driving: "ambient_driving";
83
+ ambient_medium: "ambient_medium";
84
+ ambient_shimmer: "ambient_shimmer";
85
+ beauty_dreamy: "beauty_dreamy";
86
+ beauty_driving: "beauty_driving";
87
+ beauty_medium: "beauty_medium";
88
+ bright_pop: "bright_pop";
89
+ cinematic_calm: "cinematic_calm";
90
+ cinematic_driving: "cinematic_driving";
91
+ cinematic_medium: "cinematic_medium";
92
+ cinematic_tension: "cinematic_tension";
93
+ corporate_bright: "corporate_bright";
94
+ corporate_calm: "corporate_calm";
95
+ corporate_driving: "corporate_driving";
96
+ corporate_medium: "corporate_medium";
97
+ fashion_calm: "fashion_calm";
98
+ fashion_disco: "fashion_disco";
99
+ fashion_driving: "fashion_driving";
100
+ fashion_luxe: "fashion_luxe";
101
+ food_bossa: "food_bossa";
102
+ food_calm: "food_calm";
103
+ food_driving: "food_driving";
104
+ food_medium: "food_medium";
105
+ hiphop_calm: "hiphop_calm";
106
+ hiphop_driving: "hiphop_driving";
107
+ hiphop_funky: "hiphop_funky";
108
+ hiphop_medium: "hiphop_medium";
109
+ lofi_calm: "lofi_calm";
110
+ lofi_jazzy: "lofi_jazzy";
111
+ lofi_medium: "lofi_medium";
112
+ lofi_rainy: "lofi_rainy";
113
+ luxe_cinematic: "luxe_cinematic";
114
+ playful_calm: "playful_calm";
115
+ playful_cartoon: "playful_cartoon";
116
+ playful_quirky: "playful_quirky";
117
+ runway_house: "runway_house";
118
+ sport_calm: "sport_calm";
119
+ sport_drive: "sport_drive";
120
+ sport_epic: "sport_epic";
121
+ sport_medium: "sport_medium";
122
+ tech_calm: "tech_calm";
123
+ tech_driving: "tech_driving";
124
+ tech_future: "tech_future";
125
+ tech_minimal: "tech_minimal";
126
+ tech_synthwave: "tech_synthwave";
127
+ warm_acoustic: "warm_acoustic";
128
+ }>>;
129
+ generate: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodObject<{
130
+ mood: z.ZodString;
131
+ }, z.core.$strict>]>>;
132
+ volume: z.ZodDefault<z.ZodNumber>;
133
+ at: z.ZodDefault<z.ZodNumber>;
134
+ fade_out: z.ZodDefault<z.ZodNumber>;
135
+ duck: z.ZodOptional<z.ZodBoolean>;
136
+ }, z.core.$strict>>;
85
137
  max_credits: z.ZodOptional<z.ZodNumber>;
86
138
  }, z.core.$strict>;
87
139
  export type FilmRenderInput = z.infer<typeof filmRenderInput>;
@@ -292,6 +344,7 @@ export declare const takeCheckInput: z.ZodObject<{
292
344
  fashion: "fashion";
293
345
  product: "product";
294
346
  }>>;
347
+ speed: z.ZodOptional<z.ZodBoolean>;
295
348
  max_credits: z.ZodOptional<z.ZodNumber>;
296
349
  }, z.core.$strict>;
297
350
  export type TakeCheckInput = z.infer<typeof takeCheckInput>;
@@ -392,10 +445,11 @@ export declare const filmHeroInput: z.ZodObject<{
392
445
  script: z.ZodOptional<z.ZodString>;
393
446
  voice_run_id: z.ZodOptional<z.ZodString>;
394
447
  mascot_id: z.ZodOptional<z.ZodString>;
448
+ head: z.ZodOptional<z.ZodBoolean>;
395
449
  max_credits: z.ZodOptional<z.ZodNumber>;
396
450
  }, z.core.$strict>;
397
451
  export type FilmHeroInput = z.infer<typeof filmHeroInput>;
398
- export declare function ownVoiceCeilingSeconds(text: string): number;
452
+ export declare function ownVoiceCeilingSeconds(text: string, tempo?: number): number;
399
453
  export declare const ownFilmFrames: (voiceSeconds: number) => number;
400
454
  export declare const ownFilmSeconds: (voiceSeconds: number) => number;
401
455
  export declare const ownAgentQuoteLine: z.ZodObject<{
@@ -5,13 +5,13 @@ import { cutId } from "./cut-ids.js";
5
5
  import { diyBlocked, diyNext } from "./diy-next.js";
6
6
  import { editMusic } from "./edit-music.js";
7
7
  import { EXPLAINER_MAX_PRODUCT_PICTURES, facelessCustomerSceneImage, qualifiedImageUrl } from "./faceless-public.js";
8
- import { FACELESS_VOICE_NAMES } from "./faceless-voices.js";
9
8
  import { filmCutPicture } from "./film-cut.js";
10
- import { filmDraftId } from "./film-drafts.js";
9
+ import { filmDraftId, filmSceneVideo } from "./film-drafts.js";
11
10
  import { MASCOT_POSES } from "./mascots.js";
12
11
  import { maxCreditsField } from "./max-credits.js";
13
12
  import { OWN_AGENT_SKILLS, OWN_FREE_STILLS, OWN_FREE_STILLS_WINDOW_HOURS, OWN_STILLS_MAX_PER_CALL, OWN_STILLS_SINGLE_MAX, OWN_VOICE_MAX_SECONDS } from "./own-agent-price.js";
14
13
  import { runId } from "./runs.js";
14
+ import { VOICE_NAME_PATTERN } from "./voices.js";
15
15
  export const FILM_STILLS_QUOTE_PATH = "/v1/film-stills/quote";
16
16
  export const FILM_STILLS_PATH = "/v1/film-stills";
17
17
  export const FILM_VOICES_QUOTE_PATH = "/v1/film-voices/quote";
@@ -28,6 +28,8 @@ export const TAKE_CHECKS_QUOTE_PATH = "/v1/take-checks/quote";
28
28
  export const TAKE_CHECKS_PATH = "/v1/take-checks";
29
29
  export const FILM_RUN_PATH = "/v1/film-runs/:id";
30
30
  export const OWN_AGENT_FILM_TASK = "own-agent-film";
31
+ export const OWN_AGENT_CUT_TASK = "own-agent-cut";
32
+ export const OWN_AGENT_CUT_PREVIEW_TASK = "own-agent-cut-preview";
31
33
  export const FILM_STILL_FPS = 30, FILM_RENDER_FPS = 25;
32
34
  export const FILM_STILL_ANCHOR_LAG_SEC = 0.25;
33
35
  export const FILM_TAIL_SEC = 0.8;
@@ -46,11 +48,15 @@ export const filmStillsInput = z.strictObject({
46
48
  sheet: z.boolean().default(false)
47
49
  .describe(`Also tile the stills, in order, into one picture (3 across); always on for more than ${OWN_STILLS_SINGLE_MAX} stills`),
48
50
  scene_images: sceneImages,
51
+ scene_video: filmSceneVideo.optional(),
49
52
  max_credits: maxCreditsField,
50
53
  });
51
54
  export const filmVoiceInput = z.strictObject({
52
55
  text: z.string().trim().min(1).max(OWN_VOICE_MAX_CHARS).describe("The script, spoken exactly as written"),
53
- voice: z.enum(FACELESS_VOICE_NAMES).optional().describe("A narrator (list_voices with skill=make_faceless); the fastest of the script's language when omitted"),
56
+ voice: z.string({ error: "voice must be a voice name from list_voices, as a string" })
57
+ .regex(VOICE_NAME_PATTERN, "voice is not a voice name: take one from list_voices with skill=make_faceless").optional()
58
+ .describe("A narrator (list_voices with skill=make_faceless); the fastest of the script's language when omitted. The API refuses a name " +
59
+ "list_voices does not return, before any charge"),
54
60
  cut_id: cutId.optional().describe("The cut record this voice is for: the record then names it as its voice and says what comes next"),
55
61
  max_credits: maxCreditsField,
56
62
  });
@@ -59,6 +65,9 @@ export const filmRenderInput = z.strictObject({
59
65
  revision: z.number().int().min(0).describe("The draft revision to render; a draft that moved on is refused with 409"),
60
66
  voice_run_id: runId.describe("A delivered make_voice run of this account: the film is cut to its length and its words time the captions"),
61
67
  scene_images: sceneImages,
68
+ scene_video: filmSceneVideo.optional(),
69
+ music: editMusic.optional().describe("Music under the film from at to the end: a library track (free) or one made for the film (paid on " +
70
+ "delivery); under the voice it plays lower"),
62
71
  max_credits: maxCreditsField,
63
72
  });
64
73
  export const FILM_EDIT_WIDTH = 720, FILM_EDIT_HEIGHT = 1280, FILM_EDIT_FPS = 25;
@@ -78,11 +87,10 @@ const editClip = z.strictObject({
78
87
  "words. speech and volume say how it sits in the mix"),
79
88
  speech: z.boolean().optional().describe("With sound: true. true: the window's sound is someone speaking, so it plays at the level of " +
80
89
  "speech and the music goes lower under it as under the voice. false: room sound or effects, which never lower the music. Omitted: " +
81
- "what the clip's latest check_take heard, else false"),
90
+ "what the clip's latest check_take heard, if one ran, else false"),
82
91
  volume: z.number().min(EDIT_CLIP_MIN_VOLUME_DB).max(EDIT_CLIP_MAX_VOLUME_DB).optional()
83
92
  .describe("With sound: true. dB from the level the edit gives this window's sound: 0 (the default) near the voice, -10 well under it"),
84
- slot: adSlotId.optional().describe("With ad_id: the slot of the ad this clip fills. A clip made with generate_video must have passed " +
85
- "check_take in that slot; your own footage needs no check"),
93
+ slot: adSlotId.optional().describe("With ad_id: the slot of the ad this clip fills"),
86
94
  }).refine(clip => (clip.run_id === undefined) !== (clip.asset_id === undefined), "name the clip by run_id or by asset_id, one of them")
87
95
  .refine(clip => clip.to > clip.from, "to must be after from")
88
96
  .refine(clip => clip.sound !== true || clip.run_id !== undefined, { path: ["sound"], message: "a clip's own sound is kept only from a generate_video run made with audio: true" })
@@ -141,8 +149,7 @@ export const filmEditInput = z.strictObject({
141
149
  ambience: editAmbience.optional().describe("Free: the place's quiet room sound, a stretch of one of your clips' own sound repeated " +
142
150
  "smoothly under the whole cut whatever its windows and their speed, so every window can play silent and sped up. It never lowers the " +
143
151
  "music and the voice stays on top of it; it goes with a voice, music or a clip's own sound"),
144
- ad_id: adId.optional().describe("The ad record this cut belongs to: every clip then names its slot, and a clip made with generate_video " +
145
- "that has not passed check_take in its slot is refused before any credits, unless the slot is people_only; your own footage needs no check"),
152
+ ad_id: adId.optional().describe("The ad record this cut belongs to: every clip then names its slot"),
146
153
  max_credits: maxCreditsField,
147
154
  }).refine(edit => edit.ad_id !== undefined || edit.clips.every(clip => clip.slot === undefined), "a clip's slot needs ad_id")
148
155
  .refine(edit => edit.ad_id === undefined || edit.clips.every(clip => clip.slot !== undefined), "with ad_id, every clip names its slot");
@@ -187,7 +194,7 @@ export const pictureTakeAsk = z.strictObject({
187
194
  locks: z.array(words(200)).max(TAKE_PICTURE_MAX_LOCKS).default([]).describe("What must stay as the picture shows it"),
188
195
  });
189
196
  const hexColour = z.string().regex(/^#[0-9a-fA-F]{6}$/, "a colour is #RRGGBB");
190
- const PICTURE_ONLY = ["look", "picture", "cut_id"], MOTION_ONLY = ["product_image", "moves", "format", "ad_id"];
197
+ const PICTURE_ONLY = ["look", "picture", "cut_id"], MOTION_ONLY = ["product_image", "moves", "format", "ad_id", "speed"];
191
198
  export const takeCheckInput = z.strictObject({
192
199
  ...takeSource,
193
200
  against: z.enum(TAKE_CHECK_AGAINST).optional().describe("motion (an ad shot, the default) or picture: the take against the picture it was " +
@@ -210,6 +217,7 @@ export const takeCheckInput = z.strictObject({
210
217
  slot: adSlotId.optional().describe("With ad_id or cut_id: the slot of the record this take is for; on a cut record, a slot that needs a take"),
211
218
  format: z.enum(TAKE_MOTION_FORMATS).optional().describe("What the take's motion is measured against: fashion (people and clothes in " +
212
219
  "motion: fashion, lifestyle, sport) or product (a product worked in the hands); omitted, product"),
220
+ speed: z.boolean().optional().describe("true: also look for things hanging in the air (slow motion), same price; off by default"),
213
221
  max_credits: maxCreditsField,
214
222
  }).refine(oneTake, ONE_TAKE)
215
223
  .superRefine((v, ctx) => {
@@ -268,11 +276,17 @@ export const filmHeroInput = z.strictObject({
268
276
  voice_run_id: runId.optional().describe("With no character and no script: a delivered make_voice run of this account, whose text is the script"),
269
277
  mascot_id: assetId.optional().describe("Alone, instead of the fields above: a saved mascot of this account (list_assets with mascot true) that lacks " +
270
278
  "poses. Only the poses it lacks are drawn, in its look, and added to it, so the same mascot_id then has them"),
279
+ head: z.boolean().optional().describe("true with character_reference, your own photo saved as an asset with rights_confirmed (create_asset) or " +
280
+ "your actor's picture (list_actors): draws only the head as a cartoon that talks, blinks, " +
281
+ "smiles, looks surprised and looks aside, saved as a mascot whose mascot_id a film's actor wears; one price per head, charged only when the " +
282
+ "head is saved with all its pictures"),
271
283
  max_credits: maxCreditsField,
272
284
  }).refine(value => value.mascot_id !== undefined || FILM_HERO_SOURCE_FIELDS.some(field => value[field] !== undefined), "name the hero with character_reference or character_details, pass script or voice_run_id, or pass mascot_id")
273
- .refine(value => value.mascot_id === undefined || FILM_HERO_SOURCE_FIELDS.every(field => value[field] === undefined), `mascot_id completes a saved mascot and takes no other field: drop ${FILM_HERO_SOURCE_FIELDS.join(", ")}`);
274
- export function ownVoiceCeilingSeconds(text) {
275
- return Math.ceil(text.length / OWN_VOICE_SLOWEST_CHARS_PER_SECOND) + 2;
285
+ .refine(value => value.mascot_id === undefined || FILM_HERO_SOURCE_FIELDS.every(field => value[field] === undefined), `mascot_id completes a saved mascot and takes no other field: drop ${FILM_HERO_SOURCE_FIELDS.join(", ")}`)
286
+ .refine(value => value.head !== true || (value.character_reference !== undefined && value.script === undefined
287
+ && value.voice_run_id === undefined && value.mascot_id === undefined), "head is drawn from character_reference (with character_details if you like): pass it, and drop script, voice_run_id and mascot_id");
288
+ export function ownVoiceCeilingSeconds(text, tempo = 1) {
289
+ return Math.ceil(text.length / (OWN_VOICE_SLOWEST_CHARS_PER_SECOND * tempo)) + 2;
276
290
  }
277
291
  export const ownFilmFrames = (voiceSeconds) => Math.ceil((voiceSeconds + FILM_TAIL_SEC) * FILM_RENDER_FPS);
278
292
  export const ownFilmSeconds = (voiceSeconds) => +(ownFilmFrames(voiceSeconds) / FILM_RENDER_FPS).toFixed(2);
@@ -1,17 +1,18 @@
1
1
  import { z } from "zod";
2
- import { type FaceBillingInterval, type PartsFaceTariff, type PresenterEngine, type ShotEngine, type TakeEngine } from "./face-billing.js";
2
+ import { type FaceBillingInterval, type PartsFaceTariff, type ShortPresenterEngine, type ShotEngine, type TakeEngine } from "./face-billing.js";
3
3
  import type { Resolution } from "./skills.js";
4
- export declare const PARTS_PRICING_VERSION = "parts-v2";
5
- export declare const PRESENTER_CREDITS_PER_SECOND: Readonly<Record<PresenterEngine, number>>;
4
+ export declare const PARTS_PRICING_VERSION = "parts-v5";
5
+ export declare const PRESENTER_CREDITS_PER_SECOND: Readonly<Record<ShortPresenterEngine, number>>;
6
6
  export declare const PRODUCTION_CREDITS_PER_SECOND = 1;
7
7
  export declare const LIVE_AVATAR_STILL_CREDITS = 400;
8
8
  export declare const DELIVERED_VIDEO_MINIMUM_CREDITS = 50;
9
9
  export declare const SCENE_CREDITS = 25;
10
- export declare const PRESENTER_ENGINE_LABELS: Readonly<Record<PresenterEngine, string>>;
10
+ export declare const PRESENTER_ENGINE_LABELS: Readonly<Record<ShortPresenterEngine, string>>;
11
11
  type MethodShotEngine = "shot_omni" | "shot_seedance" | "shot_omni_no_text" | "shot_seedance_no_text";
12
12
  export declare const METHOD_SHOT_CREDITS_PER_SECOND: Readonly<Record<Exclude<Resolution, "4k">, Readonly<Record<MethodShotEngine, number>>>>;
13
13
  export declare const SHOT_CREDITS_PER_SECOND: Readonly<Record<ShotEngine, number>>;
14
14
  export declare const SHOT_ENGINE_LABELS: Readonly<Record<ShotEngine, string>>;
15
+ export declare const PARTS_V2_FACE_TARIFF: PartsFaceTariff;
15
16
  export declare const PARTS_FACE_TARIFF: PartsFaceTariff;
16
17
  export declare const PARTS_OMNI_PRICING_VERSION = "parts-v3";
17
18
  export declare const PARTS_OMNI_FACE_TARIFF: PartsFaceTariff;
@@ -24,12 +25,18 @@ export declare const durationPartsTariffSchema: z.ZodReadonly<z.ZodObject<{
24
25
  presenterCreditsPerSecond: z.ZodReadonly<z.ZodObject<{
25
26
  heygen: z.ZodNumber;
26
27
  omnihuman: z.ZodNumber;
28
+ heygen_avatar6_turbo: z.ZodOptional<z.ZodNumber>;
27
29
  }, z.core.$strict>>;
28
30
  productionCreditsPerSecond: z.ZodNumber;
29
31
  minimumCredits: z.ZodNumber;
32
+ presenterEngine: z.ZodOptional<z.ZodEnum<{
33
+ heygen: "heygen";
34
+ heygen_avatar6_turbo: "heygen_avatar6_turbo";
35
+ }>>;
30
36
  }, z.core.$strict>>;
31
37
  export type DurationPartsTariff = z.infer<typeof durationPartsTariffSchema>;
32
38
  export declare const PARTS_DURATION_TARIFF: DurationPartsTariff;
39
+ export declare function durationPartsTariffFor(engine: "heygen" | "heygen_avatar6_turbo"): DurationPartsTariff;
33
40
  export declare const partsLineSchema: z.ZodObject<{
34
41
  label: z.ZodString;
35
42
  unit: z.ZodEnum<{
@@ -61,7 +68,9 @@ export interface PartsMeasure {
61
68
  liveAvatarStills: number;
62
69
  }
63
70
  export declare function calculatePartsCharge(measure: PartsMeasure, tariffInput: PartsFaceTariff, delivered: boolean): PartsCharge;
64
- export declare function calculateDurationPartsCharge(durationSec: number, engine: PresenterEngine, tariffInput: DurationPartsTariff, delivered: boolean, heldSec?: number): PartsCharge;
71
+ export declare const PRODUCTION_LINE = "production (voice and render)";
72
+ export declare const PRODUCTION_RENDER_LINE = "production (render)";
73
+ export declare function calculateDurationPartsCharge(durationSec: number, engine: ShortPresenterEngine, tariffInput: DurationPartsTariff, delivered: boolean, heldSec?: number, deliveredVoice?: boolean): PartsCharge;
65
74
  export declare const partsBillingSummarySchema: z.ZodReadonly<z.ZodObject<{
66
75
  pricingVersion: z.ZodString;
67
76
  lines: z.ZodArray<z.ZodObject<{
@@ -1,14 +1,16 @@
1
1
  import { z } from "zod";
2
- import { identifier, partsFaceTariffSchema, presenterRatesSchema, PRESENTER_ENGINES, SHOT_ENGINES, } from "./face-billing.js";
2
+ import { identifier, partsFaceTariffSchema, presenterRatesSchema, SHORT_PRESENTER_ENGINES, TAKE_ENGINES, } from "./face-billing.js";
3
3
  import { unionFaceFrames } from "./long-form-pricing.js";
4
- export const PARTS_PRICING_VERSION = "parts-v2";
5
- export const PRESENTER_CREDITS_PER_SECOND = Object.freeze({ heygen: 9, omnihuman: 22 });
4
+ export const PARTS_PRICING_VERSION = "parts-v5";
5
+ export const PRESENTER_CREDITS_PER_SECOND = Object.freeze({ heygen: 10, omnihuman: 22,
6
+ heygen_avatar6_turbo: 12 });
7
+ const PARTS_V2_PRESENTER_CREDITS_PER_SECOND = Object.freeze({ heygen: 9, omnihuman: 22 });
6
8
  export const PRODUCTION_CREDITS_PER_SECOND = 1;
7
9
  export const LIVE_AVATAR_STILL_CREDITS = 400;
8
10
  export const DELIVERED_VIDEO_MINIMUM_CREDITS = 50;
9
11
  export const SCENE_CREDITS = 25;
10
12
  export const PRESENTER_ENGINE_LABELS = Object.freeze({
11
- heygen: "presenter, HeyGen Avatar IV", omnihuman: "presenter, OmniHuman 2.0",
13
+ heygen: "presenter, HeyGen Avatar IV", omnihuman: "presenter, OmniHuman 2.0", heygen_avatar6_turbo: "presenter, HeyGen Avatar 6 Turbo",
12
14
  });
13
15
  export const METHOD_SHOT_CREDITS_PER_SECOND = Object.freeze({
14
16
  "720p": Object.freeze({ shot_omni: 20, shot_omni_no_text: 12, shot_seedance: 89, shot_seedance_no_text: 42 }),
@@ -22,14 +24,16 @@ export const SHOT_ENGINE_LABELS = Object.freeze({
22
24
  shot_omni_no_text: "live shot, Gemini Omni 1.2, no text in frame", shot_seedance_no_text: "live shot, Seedance 2.5, no text in frame",
23
25
  });
24
26
  const TAKE_ENGINE_LABELS = { ...PRESENTER_ENGINE_LABELS, ...SHOT_ENGINE_LABELS };
25
- export const PARTS_FACE_TARIFF = Object.freeze({
26
- version: 3, pricingVersion: PARTS_PRICING_VERSION, presenterCreditsPerSecond: PRESENTER_CREDITS_PER_SECOND,
27
+ export const PARTS_V2_FACE_TARIFF = Object.freeze({
28
+ version: 3, pricingVersion: "parts-v2", presenterCreditsPerSecond: PARTS_V2_PRESENTER_CREDITS_PER_SECOND,
27
29
  shotCreditsPerSecond: Object.freeze({ shot_talking_action: SHOT_CREDITS_PER_SECOND.shot_talking_action, shot_action: SHOT_CREDITS_PER_SECOND.shot_action }),
28
30
  productionCreditsPerSecond: PRODUCTION_CREDITS_PER_SECOND, liveAvatarStillCredits: LIVE_AVATAR_STILL_CREDITS,
29
31
  minimumCredits: DELIVERED_VIDEO_MINIMUM_CREDITS, rounding: "ceil_aggregate_seconds", failurePolicy: "verified_delivery_only",
30
32
  });
33
+ export const PARTS_FACE_TARIFF = Object.freeze({ ...PARTS_V2_FACE_TARIFF, pricingVersion: PARTS_PRICING_VERSION,
34
+ presenterCreditsPerSecond: PRESENTER_CREDITS_PER_SECOND });
31
35
  export const PARTS_OMNI_PRICING_VERSION = "parts-v3";
32
- export const PARTS_OMNI_FACE_TARIFF = Object.freeze({ ...PARTS_FACE_TARIFF, pricingVersion: PARTS_OMNI_PRICING_VERSION,
36
+ export const PARTS_OMNI_FACE_TARIFF = Object.freeze({ ...PARTS_V2_FACE_TARIFF, pricingVersion: PARTS_OMNI_PRICING_VERSION,
33
37
  shotCreditsPerSecond: Object.freeze({ shot_talking_action: SHOT_CREDITS_PER_SECOND.shot_talking_action,
34
38
  shot_action: SHOT_CREDITS_PER_SECOND.shot_action, shot_omni: SHOT_CREDITS_PER_SECOND.shot_omni }) });
35
39
  export const PARTS_METHOD_PRICING_VERSION = "parts-v4";
@@ -46,11 +50,15 @@ export const durationPartsTariffSchema = z.object({
46
50
  presenterCreditsPerSecond: presenterRatesSchema,
47
51
  productionCreditsPerSecond: z.number().int().nonnegative().max(2_147_483_647),
48
52
  minimumCredits: z.number().int().nonnegative().max(2_147_483_647),
53
+ presenterEngine: z.enum(["heygen", "heygen_avatar6_turbo"]).optional(),
49
54
  }).strict().readonly();
50
55
  export const PARTS_DURATION_TARIFF = Object.freeze({
51
56
  version: 1, pricingVersion: PARTS_PRICING_VERSION, presenterCreditsPerSecond: PRESENTER_CREDITS_PER_SECOND,
52
57
  productionCreditsPerSecond: PRODUCTION_CREDITS_PER_SECOND, minimumCredits: DELIVERED_VIDEO_MINIMUM_CREDITS,
53
58
  });
59
+ export function durationPartsTariffFor(engine) {
60
+ return Object.freeze({ ...PARTS_DURATION_TARIFF, presenterEngine: engine });
61
+ }
54
62
  export const partsLineSchema = z.object({
55
63
  label: z.string().min(1),
56
64
  unit: z.enum(["face_second", "second", "still", "track", "scene", "template"]),
@@ -84,12 +92,12 @@ export function calculatePartsCharge(measure, tariffInput, delivered) {
84
92
  const stills = BigInt(z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).parse(measure.liveAvatarStills));
85
93
  const lines = [];
86
94
  let billableFaceSeconds = 0n;
87
- for (const engine of [...PRESENTER_ENGINES, ...SHOT_ENGINES]) {
95
+ for (const engine of TAKE_ENGINES) {
88
96
  const intervals = measure.presenter[engine];
89
97
  if (intervals === undefined || intervals.length === 0)
90
98
  continue;
91
- const rate = PRESENTER_ENGINES.includes(engine) ? tariff.presenterCreditsPerSecond[engine]
92
- : tariff.shotCreditsPerSecond?.[engine];
99
+ const rate = SHORT_PRESENTER_ENGINES.includes(engine)
100
+ ? tariff.presenterCreditsPerSecond[engine] : tariff.shotCreditsPerSecond?.[engine];
93
101
  if (rate === undefined)
94
102
  throw new RangeError(`the tariff has no rate for ${engine}`);
95
103
  const seconds = ceilSeconds(unionFaceFrames(intervals), fps);
@@ -99,19 +107,24 @@ export function calculatePartsCharge(measure, tariffInput, delivered) {
99
107
  lines.push(line("production (voice and render)", "second", ceilSeconds(outputFrames, fps), tariff.productionCreditsPerSecond));
100
108
  if (stills > 0n)
101
109
  lines.push(line("live avatar on a call", "still", stills, tariff.liveAvatarStillCredits));
102
- const faceFrames = unionFaceFrames([...PRESENTER_ENGINES, ...SHOT_ENGINES].flatMap((engine) => [...(measure.presenter[engine] ?? [])]));
110
+ const faceFrames = unionFaceFrames(TAKE_ENGINES.flatMap((engine) => [...(measure.presenter[engine] ?? [])]));
103
111
  return settle(lines, tariff.minimumCredits, delivered, Number(faceFrames), Number(billableFaceSeconds));
104
112
  }
105
- export function calculateDurationPartsCharge(durationSec, engine, tariffInput, delivered, heldSec = 0) {
113
+ export const PRODUCTION_LINE = "production (voice and render)";
114
+ export const PRODUCTION_RENDER_LINE = "production (render)";
115
+ export function calculateDurationPartsCharge(durationSec, engine, tariffInput, delivered, heldSec = 0, deliveredVoice = false) {
106
116
  const tariff = durationPartsTariffSchema.parse(tariffInput);
117
+ const rate = tariff.presenterCreditsPerSecond[engine];
118
+ if (rate === undefined)
119
+ throw new RangeError(`the tariff has no rate for ${engine}`);
107
120
  if (!Number.isFinite(durationSec) || durationSec < 0)
108
121
  throw new RangeError("duration must be a finite, non-negative number of seconds");
109
122
  if (!Number.isFinite(heldSec) || heldSec < 0 || heldSec > durationSec)
110
123
  throw new RangeError("the held still must lie within the video");
111
124
  const seconds = BigInt(Math.max(1, Math.ceil(durationSec)));
112
125
  const take = heldSec === 0 ? seconds : BigInt(Math.max(1, Math.ceil(Number((durationSec - heldSec).toFixed(6)))));
113
- const lines = [line(PRESENTER_ENGINE_LABELS[engine], "face_second", take, tariff.presenterCreditsPerSecond[engine]),
114
- line("production (voice and render)", "second", seconds, tariff.productionCreditsPerSecond)];
126
+ const lines = [line(PRESENTER_ENGINE_LABELS[engine], "face_second", take, rate),
127
+ line(deliveredVoice ? PRODUCTION_RENDER_LINE : PRODUCTION_LINE, "second", seconds, tariff.productionCreditsPerSecond)];
115
128
  return settle(lines, tariff.minimumCredits, delivered, 0, Number(take));
116
129
  }
117
130
  export const partsBillingSummarySchema = z.object({
@@ -0,0 +1,17 @@
1
+ import type { AspectRatio, MakeUgcInput, PresenterEngineChoice } from "./skills.js";
2
+ export declare const PRESENTER_ENGINE_OF: Readonly<Record<PresenterEngineChoice, "heygen" | "heygen_avatar6_turbo">>;
3
+ export declare const AVATAR6_LEAD_SEC = 0.6;
4
+ export declare const TURBO_UNIT_MAX_SEC = 42;
5
+ export declare const TURBO_UNIT_MAX_ESTIMATE_SEC = 36;
6
+ export declare function isHeygenAvatar6Enabled(env?: Record<string, string | undefined>): boolean;
7
+ export interface PresenterEngineFacts {
8
+ source: {
9
+ width: number;
10
+ height: number;
11
+ } | null;
12
+ longestUnitSec?: number | undefined;
13
+ }
14
+ export declare function resolvePresenterEngine(input: Pick<MakeUgcInput, "presenter_engine" | "call" | "interview" | "presenter_gaze" | "shots">, aspectRatio: AspectRatio | undefined, enabled: boolean, facts: PresenterEngineFacts): {
15
+ choice: PresenterEngineChoice;
16
+ warnings: string[];
17
+ };
@@ -0,0 +1,35 @@
1
+ import { ASPECT_MATCH_THRESHOLD, ASPECT_RATIO_VALUES, aspectDistance } from "./aspect.js";
2
+ export const PRESENTER_ENGINE_OF = Object.freeze({
3
+ avatar_iv: "heygen", avatar6_turbo: "heygen_avatar6_turbo",
4
+ });
5
+ export const AVATAR6_LEAD_SEC = 0.6;
6
+ export const TURBO_UNIT_MAX_SEC = 42;
7
+ export const TURBO_UNIT_MAX_ESTIMATE_SEC = 36;
8
+ export function isHeygenAvatar6Enabled(env = typeof process === "undefined" ? {} : process.env) {
9
+ return env.CLIPWRIGHT_HEYGEN_AVATAR6 === "1";
10
+ }
11
+ const AVATAR6_FORMATS = ["9:16"];
12
+ const AS_IV = "so it renders on avatar_iv (HeyGen Avatar IV) at its price";
13
+ export function resolvePresenterEngine(input, aspectRatio, enabled, facts) {
14
+ const asked = input.presenter_engine;
15
+ if (asked === "avatar_iv")
16
+ return { choice: "avatar_iv", warnings: [] };
17
+ const { source, longestUnitSec } = facts;
18
+ const why = !enabled ? "presenter_engine: avatar6_turbo is not available right now"
19
+ : input.call !== undefined || input.interview !== undefined || input.presenter_gaze !== undefined ||
20
+ input.shots?.some(shot => shot.kind === "talking")
21
+ ? "presenter_engine: avatar6_turbo renders no video with a call, interview, presenter_gaze or talking shot"
22
+ : aspectRatio === undefined || !AVATAR6_FORMATS.includes(aspectRatio)
23
+ ? `presenter_engine: avatar6_turbo renders only ${AVATAR6_FORMATS.join(", ")} videos, and this one is ${aspectRatio ?? "of another format"}`
24
+ : source === null
25
+ ? "presenter_engine: avatar6_turbo needs a presenter picture of known shape, and this one could not be measured"
26
+ : aspectDistance(ASPECT_RATIO_VALUES["9:16"], source.width / source.height) > ASPECT_MATCH_THRESHOLD
27
+ ? `presenter_engine: avatar6_turbo needs a presenter picture within 2% of 9:16, and this one is ${source.width}×${source.height}`
28
+ : longestUnitSec !== undefined && longestUnitSec > TURBO_UNIT_MAX_ESTIMATE_SEC
29
+ ? `presenter_engine: avatar6_turbo renders presenter parts of up to ${TURBO_UNIT_MAX_ESTIMATE_SEC} s, and one part of this video ` +
30
+ `is estimated at ${Math.ceil(longestUnitSec)} s`
31
+ : undefined;
32
+ if (why === undefined)
33
+ return { choice: "avatar6_turbo", warnings: [] };
34
+ return { choice: "avatar_iv", warnings: asked === "avatar6_turbo" ? [`${why}; ${AS_IV}`] : [] };
35
+ }
package/dist/prices.d.ts CHANGED
@@ -92,9 +92,13 @@ export declare const pricesResponseRead: z.ZodObject<{
92
92
  export type PricesResponseRead = z.infer<typeof pricesResponseRead>;
93
93
  export declare const isPaidEntry: (entry: PriceEntry) => boolean;
94
94
  export declare const FREE_RUN_ROUTES: ReadonlySet<string>;
95
- export declare const AD_DIY_PRICES: readonly PriceEntry[];
96
- export declare const FACELESS_DIY_PRICES: readonly PriceEntry[];
97
- export declare function priceListFor(env: Record<string, string | undefined>): readonly PriceEntry[];
95
+ export interface DiyModesSold {
96
+ readonly ad: boolean;
97
+ readonly faceless: boolean;
98
+ }
99
+ export declare const NO_DIY_MODES: DiyModesSold;
100
+ export declare const diyPriceEntries: (diy: DiyModesSold, music: boolean) => PriceEntry[];
101
+ export declare function priceListFor(env: Record<string, string | undefined>, diy?: DiyModesSold): readonly PriceEntry[];
98
102
  export declare const PRICE_LIST: readonly PriceEntry[];
99
103
  export declare const priceText: (entry: PriceEntry) => string;
100
104
  export declare function priceLine(tool: string, list?: readonly PriceEntry[]): string | null;