@nodaro/sdk 2.34.0 → 2.39.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.
- package/dist/{chunk-JMOKD6ZP.js → chunk-7CUWAVWB.js} +3 -3
- package/dist/{chunk-JMOKD6ZP.js.map → chunk-7CUWAVWB.js.map} +1 -1
- package/dist/{chunk-E5BM4BLO.js → chunk-7IWVDWSP.js} +20 -3
- package/dist/chunk-7IWVDWSP.js.map +1 -0
- package/dist/{chunk-RHJRLXKY.cjs → chunk-7XOK277W.cjs} +9 -9
- package/dist/{chunk-RHJRLXKY.cjs.map → chunk-7XOK277W.cjs.map} +1 -1
- package/dist/{chunk-3QBH2VE2.cjs → chunk-A7QSOD2S.cjs} +20 -3
- package/dist/chunk-A7QSOD2S.cjs.map +1 -0
- package/dist/chunk-AQHU7EI5.js +54 -0
- package/dist/chunk-AQHU7EI5.js.map +1 -0
- package/dist/{chunk-VV4TZG5S.js → chunk-AUKHMT53.js} +3 -3
- package/dist/chunk-AUKHMT53.js.map +1 -0
- package/dist/{chunk-CWH642B2.js → chunk-CIUZMTER.js} +22 -18
- package/dist/chunk-CIUZMTER.js.map +1 -0
- package/dist/{chunk-I6CXC345.js → chunk-D2ILCSOQ.js} +3 -3
- package/dist/{chunk-I6CXC345.js.map → chunk-D2ILCSOQ.js.map} +1 -1
- package/dist/{chunk-4NLVBYMW.js → chunk-DQAYIVVS.js} +42 -8
- package/dist/chunk-DQAYIVVS.js.map +1 -0
- package/dist/{chunk-5ALNFATQ.cjs → chunk-EK672FFM.cjs} +2 -2
- package/dist/chunk-EK672FFM.cjs.map +1 -0
- package/dist/{chunk-OXQKE5EG.cjs → chunk-ETX3TLNB.cjs} +43 -9
- package/dist/{chunk-4NLVBYMW.js.map → chunk-ETX3TLNB.cjs.map} +1 -1
- package/dist/{chunk-BRV7Z4GD.cjs → chunk-FHVNTS4E.cjs} +2 -2
- package/dist/{chunk-BRV7Z4GD.cjs.map → chunk-FHVNTS4E.cjs.map} +1 -1
- package/dist/{chunk-N6GLZOE4.cjs → chunk-FM2KM5TY.cjs} +52 -10
- package/dist/chunk-FM2KM5TY.cjs.map +1 -0
- package/dist/{chunk-53SXNN3A.js → chunk-FQNCIP6K.js} +2 -2
- package/dist/chunk-FQNCIP6K.js.map +1 -0
- package/dist/{chunk-KNMW722T.cjs → chunk-FRQJNGJS.cjs} +5 -5
- package/dist/{chunk-KNMW722T.cjs.map → chunk-FRQJNGJS.cjs.map} +1 -1
- package/dist/{chunk-4CXB7RA6.js → chunk-IGMWFEFB.js} +6 -4
- package/dist/chunk-IGMWFEFB.js.map +1 -0
- package/dist/{chunk-6OGGJQVA.js → chunk-ILG5DHQQ.js} +2 -2
- package/dist/chunk-ILG5DHQQ.js.map +1 -0
- package/dist/{chunk-CFY6XXOT.cjs → chunk-IXCJ26F5.cjs} +37 -33
- package/dist/chunk-IXCJ26F5.cjs.map +1 -0
- package/dist/{chunk-ZQQABQMH.cjs → chunk-JTOEHQQJ.cjs} +12 -2
- package/dist/chunk-JTOEHQQJ.cjs.map +1 -0
- package/dist/{chunk-ZXJQSFIA.js → chunk-JUON5NXA.js} +2 -2
- package/dist/{chunk-ZXJQSFIA.js.map → chunk-JUON5NXA.js.map} +1 -1
- package/dist/{chunk-JGS6YBDW.js → chunk-L6T44A3G.js} +51 -11
- package/dist/chunk-L6T44A3G.js.map +1 -0
- package/dist/{chunk-U4T3Z3K7.cjs → chunk-NKH2UFSD.cjs} +5 -5
- package/dist/chunk-NKH2UFSD.cjs.map +1 -0
- package/dist/{chunk-VFMWBW2Q.js → chunk-NU4QSOMH.js} +4 -4
- package/dist/{chunk-VFMWBW2Q.js.map → chunk-NU4QSOMH.js.map} +1 -1
- package/dist/{chunk-E2ZXHS6E.js → chunk-OIPPTBW4.js} +2 -2
- package/dist/chunk-OIPPTBW4.js.map +1 -0
- package/dist/{chunk-DKEYSJCE.cjs → chunk-OIYMTGYN.cjs} +2 -2
- package/dist/chunk-OIYMTGYN.cjs.map +1 -0
- package/dist/{chunk-NLQQHJ25.cjs → chunk-OSMKIRKI.cjs} +4 -4
- package/dist/{chunk-NLQQHJ25.cjs.map → chunk-OSMKIRKI.cjs.map} +1 -1
- package/dist/chunk-PG2GBS3K.cjs +4 -0
- package/dist/chunk-PG2GBS3K.cjs.map +1 -0
- package/dist/{chunk-GB724HW2.cjs → chunk-PQ7OKM3E.cjs} +6 -4
- package/dist/chunk-PQ7OKM3E.cjs.map +1 -0
- package/dist/chunk-QGOEQGAE.js +102 -0
- package/dist/chunk-QGOEQGAE.js.map +1 -0
- package/dist/{chunk-EAGD6NEE.cjs → chunk-QZHRXPN5.cjs} +22 -22
- package/dist/chunk-QZHRXPN5.cjs.map +1 -0
- package/dist/{chunk-5MTCKWKA.cjs → chunk-QZMI7364.cjs} +5 -5
- package/dist/{chunk-5MTCKWKA.cjs.map → chunk-QZMI7364.cjs.map} +1 -1
- package/dist/chunk-SRBYCGRC.cjs +56 -0
- package/dist/chunk-SRBYCGRC.cjs.map +1 -0
- package/dist/{chunk-KGKCAGRD.cjs → chunk-TCLNSVYA.cjs} +2 -2
- package/dist/chunk-TCLNSVYA.cjs.map +1 -0
- package/dist/chunk-VCEYLJ2Q.cjs +104 -0
- package/dist/chunk-VCEYLJ2Q.cjs.map +1 -0
- package/dist/{chunk-VGWOIWRQ.cjs → chunk-VHSMOBU7.cjs} +2 -2
- package/dist/{chunk-VGWOIWRQ.cjs.map → chunk-VHSMOBU7.cjs.map} +1 -1
- package/dist/{chunk-T3SYREY4.js → chunk-WY4QRJZW.js} +12 -2
- package/dist/chunk-WY4QRJZW.js.map +1 -0
- package/dist/chunk-YCVRQZT3.js +3 -0
- package/dist/chunk-YCVRQZT3.js.map +1 -0
- package/dist/{chunk-DPSMVOM3.js → chunk-YSZM3N7Q.js} +2 -2
- package/dist/chunk-YSZM3N7Q.js.map +1 -0
- package/dist/{chunk-5A7J24LN.js → chunk-Z7UZ3FD3.js} +3 -3
- package/dist/{chunk-5A7J24LN.js.map → chunk-Z7UZ3FD3.js.map} +1 -1
- package/dist/{chunk-4JKI6JRC.js → chunk-ZDSC6KBT.js} +3 -3
- package/dist/chunk-ZDSC6KBT.js.map +1 -0
- package/dist/entries/apps.cjs +2 -2
- package/dist/entries/apps.d.cts +4 -0
- package/dist/entries/apps.d.ts +4 -0
- package/dist/entries/apps.js +1 -1
- package/dist/entries/cast-swap.cjs +2 -2
- package/dist/entries/cast-swap.d.cts +278 -18
- package/dist/entries/cast-swap.d.ts +278 -18
- package/dist/entries/cast-swap.js +1 -1
- package/dist/entries/characters.d.cts +2 -2
- package/dist/entries/characters.d.ts +2 -2
- package/dist/entries/client.cjs +25 -24
- package/dist/entries/client.d.cts +5 -2
- package/dist/entries/client.d.ts +5 -2
- package/dist/entries/client.js +20 -19
- package/dist/entries/copilot.cjs +4 -4
- package/dist/entries/copilot.js +3 -3
- package/dist/entries/core.cjs +6 -6
- package/dist/entries/core.js +2 -2
- package/dist/entries/creatures.d.cts +2 -2
- package/dist/entries/creatures.d.ts +2 -2
- package/dist/entries/credits.cjs +2 -2
- package/dist/entries/credits.d.cts +37 -2
- package/dist/entries/credits.d.ts +37 -2
- package/dist/entries/credits.js +1 -1
- package/dist/entries/edit.cjs +7 -7
- package/dist/entries/edit.d.cts +3 -0
- package/dist/entries/edit.d.ts +3 -0
- package/dist/entries/edit.js +2 -2
- package/dist/entries/errors.cjs +30 -22
- package/dist/entries/errors.d.cts +42 -4
- package/dist/entries/errors.d.ts +42 -4
- package/dist/entries/errors.js +1 -1
- package/dist/entries/jobs.cjs +2 -2
- package/dist/entries/jobs.d.cts +76 -4
- package/dist/entries/jobs.d.ts +76 -4
- package/dist/entries/jobs.js +1 -1
- package/dist/entries/locations.d.cts +2 -2
- package/dist/entries/locations.d.ts +2 -2
- package/dist/entries/media.cjs +4 -4
- package/dist/entries/media.d.cts +39 -5
- package/dist/entries/media.d.ts +39 -5
- package/dist/entries/media.js +3 -3
- package/dist/entries/nodes.cjs +3 -3
- package/dist/entries/nodes.d.cts +2 -2
- package/dist/entries/nodes.d.ts +2 -2
- package/dist/entries/nodes.js +2 -2
- package/dist/entries/objects.d.cts +2 -2
- package/dist/entries/objects.d.ts +2 -2
- package/dist/entries/prompt-helper.cjs +2 -2
- package/dist/entries/prompt-helper.d.cts +3 -1
- package/dist/entries/prompt-helper.d.ts +3 -1
- package/dist/entries/prompt-helper.js +1 -1
- package/dist/entries/scene3d.d.cts +3 -3
- package/dist/entries/scene3d.d.ts +3 -3
- package/dist/entries/studio.cjs +5 -5
- package/dist/entries/studio.d.cts +2 -2
- package/dist/entries/studio.d.ts +2 -2
- package/dist/entries/studio.js +2 -2
- package/dist/entries/templates.cjs +2 -2
- package/dist/entries/templates.d.cts +4 -0
- package/dist/entries/templates.d.ts +4 -0
- package/dist/entries/templates.js +1 -1
- package/dist/entries/trends.cjs +13 -0
- package/dist/entries/trends.cjs.map +1 -0
- package/dist/entries/trends.d.cts +295 -0
- package/dist/entries/trends.d.ts +295 -0
- package/dist/entries/trends.js +4 -0
- package/dist/entries/trends.js.map +1 -0
- package/dist/entries/tutorials.cjs +2 -2
- package/dist/entries/tutorials.d.cts +4 -0
- package/dist/entries/tutorials.d.ts +4 -0
- package/dist/entries/tutorials.js +1 -1
- package/dist/entries/uploads.cjs +2 -2
- package/dist/entries/uploads.d.cts +14 -1
- package/dist/entries/uploads.d.ts +14 -1
- package/dist/entries/uploads.js +1 -1
- package/dist/entries/workflows.cjs +2 -2
- package/dist/entries/workflows.d.cts +6 -0
- package/dist/entries/workflows.d.ts +6 -0
- package/dist/entries/workflows.js +1 -1
- package/dist/index.cjs +85 -71
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +22 -20
- package/dist/{nodes-D2tbtzt7.d.ts → nodes-9WpYNWtS.d.ts} +13 -1
- package/dist/{nodes-CTujw6Qd.d.cts → nodes-BDUk5Aej.d.cts} +13 -1
- package/dist/{studio-productions-vbCNSbtf.d.ts → studio-productions-DtTE8mdl.d.ts} +35 -1
- package/dist/{studio-productions-DUHvdSvk.d.cts → studio-productions-r2-VZsKj.d.cts} +35 -1
- package/package.json +7 -2
- package/dist/chunk-3QBH2VE2.cjs.map +0 -1
- package/dist/chunk-4CXB7RA6.js.map +0 -1
- package/dist/chunk-4JKI6JRC.js.map +0 -1
- package/dist/chunk-53SXNN3A.js.map +0 -1
- package/dist/chunk-5ALNFATQ.cjs.map +0 -1
- package/dist/chunk-6OGGJQVA.js.map +0 -1
- package/dist/chunk-CFY6XXOT.cjs.map +0 -1
- package/dist/chunk-CWH642B2.js.map +0 -1
- package/dist/chunk-DKEYSJCE.cjs.map +0 -1
- package/dist/chunk-DPSMVOM3.js.map +0 -1
- package/dist/chunk-E2ZXHS6E.js.map +0 -1
- package/dist/chunk-E5BM4BLO.js.map +0 -1
- package/dist/chunk-EAGD6NEE.cjs.map +0 -1
- package/dist/chunk-GB724HW2.cjs.map +0 -1
- package/dist/chunk-GDXS4EJ5.js +0 -28
- package/dist/chunk-GDXS4EJ5.js.map +0 -1
- package/dist/chunk-GVBSOZDI.cjs +0 -30
- package/dist/chunk-GVBSOZDI.cjs.map +0 -1
- package/dist/chunk-JGS6YBDW.js.map +0 -1
- package/dist/chunk-KGKCAGRD.cjs.map +0 -1
- package/dist/chunk-N6GLZOE4.cjs.map +0 -1
- package/dist/chunk-OXQKE5EG.cjs.map +0 -1
- package/dist/chunk-T3SYREY4.js.map +0 -1
- package/dist/chunk-U4T3Z3K7.cjs.map +0 -1
- package/dist/chunk-VV4TZG5S.js.map +0 -1
- package/dist/chunk-ZQQABQMH.cjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-RQSGS7ZK.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkSRBYCGRC_cjs = require('../chunk-SRBYCGRC.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "CastSwapResource", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkSRBYCGRC_cjs.CastSwapResource; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=cast-swap.cjs.map
|
|
13
13
|
//# sourceMappingURL=cast-swap.cjs.map
|
|
@@ -3,8 +3,16 @@ import '@nodaro/shared/apps';
|
|
|
3
3
|
import '@nodaro/shared/organizations';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Cast Swap — replace the people and/or the location in a
|
|
7
|
-
* your own references, keeping its motion, framing, timing
|
|
6
|
+
* Cast Swap — replace the people, pets, products and/or the location in a
|
|
7
|
+
* short video with your own references, keeping its motion, framing, timing
|
|
8
|
+
* and sound (the clip's audio is kept, and the result is the clip's length).
|
|
9
|
+
*
|
|
10
|
+
* Before the video, each person, pet and product role's photos are turned
|
|
11
|
+
* into one clean reference picture by an image model. This costs extra
|
|
12
|
+
* credits (`breakdown.references` in the estimate), charged when it runs, even
|
|
13
|
+
* if the video then fails; it adds about a minute, falls back to your own
|
|
14
|
+
* photos if it fails, and is turned off with `prepareReferences: false`.
|
|
15
|
+
* Locations are not prepared.
|
|
8
16
|
*
|
|
9
17
|
* Cloud edition only: `/v1/cast-swap` is served by the cloud plugin and 404s
|
|
10
18
|
* on self-hosted installs. `run()` answers 202 with a job id; follow it with
|
|
@@ -17,18 +25,42 @@ import '@nodaro/shared/organizations';
|
|
|
17
25
|
* `jobId`. Nothing new is started or charged.
|
|
18
26
|
*
|
|
19
27
|
* Refusals (thrown as a `NodaroError` subclass; body `{ error: { code, message } }`), before
|
|
20
|
-
* anything is charged: 400 `validation_error` (the body
|
|
21
|
-
*
|
|
28
|
+
* anything is charged: 400 `validation_error` (the body: no role with images,
|
|
29
|
+
* no reference and no `prePrompt` or `postPrompt`, more roles of a kind
|
|
30
|
+
* than allowed, more than 30 images in all, `draft: true` above 480p, a
|
|
31
|
+
* `prePrompt` or `postPrompt` over 4,000 characters, a `faceMasking` setting
|
|
32
|
+
* out of range), `raw_reference_token` (also in a reference's `line`),
|
|
33
|
+
* `invalid_role_mention` (also any `{role:N}` in a reference's `line`),
|
|
22
34
|
* `unsafe_url`, `video_unreadable`, `clip_out_of_range` (4–30 s),
|
|
23
|
-
* `preview_out_of_range
|
|
35
|
+
* `preview_out_of_range`, `no_roles_in_preview` (a preview with every role
|
|
36
|
+
* `inPreview: false`, always refused even with a prompt, or with no role kept
|
|
37
|
+
* in it that has images and no `prePrompt` or `postPrompt`), `prompt_too_long`
|
|
38
|
+
* (the prompt would build too long: a `{role:N}` reads as the role's name when
|
|
39
|
+
* it sends no images); 401; 402 `insufficient_credits` (`run()` only); 404
|
|
24
40
|
* (a `sessionId` you may not use, `run()` only); 422 `job_blocked` (`run()`
|
|
25
41
|
* only); 503 `host_too_old` (both); 503 `estimate_unavailable` (`estimate()`
|
|
26
42
|
* only).
|
|
27
43
|
*/
|
|
28
|
-
/** Whether a swapped
|
|
44
|
+
/** Whether a swapped subject takes this trait from the references (`"new"`) or keeps the video's (`"original"`). */
|
|
29
45
|
type CastSwapTraitSource = "new" | "original";
|
|
46
|
+
/**
|
|
47
|
+
* Preview-only settings, on every role kind; a full run (`preview` not `true`)
|
|
48
|
+
* ignores both.
|
|
49
|
+
*/
|
|
50
|
+
interface CastSwapRolePreviewSettings {
|
|
51
|
+
/** The name used instead of `name` in a preview. Same rules as `name` (1–200 characters). */
|
|
52
|
+
previewName?: string;
|
|
53
|
+
/**
|
|
54
|
+
* `false` leaves this role out of the preview: its reference images are not
|
|
55
|
+
* sent, not prepared and not charged, and a `{role:N}` naming it reads as its
|
|
56
|
+
* `previewName`, else its `name`. Default `true`. A preview with every role
|
|
57
|
+
* left out (always refused, even with a prompt), or with no role kept in it
|
|
58
|
+
* that has images and no pre / post prompt, answers 400 `no_roles_in_preview`.
|
|
59
|
+
*/
|
|
60
|
+
inPreview?: boolean;
|
|
61
|
+
}
|
|
30
62
|
/** A person in the video to recast. */
|
|
31
|
-
interface CastSwapPersonRole {
|
|
63
|
+
interface CastSwapPersonRole extends CastSwapRolePreviewSettings {
|
|
32
64
|
kind: "person";
|
|
33
65
|
/** How the person is told apart in the video, e.g. `"the woman that attacks"`. */
|
|
34
66
|
name: string;
|
|
@@ -42,32 +74,145 @@ interface CastSwapPersonRole {
|
|
|
42
74
|
hair?: CastSwapTraitSource;
|
|
43
75
|
}
|
|
44
76
|
/** The place the video happens in. */
|
|
45
|
-
interface CastSwapLocationRole {
|
|
77
|
+
interface CastSwapLocationRole extends CastSwapRolePreviewSettings {
|
|
46
78
|
kind: "location";
|
|
47
79
|
/** How the place is named. Default `"the setting"`. */
|
|
48
80
|
name?: string;
|
|
49
81
|
/** 0–3 images of ONE place. Empty or `null` keeps the original place. */
|
|
50
82
|
images: string[] | null;
|
|
51
83
|
}
|
|
52
|
-
|
|
84
|
+
/** An animal in the video to recast. */
|
|
85
|
+
interface CastSwapPetRole extends CastSwapRolePreviewSettings {
|
|
86
|
+
kind: "pet";
|
|
87
|
+
/** How the animal is told apart in the video, e.g. `"the dog"`. */
|
|
88
|
+
name: string;
|
|
89
|
+
/** 0–3 images of ONE animal. Empty or `null` keeps the original animal. */
|
|
90
|
+
images: string[] | null;
|
|
91
|
+
/** Body (shape, size and build) from the references or the video. Default `"new"`. */
|
|
92
|
+
body?: CastSwapTraitSource;
|
|
93
|
+
/** Coat (fur, colors and markings) from the references or the video. Default `"new"`. */
|
|
94
|
+
coat?: CastSwapTraitSource;
|
|
95
|
+
}
|
|
96
|
+
/** An object in the video to recast. */
|
|
97
|
+
interface CastSwapProductRole extends CastSwapRolePreviewSettings {
|
|
98
|
+
kind: "product";
|
|
99
|
+
/** How the object is told apart in the video, e.g. `"the can"`. */
|
|
100
|
+
name: string;
|
|
101
|
+
/** 0–3 images of ONE product. Empty or `null` keeps the original object. */
|
|
102
|
+
images: string[] | null;
|
|
103
|
+
/** Shape and proportions from the references or the video. Default `"new"`. */
|
|
104
|
+
shape?: CastSwapTraitSource;
|
|
105
|
+
/** Finish (colors, materials, label and markings) from the references or the video. Default `"new"`. */
|
|
106
|
+
finish?: CastSwapTraitSource;
|
|
107
|
+
}
|
|
108
|
+
type CastSwapRole = CastSwapPersonRole | CastSwapLocationRole | CastSwapPetRole | CastSwapProductRole;
|
|
109
|
+
/**
|
|
110
|
+
* A fixed reference: 1–3 images of ONE thing that no role replaces, and the
|
|
111
|
+
* line that says what it is (`"the glass she drinks from"`). Sent as given,
|
|
112
|
+
* never prepared; its images count toward the 30.
|
|
113
|
+
*/
|
|
114
|
+
interface CastSwapReference {
|
|
115
|
+
/** 1–3 http(s) image URLs of one thing. */
|
|
116
|
+
images: string[];
|
|
117
|
+
/**
|
|
118
|
+
* What it is, 1–500 characters. `{image}` in the line stands for this
|
|
119
|
+
* reference's first image (`"Use {image} for the sky"`); a line without it
|
|
120
|
+
* gets it appended. A `{role:N}` or a raw `{image:` / `{video:` / `{audio:`
|
|
121
|
+
* token answers 400.
|
|
122
|
+
*/
|
|
123
|
+
line: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Margins of the frame, each 0–49 %: a face whose centre lies in a margin is
|
|
127
|
+
* not masked, so only faces inside the inner rectangle are. A margin left out
|
|
128
|
+
* of a zone that is given is 0. (A `zone` left out altogether is 10 % at the
|
|
129
|
+
* left and right: see `CastSwapFaceMasking.zone`.)
|
|
130
|
+
*/
|
|
131
|
+
interface CastSwapFaceMaskingZone {
|
|
132
|
+
/** % of the frame's width from the left edge. Default 0 in a zone that is given. */
|
|
133
|
+
leftPct?: number;
|
|
134
|
+
/** % of the frame's width from the right edge. Default 0 in a zone that is given. */
|
|
135
|
+
rightPct?: number;
|
|
136
|
+
/** % of the frame's height from the top edge. Default 0. */
|
|
137
|
+
topPct?: number;
|
|
138
|
+
/** % of the frame's height from the bottom edge. Default 0. */
|
|
139
|
+
bottomPct?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Face masking: the faces in the source clip are covered before the video
|
|
143
|
+
* model sees it, keeping their movement and lip timing while the rest of the
|
|
144
|
+
* clip is sent as it is.
|
|
145
|
+
*
|
|
146
|
+
* - `"off"` (the same as leaving `faceMasking` out): the clip is sent as it is.
|
|
147
|
+
* - `"always"`: the faces are masked before the first attempt. Its credits are
|
|
148
|
+
* in the quote (`breakdown.masking`, counted in `totalCredits`).
|
|
149
|
+
* - `"auto"`: the run starts unmasked; only if the video model refuses the
|
|
150
|
+
* source clip is it retried once with the faces masked. Any other failure is
|
|
151
|
+
* not retried. The extra credits, charged only when that retry runs, are the
|
|
152
|
+
* estimate's `maskingCredits` (not in `totalCredits`).
|
|
153
|
+
*
|
|
154
|
+
* A completed job's output carries `faceMasking: { applied, reason }`:
|
|
155
|
+
* `applied` is whether the video was made from the masked clip, and `reason`
|
|
156
|
+
* is `"always"` (masked before the first attempt), `"input_refused"` (`auto`
|
|
157
|
+
* retried after the source clip was refused), `"no_faces"` (no face was left
|
|
158
|
+
* to mask after the filters: an `always` run continues unmasked; an `auto`
|
|
159
|
+
* run fails with the original refusal instead) or `"off"`.
|
|
160
|
+
*/
|
|
161
|
+
interface CastSwapFaceMasking {
|
|
162
|
+
mode: "off" | "always" | "auto";
|
|
163
|
+
/** What covers a masked face: `"blur"` (default) or `"depth"` (a depth-color view of it). */
|
|
164
|
+
fill?: "blur" | "depth";
|
|
165
|
+
/** Mask only faces at least this % of the frame's height, 0–100. Default 15. */
|
|
166
|
+
minFaceHeightPct?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Mask only faces at most this % of the frame's height, 0–100. Default 0 (no
|
|
169
|
+
* limit). When above 0 it must be at least `minFaceHeightPct` (else 400).
|
|
170
|
+
*/
|
|
171
|
+
maxFaceHeightPct?: number;
|
|
172
|
+
/**
|
|
173
|
+
* Leave out faces near the edges of the frame. Default (left out):
|
|
174
|
+
* `{ leftPct: 10, rightPct: 10, topPct: 0, bottomPct: 0 }`, so people at the
|
|
175
|
+
* left and right edges are not masked. `null`, or all four margins 0, means
|
|
176
|
+
* no margins.
|
|
177
|
+
*/
|
|
178
|
+
zone?: CastSwapFaceMaskingZone | null;
|
|
179
|
+
/** The blur's strength, 0.1–5 % of the frame's width (`fill: "blur"`). Default 2. */
|
|
180
|
+
blurStrengthPct?: number;
|
|
181
|
+
/** How sure the face finder must be, 0.05–0.95: lower finds more faces. Default 0.5. */
|
|
182
|
+
threshold?: number;
|
|
183
|
+
}
|
|
53
184
|
/** The body of `POST /v1/cast-swap` and `POST /v1/cast-swap/estimate`. */
|
|
54
185
|
interface CastSwapParams {
|
|
55
186
|
/** The source clip, 4–30 seconds. */
|
|
56
187
|
videoUrl: string;
|
|
57
188
|
/**
|
|
58
|
-
* Who and what to swap: at most 6 person roles
|
|
59
|
-
*
|
|
60
|
-
* video). At least one role
|
|
189
|
+
* Who and what to swap: at most 6 person roles, 1 location role, 3 pet roles
|
|
190
|
+
* and 3 product roles, with at most 30 images in all. A role with no images
|
|
191
|
+
* is skipped (that subject or place stays as in the video). At least one role
|
|
192
|
+
* with images, or a `prePrompt` or `postPrompt`, is required.
|
|
61
193
|
*/
|
|
62
194
|
roles: CastSwapRole[];
|
|
195
|
+
/**
|
|
196
|
+
* Fixed references (at most 5): things the video should show that no role
|
|
197
|
+
* replaces, each with the line that names it. Their images count toward the
|
|
198
|
+
* 30. A reference alone is enough for a run (no role needs images).
|
|
199
|
+
*/
|
|
200
|
+
references?: CastSwapReference[];
|
|
201
|
+
/**
|
|
202
|
+
* Your own words placed at the start of the prompt, before the role
|
|
203
|
+
* instructions; at most 4,000 characters. Mention a role as `{role:N}`, as in
|
|
204
|
+
* `postPrompt`; the same 400 refusals apply (an N outside 1..`roles.length`,
|
|
205
|
+
* a raw `{image:` / `{video:` / `{audio:` token).
|
|
206
|
+
*/
|
|
207
|
+
prePrompt?: string;
|
|
63
208
|
/**
|
|
64
209
|
* Extra instructions in your own words, at most 4,000 characters. Mention a
|
|
65
210
|
* role as `{role:N}`, where N is its 1-based position in `roles`
|
|
66
211
|
* (`{role:1}` is `roles[0]`; empty roles count).
|
|
67
212
|
*
|
|
68
213
|
* The route answers 400, before charging, for an N outside 1..`roles.length`,
|
|
69
|
-
* for a raw `{image:` / `{video:` / `{audio:` token in the post prompt
|
|
70
|
-
* role's `name`, for a clip outside 4–30 s, and for a preview past the clip's
|
|
214
|
+
* for a raw `{image:` / `{video:` / `{audio:` token in the pre or post prompt
|
|
215
|
+
* or a role's `name`, for a clip outside 4–30 s, and for a preview past the clip's
|
|
71
216
|
* end (`previewStart + 4` > its length).
|
|
72
217
|
*/
|
|
73
218
|
postPrompt?: string;
|
|
@@ -75,7 +220,26 @@ interface CastSwapParams {
|
|
|
75
220
|
preview?: boolean;
|
|
76
221
|
/** Where the preview starts, in seconds. Default 0. */
|
|
77
222
|
previewStart?: number;
|
|
78
|
-
/** Default `"
|
|
223
|
+
/** The output resolution. Default `"480p"`. */
|
|
224
|
+
resolution?: "480p" | "720p" | "1080p";
|
|
225
|
+
/**
|
|
226
|
+
* Render as a draft. Defaults to `true` at 480p and `false` above it; `true`
|
|
227
|
+
* with `"720p"` or `"1080p"` answers 400 (draft is 480p only).
|
|
228
|
+
*/
|
|
229
|
+
draft?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Turn each person, pet and product role's photos into one clean reference
|
|
232
|
+
* picture before the video (extra credits, shown in `breakdown.references`;
|
|
233
|
+
* about a minute longer; falls back to your own photos if it fails).
|
|
234
|
+
* Default `true`.
|
|
235
|
+
*/
|
|
236
|
+
prepareReferences?: boolean;
|
|
237
|
+
/** Mask the faces in the source clip (see {@link CastSwapFaceMasking}). Default: off. */
|
|
238
|
+
faceMasking?: CastSwapFaceMasking;
|
|
239
|
+
/**
|
|
240
|
+
* `"draft"` means 480p draft.
|
|
241
|
+
* @deprecated use `resolution` + `draft`.
|
|
242
|
+
*/
|
|
79
243
|
quality?: "draft";
|
|
80
244
|
/** A generation session to file the result in. */
|
|
81
245
|
sessionId?: string;
|
|
@@ -84,13 +248,31 @@ interface CastSwapParams {
|
|
|
84
248
|
}
|
|
85
249
|
/** What a run would cost, in credits. */
|
|
86
250
|
interface CastSwapEstimate {
|
|
87
|
-
/**
|
|
251
|
+
/**
|
|
252
|
+
* The quote in credits: `breakdown.castSwap + breakdown.seedance +
|
|
253
|
+
* breakdown.references`, plus `breakdown.masking` with face masking
|
|
254
|
+
* `"always"`.
|
|
255
|
+
*/
|
|
88
256
|
totalCredits: number;
|
|
89
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* `castSwap`: the run itself; `seedance`: the video model it calls;
|
|
259
|
+
* `references`: preparing the reference pictures (0 when `prepareReferences`
|
|
260
|
+
* is off or there is nothing to prepare); `masking`: masking the faces,
|
|
261
|
+
* present only when `faceMasking` is on. With `"auto"` it equals
|
|
262
|
+
* `maskingCredits` and is not added to `totalCredits`.
|
|
263
|
+
*/
|
|
90
264
|
breakdown: {
|
|
91
265
|
castSwap: number;
|
|
92
266
|
seedance: number;
|
|
267
|
+
references: number;
|
|
268
|
+
masking?: number;
|
|
93
269
|
};
|
|
270
|
+
/**
|
|
271
|
+
* Face masking `"auto"` only: the extra credits charged if the source clip
|
|
272
|
+
* is refused and the run is retried with the faces masked. Not in
|
|
273
|
+
* `totalCredits`; `run()` needs credits for both (else 402).
|
|
274
|
+
*/
|
|
275
|
+
maskingCredits?: number;
|
|
94
276
|
/** `true` when the video is made at Auto length: the final charge is expected to come out lower than this quote. */
|
|
95
277
|
settlesLower: boolean;
|
|
96
278
|
}
|
|
@@ -106,6 +288,63 @@ interface CastSwapRunOptions {
|
|
|
106
288
|
*/
|
|
107
289
|
idempotencyKey?: string;
|
|
108
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* What finishing a draft at Full Quality would cost
|
|
293
|
+
* (`POST /v1/cast-swap/:jobId/full-quality/estimate`).
|
|
294
|
+
*/
|
|
295
|
+
interface CastSwapFullQualityEstimate {
|
|
296
|
+
/** The quote in credits: `breakdown.castSwap + breakdown.seedanceHd`. */
|
|
297
|
+
totalCredits: number;
|
|
298
|
+
/**
|
|
299
|
+
* `castSwap`: the Full Quality job's own steps; `seedanceHd`: the 1080p
|
|
300
|
+
* render of the draft's take (0 when an earlier try of this draft already
|
|
301
|
+
* finished that render, which is then reused).
|
|
302
|
+
*/
|
|
303
|
+
breakdown: {
|
|
304
|
+
castSwap: number;
|
|
305
|
+
seedanceHd: number;
|
|
306
|
+
};
|
|
307
|
+
/** ISO time until which the draft can be finished at Full Quality (7 days after it completed). */
|
|
308
|
+
availableUntil: string;
|
|
309
|
+
}
|
|
310
|
+
/** Options for {@link CastSwapResource.fullQuality}. */
|
|
311
|
+
interface CastSwapFullQualityParams {
|
|
312
|
+
/** A generation session to file the Full Quality result in. */
|
|
313
|
+
sessionId?: string;
|
|
314
|
+
}
|
|
315
|
+
/** The Full Quality job (`POST /v1/cast-swap/:jobId/full-quality`). */
|
|
316
|
+
interface CastSwapFullQualityResult {
|
|
317
|
+
jobId: string;
|
|
318
|
+
/** `true` when this draft's Full Quality was already running or done: that job is answered, nothing new is started or charged. */
|
|
319
|
+
existing?: boolean;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* The `code` of a Full Quality refusal (`NodaroError.code`), all before
|
|
323
|
+
* anything is charged:
|
|
324
|
+
* - `unauthorized` (401): no authenticated user;
|
|
325
|
+
* - `not_found` (404): not your job, or not a Cast Swap run; also a
|
|
326
|
+
* `sessionId` you may not use;
|
|
327
|
+
* - `not_completed` (409): the run has not finished;
|
|
328
|
+
* - `not_a_draft` (409): the run was not made as a draft;
|
|
329
|
+
* - `draft_expired` (410): more than 7 days after the draft completed, or
|
|
330
|
+
* the draft can no longer be finished at Full Quality;
|
|
331
|
+
* - `full_quality_pending` (409, `details.retryable: true`): not final — an
|
|
332
|
+
* earlier try's 1080p render of this draft is being reviewed, or has not
|
|
333
|
+
* started yet; try again later (once the review ends). The only refusal
|
|
334
|
+
* that ends on its own;
|
|
335
|
+
* - `full_quality_unavailable` (409): final — nothing kept to re-render, no
|
|
336
|
+
* readable completion time, or the 1080p finalize refuses this draft; on
|
|
337
|
+
* the start only, also "failed too many times" (every try failed) or no
|
|
338
|
+
* try can be started for this run;
|
|
339
|
+
* - `insufficient_credits` (402), or in a workspace `budget_exceeded`,
|
|
340
|
+
* `member_cap_exceeded` or `user_allowance_exceeded`;
|
|
341
|
+
* - `job_blocked` (422): the request was blocked by the job policy;
|
|
342
|
+
* - `job_read_failed` (503, retryable), `estimate_unavailable` (503, try
|
|
343
|
+
* again shortly), `host_too_old` (503).
|
|
344
|
+
*
|
|
345
|
+
* Open-ended: a code not listed here may still arrive.
|
|
346
|
+
*/
|
|
347
|
+
type CastSwapFullQualityRefusalCode = "unauthorized" | "not_found" | "not_completed" | "not_a_draft" | "draft_expired" | "full_quality_pending" | "full_quality_unavailable" | "insufficient_credits" | "budget_exceeded" | "member_cap_exceeded" | "user_allowance_exceeded" | "job_blocked" | "job_read_failed" | "estimate_unavailable" | "host_too_old" | (string & {});
|
|
109
348
|
declare class CastSwapResource {
|
|
110
349
|
private client;
|
|
111
350
|
constructor(client: NodaroClientCore);
|
|
@@ -122,6 +361,27 @@ declare class CastSwapResource {
|
|
|
122
361
|
}>;
|
|
123
362
|
/** Quote a run before starting it (`POST /v1/cast-swap/estimate`); spends nothing. */
|
|
124
363
|
estimate(params: CastSwapParams): Promise<CastSwapEstimate>;
|
|
364
|
+
/**
|
|
365
|
+
* Quote finishing a draft at Full Quality (`POST
|
|
366
|
+
* /v1/cast-swap/:jobId/full-quality/estimate`); spends nothing. `jobId` is a
|
|
367
|
+
* finished DRAFT run (a Cast Swap or trend run made as a draft). The quote
|
|
368
|
+
* does not look for a Full Quality already running: when one is,
|
|
369
|
+
* {@link fullQuality} answers it (`existing: true`) and charges nothing.
|
|
370
|
+
* Refusals: {@link CastSwapFullQualityRefusalCode}.
|
|
371
|
+
*/
|
|
372
|
+
fullQualityEstimate(jobId: string): Promise<CastSwapFullQualityEstimate>;
|
|
373
|
+
/**
|
|
374
|
+
* Finish a draft at Full Quality (`POST /v1/cast-swap/:jobId/full-quality`):
|
|
375
|
+
* the same take re-rendered at 1080p, with the clip's audio, as a new job
|
|
376
|
+
* linked to the draft. SPENDS CREDITS: quote it first with
|
|
377
|
+
* {@link fullQualityEstimate}. Answers 202 `{ jobId }`, or 200
|
|
378
|
+
* `{ jobId, existing: true }` when this draft's Full Quality is already
|
|
379
|
+
* running or done (one per draft; a failed one may be asked again). Follow
|
|
380
|
+
* the job with `client.jobs.get(jobId)`. No `Idempotency-Key` is taken: the
|
|
381
|
+
* server keys the job by the draft. The new job keeps the draft's origin.
|
|
382
|
+
* Refusals: {@link CastSwapFullQualityRefusalCode}.
|
|
383
|
+
*/
|
|
384
|
+
fullQuality(jobId: string, params?: CastSwapFullQualityParams): Promise<CastSwapFullQualityResult>;
|
|
125
385
|
}
|
|
126
386
|
|
|
127
|
-
export { type CastSwapEstimate, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, CastSwapResource, type CastSwapRole, type CastSwapRunOptions, type CastSwapTraitSource };
|
|
387
|
+
export { type CastSwapEstimate, type CastSwapFaceMasking, type CastSwapFaceMaskingZone, type CastSwapFullQualityEstimate, type CastSwapFullQualityParams, type CastSwapFullQualityRefusalCode, type CastSwapFullQualityResult, type CastSwapLocationRole, type CastSwapParams, type CastSwapPersonRole, type CastSwapPetRole, type CastSwapProductRole, type CastSwapReference, CastSwapResource, type CastSwapRole, type CastSwapRolePreviewSettings, type CastSwapRunOptions, type CastSwapTraitSource };
|