@decartai/sdk 0.0.54 → 0.0.56
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/process/types.d.ts +3 -5
- package/dist/shared/model.d.ts +3 -22
- package/dist/shared/model.js +2 -19
- package/dist/tokens/client.d.ts +29 -0
- package/dist/tokens/client.js +1 -1
- package/package.json +1 -1
package/dist/process/types.d.ts
CHANGED
|
@@ -82,16 +82,15 @@ interface VideoEditInputs {
|
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Model-specific input documentation for lucy-2-v2v.
|
|
85
|
-
* Requires
|
|
85
|
+
* Requires prompt (can be empty string). Optional reference_image can also be provided.
|
|
86
86
|
*/
|
|
87
87
|
interface VideoEdit2Inputs {
|
|
88
88
|
/**
|
|
89
|
-
* Text
|
|
90
|
-
* At least one of prompt or reference_image must be provided.
|
|
89
|
+
* Text prompt for the video editing. Send an empty string if you want no text prompt.
|
|
91
90
|
*
|
|
92
91
|
* See our [Prompt Engineering](https://docs.platform.decart.ai/models/video/video-generation#prompt-engineering) guide for how to write prompt for Decart video models effectively.
|
|
93
92
|
*/
|
|
94
|
-
prompt
|
|
93
|
+
prompt: string;
|
|
95
94
|
/**
|
|
96
95
|
* Video file to process.
|
|
97
96
|
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
@@ -99,7 +98,6 @@ interface VideoEdit2Inputs {
|
|
|
99
98
|
data: FileInput;
|
|
100
99
|
/**
|
|
101
100
|
* Optional reference image to guide what to add to the video.
|
|
102
|
-
* At least one of prompt or reference_image must be provided.
|
|
103
101
|
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
104
102
|
*/
|
|
105
103
|
reference_image?: FileInput;
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region src/shared/model.d.ts
|
|
4
4
|
declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"lucy_2_rt">, z.ZodLiteral<"live_avatar">]>;
|
|
5
|
-
declare const videoModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-
|
|
5
|
+
declare const videoModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>;
|
|
6
6
|
declare const imageModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>;
|
|
7
|
-
declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"lucy_2_rt">, z.ZodLiteral<"live_avatar">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-
|
|
7
|
+
declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"lucy_2_rt">, z.ZodLiteral<"live_avatar">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
|
|
8
8
|
type Model = z.infer<typeof modelSchema>;
|
|
9
9
|
type RealTimeModels = z.infer<typeof realtimeModels>;
|
|
10
10
|
type VideoModels = z.infer<typeof videoModels>;
|
|
@@ -81,24 +81,6 @@ declare const modelInputSchemas: {
|
|
|
81
81
|
resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
|
|
82
82
|
enhance_prompt: z.ZodOptional<z.ZodBoolean>;
|
|
83
83
|
}, z.core.$strip>;
|
|
84
|
-
readonly "lucy-pro-flf2v": z.ZodObject<{
|
|
85
|
-
prompt: z.ZodString;
|
|
86
|
-
start: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
87
|
-
uri: z.ZodString;
|
|
88
|
-
type: z.ZodString;
|
|
89
|
-
name: z.ZodString;
|
|
90
|
-
}, z.core.$strip>]>;
|
|
91
|
-
end: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
92
|
-
uri: z.ZodString;
|
|
93
|
-
type: z.ZodString;
|
|
94
|
-
name: z.ZodString;
|
|
95
|
-
}, z.core.$strip>]>;
|
|
96
|
-
seed: z.ZodOptional<z.ZodNumber>;
|
|
97
|
-
resolution: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
98
|
-
"720p": "720p";
|
|
99
|
-
"480p": "480p";
|
|
100
|
-
}>>>;
|
|
101
|
-
}, z.core.$strip>;
|
|
102
84
|
readonly "lucy-pro-i2i": z.ZodObject<{
|
|
103
85
|
prompt: z.ZodString;
|
|
104
86
|
data: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
@@ -144,7 +126,7 @@ declare const modelInputSchemas: {
|
|
|
144
126
|
enhance_prompt: z.ZodOptional<z.ZodBoolean>;
|
|
145
127
|
}, z.core.$strip>;
|
|
146
128
|
readonly "lucy-2-v2v": z.ZodObject<{
|
|
147
|
-
prompt: z.
|
|
129
|
+
prompt: z.ZodString;
|
|
148
130
|
reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
149
131
|
uri: z.ZodString;
|
|
150
132
|
type: z.ZodString;
|
|
@@ -197,7 +179,6 @@ declare const models: {
|
|
|
197
179
|
* - `"lucy-pro-t2v"` - Text-to-video
|
|
198
180
|
* - `"lucy-pro-i2v"` - Image-to-video
|
|
199
181
|
* - `"lucy-pro-v2v"` - Video-to-video
|
|
200
|
-
* - `"lucy-pro-flf2v"` - First-last-frame-to-video
|
|
201
182
|
* - `"lucy-dev-i2v"` - Image-to-video (Dev quality)
|
|
202
183
|
* - `"lucy-fast-v2v"` - Video-to-video (Fast quality)
|
|
203
184
|
* - `"lucy-restyle-v2v"` - Video-to-video (Restyling)
|
package/dist/shared/model.js
CHANGED
|
@@ -15,7 +15,6 @@ const videoModels = z.union([
|
|
|
15
15
|
z.literal("lucy-pro-t2v"),
|
|
16
16
|
z.literal("lucy-pro-i2v"),
|
|
17
17
|
z.literal("lucy-pro-v2v"),
|
|
18
|
-
z.literal("lucy-pro-flf2v"),
|
|
19
18
|
z.literal("lucy-motion"),
|
|
20
19
|
z.literal("lucy-restyle-v2v"),
|
|
21
20
|
z.literal("lucy-2-v2v")
|
|
@@ -106,13 +105,6 @@ const modelInputSchemas = {
|
|
|
106
105
|
resolution: proV2vResolutionSchema,
|
|
107
106
|
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
|
|
108
107
|
}),
|
|
109
|
-
"lucy-pro-flf2v": z.object({
|
|
110
|
-
prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
|
|
111
|
-
start: fileInputSchema.describe("The start frame image (File, Blob, ReadableStream, URL, or string URL)"),
|
|
112
|
-
end: fileInputSchema.describe("The end frame image (File, Blob, ReadableStream, URL, or string URL)"),
|
|
113
|
-
seed: z.number().optional().describe("The seed to use for the generation"),
|
|
114
|
-
resolution: proResolutionSchema()
|
|
115
|
-
}),
|
|
116
108
|
"lucy-pro-i2i": z.object({
|
|
117
109
|
prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
|
|
118
110
|
data: fileInputSchema.describe("The image data to use for generation (File, Blob, ReadableStream, URL, or string URL)"),
|
|
@@ -139,13 +131,13 @@ const modelInputSchemas = {
|
|
|
139
131
|
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt (only valid with text prompt, defaults to true on backend)")
|
|
140
132
|
}).refine((data) => data.prompt !== void 0 !== (data.reference_image !== void 0), { message: "Must provide either 'prompt' or 'reference_image', but not both" }).refine((data) => !(data.reference_image !== void 0 && data.enhance_prompt !== void 0), { message: "'enhance_prompt' is only valid when using 'prompt', not 'reference_image'" }),
|
|
141
133
|
"lucy-2-v2v": z.object({
|
|
142
|
-
prompt: z.string().
|
|
134
|
+
prompt: z.string().max(1e3).describe("Text prompt for the video editing. Send an empty string if you want no text prompt."),
|
|
143
135
|
reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
|
|
144
136
|
data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
|
|
145
137
|
seed: z.number().optional().describe("The seed to use for the generation"),
|
|
146
138
|
resolution: proV2vResolutionSchema,
|
|
147
139
|
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
|
|
148
|
-
})
|
|
140
|
+
})
|
|
149
141
|
};
|
|
150
142
|
const modelDefinitionSchema = z.object({
|
|
151
143
|
name: z.string(),
|
|
@@ -265,15 +257,6 @@ const _models = {
|
|
|
265
257
|
height: 704,
|
|
266
258
|
inputSchema: modelInputSchemas["lucy-pro-v2v"]
|
|
267
259
|
},
|
|
268
|
-
"lucy-pro-flf2v": {
|
|
269
|
-
urlPath: "/v1/generate/lucy-pro-flf2v",
|
|
270
|
-
queueUrlPath: "/v1/jobs/lucy-pro-flf2v",
|
|
271
|
-
name: "lucy-pro-flf2v",
|
|
272
|
-
fps: 25,
|
|
273
|
-
width: 1280,
|
|
274
|
-
height: 704,
|
|
275
|
-
inputSchema: modelInputSchemas["lucy-pro-flf2v"]
|
|
276
|
-
},
|
|
277
260
|
"lucy-motion": {
|
|
278
261
|
urlPath: "/v1/generate/lucy-motion",
|
|
279
262
|
queueUrlPath: "/v1/jobs/lucy-motion",
|
package/dist/tokens/client.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
|
+
import { Model } from "../shared/model.js";
|
|
2
|
+
|
|
1
3
|
//#region src/tokens/client.d.ts
|
|
2
4
|
|
|
3
5
|
type CreateTokenOptions = {
|
|
4
6
|
/** Custom key-value pairs to attach to the client token. */
|
|
5
7
|
metadata?: Record<string, unknown>;
|
|
8
|
+
/** Seconds until the token expires (1-3600, default 60). */
|
|
9
|
+
expiresIn?: number;
|
|
10
|
+
/** Restrict which models this token can access (max 20 items). */
|
|
11
|
+
allowedModels?: (Model | (string & {}))[];
|
|
12
|
+
/** Operational limits for the token. */
|
|
13
|
+
constraints?: {
|
|
14
|
+
realtime?: {
|
|
15
|
+
maxSessionDuration?: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
6
18
|
};
|
|
7
19
|
type CreateTokenResponse = {
|
|
8
20
|
apiKey: string;
|
|
9
21
|
expiresAt: string;
|
|
22
|
+
/** Present when `allowedModels` was set on the request. */
|
|
23
|
+
permissions?: {
|
|
24
|
+
models: (Model | (string & {}))[];
|
|
25
|
+
} | null;
|
|
26
|
+
/** Present when `constraints` was set on the request. */
|
|
27
|
+
constraints?: {
|
|
28
|
+
realtime?: {
|
|
29
|
+
maxSessionDuration?: number;
|
|
30
|
+
};
|
|
31
|
+
} | null;
|
|
10
32
|
};
|
|
11
33
|
type TokensClient = {
|
|
12
34
|
/**
|
|
@@ -22,6 +44,13 @@ type TokensClient = {
|
|
|
22
44
|
*
|
|
23
45
|
* // With metadata:
|
|
24
46
|
* const token = await client.tokens.create({ metadata: { role: "viewer" } });
|
|
47
|
+
*
|
|
48
|
+
* // With expiry, model restrictions, and constraints:
|
|
49
|
+
* const token = await client.tokens.create({
|
|
50
|
+
* expiresIn: 300,
|
|
51
|
+
* allowedModels: ["lucy-pro-t2v", "lucy-pro-i2v"],
|
|
52
|
+
* constraints: { realtime: { maxSessionDuration: 120 } },
|
|
53
|
+
* });
|
|
25
54
|
* ```
|
|
26
55
|
*/
|
|
27
56
|
create: (options?: CreateTokenOptions) => Promise<CreateTokenResponse>;
|
package/dist/tokens/client.js
CHANGED
|
@@ -15,7 +15,7 @@ const createTokensClient = (opts) => {
|
|
|
15
15
|
const response = await fetch(`${baseUrl}/v1/client/tokens`, {
|
|
16
16
|
method: "POST",
|
|
17
17
|
headers,
|
|
18
|
-
body: JSON.stringify(options
|
|
18
|
+
body: JSON.stringify(options ?? {})
|
|
19
19
|
});
|
|
20
20
|
if (!response.ok) {
|
|
21
21
|
const errorText = await response.text().catch(() => "Unknown error");
|