@decartai/sdk 0.0.58 → 0.0.59

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.
@@ -143,7 +143,7 @@ interface PromptInput {
143
143
  * This allows different models to have field-specific documentation while maintaining type safety.
144
144
  * Specific models are checked first, then falls back to category-based selection.
145
145
  */
146
- type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" ? VideoRestyleInputs : T["name"] extends "lucy-2-v2v" ? VideoEdit2Inputs : T["name"] extends "lucy-pro-v2v" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
146
+ type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" | "lucy-image-2" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" | "lucy-restyle-2" ? VideoRestyleInputs : T["name"] extends "lucy-2-v2v" | "lucy-2" | "lucy-2.1" ? VideoEdit2Inputs : T["name"] extends "lucy-pro-v2v" | "lucy-clip" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
147
147
  interface ProcessInputs {
148
148
  /**
149
149
  * Random seed for reproducible results.
@@ -64,7 +64,7 @@ const createRealTimeClient = (opts) => {
64
64
  const connect = async (stream, options) => {
65
65
  const parsedOptions = realTimeClientConnectOptionsSchema.safeParse(options);
66
66
  if (!parsedOptions.success) throw parsedOptions.error;
67
- const isAvatarLive = options.model.name === "live_avatar";
67
+ const isAvatarLive = options.model.name === "live_avatar" || options.model.name === "live-avatar";
68
68
  const { onRemoteStream, initialState } = parsedOptions.data;
69
69
  let audioStreamManager;
70
70
  let inputStream;
@@ -312,7 +312,7 @@ var WebRTCConnection = class {
312
312
  this.pc = new RTCPeerConnection({ iceServers: ICE_SERVERS });
313
313
  this.setState("connecting");
314
314
  if (this.localStream) {
315
- if (this.callbacks.modelName === "live_avatar") this.pc.addTransceiver("video", { direction: "recvonly" });
315
+ if (this.callbacks.modelName === "live_avatar" || this.callbacks.modelName === "live-avatar") this.pc.addTransceiver("video", { direction: "recvonly" });
316
316
  this.localStream.getTracks().forEach((track) => {
317
317
  if (this.pc && this.localStream) this.pc.addTrack(track, this.localStream);
318
318
  });
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //#region src/shared/model.d.ts
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-pro-v2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>;
6
- declare const imageModels: 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-pro-v2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>, z.ZodLiteral<"lucy-pro-i2i">]>;
4
+ declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy">, z.ZodLiteral<"lucy-2">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.1-vton">, z.ZodLiteral<"lucy-restyle">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"live-avatar">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, 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-clip">, z.ZodLiteral<"lucy-2">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-motion-latest">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>;
6
+ declare const imageModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-image-2">, z.ZodLiteral<"lucy-image-latest">, z.ZodLiteral<"lucy-pro-i2i">]>;
7
+ declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"lucy">, z.ZodLiteral<"lucy-2">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.1-vton">, z.ZodLiteral<"lucy-restyle">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"live-avatar">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, 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-clip">, z.ZodLiteral<"lucy-2">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-motion-latest">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">, z.ZodLiteral<"lucy-2-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-image-2">, z.ZodLiteral<"lucy-image-latest">, 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>;
@@ -13,7 +13,7 @@ declare function isRealtimeModel(model: string): model is RealTimeModels;
13
13
  declare function isVideoModel(model: string): model is VideoModels;
14
14
  declare function isImageModel(model: string): model is ImageModels;
15
15
  declare const modelInputSchemas: {
16
- readonly "lucy-pro-v2v": z.ZodObject<{
16
+ readonly "lucy-clip": z.ZodObject<{
17
17
  prompt: z.ZodString;
18
18
  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<{
19
19
  uri: z.ZodString;
@@ -29,7 +29,7 @@ declare const modelInputSchemas: {
29
29
  resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
30
30
  enhance_prompt: z.ZodOptional<z.ZodBoolean>;
31
31
  }, z.core.$strip>;
32
- readonly "lucy-pro-i2i": z.ZodObject<{
32
+ readonly "lucy-image-2": z.ZodObject<{
33
33
  prompt: z.ZodString;
34
34
  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<{
35
35
  uri: z.ZodString;
@@ -48,6 +48,54 @@ declare const modelInputSchemas: {
48
48
  }>>>;
49
49
  enhance_prompt: z.ZodOptional<z.ZodBoolean>;
50
50
  }, z.core.$strip>;
51
+ readonly "lucy-restyle-2": z.ZodObject<{
52
+ prompt: z.ZodOptional<z.ZodString>;
53
+ 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<{
54
+ uri: z.ZodString;
55
+ type: z.ZodString;
56
+ name: z.ZodString;
57
+ }, z.core.$strip>]>>;
58
+ 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<{
59
+ uri: z.ZodString;
60
+ type: z.ZodString;
61
+ name: z.ZodString;
62
+ }, z.core.$strip>]>;
63
+ seed: z.ZodOptional<z.ZodNumber>;
64
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
65
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
66
+ }, z.core.$strip>;
67
+ readonly "lucy-2": z.ZodObject<{
68
+ prompt: z.ZodString;
69
+ 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<{
70
+ uri: z.ZodString;
71
+ type: z.ZodString;
72
+ name: z.ZodString;
73
+ }, z.core.$strip>]>>;
74
+ 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<{
75
+ uri: z.ZodString;
76
+ type: z.ZodString;
77
+ name: z.ZodString;
78
+ }, z.core.$strip>]>;
79
+ seed: z.ZodOptional<z.ZodNumber>;
80
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
81
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
82
+ }, z.core.$strip>;
83
+ readonly "lucy-2.1": z.ZodObject<{
84
+ prompt: z.ZodString;
85
+ 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<{
86
+ uri: z.ZodString;
87
+ type: z.ZodString;
88
+ name: z.ZodString;
89
+ }, z.core.$strip>]>>;
90
+ 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<{
91
+ uri: z.ZodString;
92
+ type: z.ZodString;
93
+ name: z.ZodString;
94
+ }, z.core.$strip>]>;
95
+ seed: z.ZodOptional<z.ZodNumber>;
96
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
97
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
98
+ }, z.core.$strip>;
51
99
  readonly "lucy-motion": z.ZodObject<{
52
100
  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<{
53
101
  uri: z.ZodString;
@@ -62,6 +110,122 @@ declare const modelInputSchemas: {
62
110
  seed: z.ZodOptional<z.ZodNumber>;
63
111
  resolution: z.ZodOptional<z.ZodDefault<z.ZodLiteral<"720p">>>;
64
112
  }, z.core.$strip>;
113
+ readonly "lucy-latest": z.ZodObject<{
114
+ prompt: z.ZodString;
115
+ 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<{
116
+ uri: z.ZodString;
117
+ type: z.ZodString;
118
+ name: z.ZodString;
119
+ }, z.core.$strip>]>>;
120
+ 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<{
121
+ uri: z.ZodString;
122
+ type: z.ZodString;
123
+ name: z.ZodString;
124
+ }, z.core.$strip>]>;
125
+ seed: z.ZodOptional<z.ZodNumber>;
126
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
127
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
128
+ }, z.core.$strip>;
129
+ readonly "lucy-restyle-latest": z.ZodObject<{
130
+ prompt: z.ZodOptional<z.ZodString>;
131
+ 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<{
132
+ uri: z.ZodString;
133
+ type: z.ZodString;
134
+ name: z.ZodString;
135
+ }, z.core.$strip>]>>;
136
+ 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<{
137
+ uri: z.ZodString;
138
+ type: z.ZodString;
139
+ name: z.ZodString;
140
+ }, z.core.$strip>]>;
141
+ seed: z.ZodOptional<z.ZodNumber>;
142
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
143
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
144
+ }, z.core.$strip>;
145
+ readonly "lucy-clip-latest": z.ZodObject<{
146
+ prompt: z.ZodString;
147
+ 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<{
148
+ uri: z.ZodString;
149
+ type: z.ZodString;
150
+ name: z.ZodString;
151
+ }, z.core.$strip>]>;
152
+ 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<{
153
+ uri: z.ZodString;
154
+ type: z.ZodString;
155
+ name: z.ZodString;
156
+ }, z.core.$strip>]>>;
157
+ seed: z.ZodOptional<z.ZodNumber>;
158
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
159
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
160
+ }, z.core.$strip>;
161
+ readonly "lucy-motion-latest": z.ZodObject<{
162
+ 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<{
163
+ uri: z.ZodString;
164
+ type: z.ZodString;
165
+ name: z.ZodString;
166
+ }, z.core.$strip>]>;
167
+ trajectory: z.ZodArray<z.ZodObject<{
168
+ frame: z.ZodNumber;
169
+ x: z.ZodNumber;
170
+ y: z.ZodNumber;
171
+ }, z.core.$strip>>;
172
+ seed: z.ZodOptional<z.ZodNumber>;
173
+ resolution: z.ZodOptional<z.ZodDefault<z.ZodLiteral<"720p">>>;
174
+ }, z.core.$strip>;
175
+ readonly "lucy-image-latest": z.ZodObject<{
176
+ prompt: z.ZodString;
177
+ 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<{
178
+ uri: z.ZodString;
179
+ type: z.ZodString;
180
+ name: z.ZodString;
181
+ }, z.core.$strip>]>;
182
+ 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<{
183
+ uri: z.ZodString;
184
+ type: z.ZodString;
185
+ name: z.ZodString;
186
+ }, z.core.$strip>]>>;
187
+ seed: z.ZodOptional<z.ZodNumber>;
188
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
189
+ "720p": "720p";
190
+ "480p": "480p";
191
+ }>>>;
192
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
193
+ }, z.core.$strip>;
194
+ readonly "lucy-pro-v2v": z.ZodObject<{
195
+ prompt: z.ZodString;
196
+ 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<{
197
+ uri: z.ZodString;
198
+ type: z.ZodString;
199
+ name: z.ZodString;
200
+ }, z.core.$strip>]>;
201
+ 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<{
202
+ uri: z.ZodString;
203
+ type: z.ZodString;
204
+ name: z.ZodString;
205
+ }, z.core.$strip>]>>;
206
+ seed: z.ZodOptional<z.ZodNumber>;
207
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
208
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
209
+ }, z.core.$strip>;
210
+ readonly "lucy-pro-i2i": z.ZodObject<{
211
+ prompt: z.ZodString;
212
+ 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<{
213
+ uri: z.ZodString;
214
+ type: z.ZodString;
215
+ name: z.ZodString;
216
+ }, z.core.$strip>]>;
217
+ 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<{
218
+ uri: z.ZodString;
219
+ type: z.ZodString;
220
+ name: z.ZodString;
221
+ }, z.core.$strip>]>>;
222
+ seed: z.ZodOptional<z.ZodNumber>;
223
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
224
+ "720p": "720p";
225
+ "480p": "480p";
226
+ }>>>;
227
+ enhance_prompt: z.ZodOptional<z.ZodBoolean>;
228
+ }, z.core.$strip>;
65
229
  readonly "lucy-restyle-v2v": z.ZodObject<{
66
230
  prompt: z.ZodOptional<z.ZodString>;
67
231
  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<{
@@ -116,32 +280,55 @@ type CustomModelDefinition = Omit<ModelDefinition, "name" | "inputSchema"> & {
116
280
  /**
117
281
  * Type alias for model definitions that support synchronous processing.
118
282
  * Only image models support the sync/process API.
283
+ * Requires `queueUrlPath` to distinguish from realtime definitions of the same model name.
119
284
  */
120
- type ImageModelDefinition = ModelDefinition<ImageModels>;
285
+ type ImageModelDefinition = ModelDefinition<ImageModels> & {
286
+ queueUrlPath: string;
287
+ };
121
288
  /**
122
289
  * Type alias for model definitions that support queue processing.
123
290
  * Only video models support the queue API.
291
+ * Requires `queueUrlPath` to distinguish from realtime definitions of the same model name.
124
292
  */
125
- type VideoModelDefinition = ModelDefinition<VideoModels>;
293
+ type VideoModelDefinition = ModelDefinition<VideoModels> & {
294
+ queueUrlPath: string;
295
+ };
126
296
  declare const models: {
297
+ /**
298
+ * Get a realtime streaming model identifier.
299
+ *
300
+ * Available options:
301
+ * - `"lucy-2"` - Lucy 2 realtime video editing (720p)
302
+ * - `"lucy-2.1"` - Lucy 2.1 realtime video editing
303
+ * - `"lucy-2.1-vton"` - Lucy 2.1 virtual try-on
304
+ * - `"lucy-restyle-2"` - Realtime video restyling
305
+ * - `"lucy-restyle"` - Legacy realtime restyling
306
+ * - `"lucy"` - Legacy Lucy realtime
307
+ * - `"live-avatar"` - Live avatar
308
+ */
127
309
  realtime: <T extends RealTimeModels>(model: T) => ModelDefinition<T>;
128
310
  /**
129
311
  * Get a video model identifier.
130
312
  *
131
313
  * Available options:
132
- * - `"lucy-pro-v2v"` - Video-to-video
133
- * - `"lucy-restyle-v2v"` - Video-to-video (Restyling)
134
- * - `"lucy-2-v2v"` - Video-to-video (Long-form editing, 720p)
314
+ * - `"lucy-clip"` - Video-to-video editing
315
+ * - `"lucy-2"` - Long-form video editing (720p)
316
+ * - `"lucy-2.1"` - Long-form video editing (Lucy 2.1)
317
+ * - `"lucy-restyle-2"` - Video restyling
135
318
  * - `"lucy-motion"` - Motion generation
136
319
  */
137
- video: <T extends VideoModels>(model: T) => ModelDefinition<T>;
320
+ video: <T extends VideoModels>(model: T) => ModelDefinition<T> & {
321
+ queueUrlPath: string;
322
+ };
138
323
  /**
139
324
  * Get an image model identifier.
140
325
  *
141
326
  * Available options:
142
- * - `"lucy-pro-i2i"` - Image-to-image
327
+ * - `"lucy-image-2"` - Image-to-image editing
143
328
  */
144
- image: <T extends ImageModels>(model: T) => ModelDefinition<T>;
329
+ image: <T extends ImageModels>(model: T) => ModelDefinition<T> & {
330
+ queueUrlPath: string;
331
+ };
145
332
  };
146
333
  //#endregion
147
334
  export { CustomModelDefinition, ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, isImageModel, isRealtimeModel, isVideoModel, models };
@@ -2,7 +2,40 @@ import { createModelNotFoundError } from "../utils/errors.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/shared/model.ts
5
+ /**
6
+ * Map of deprecated model names to their canonical replacements.
7
+ * Old names still work but will log a deprecation warning.
8
+ */
9
+ const MODEL_ALIASES = {
10
+ mirage: "lucy-restyle",
11
+ mirage_v2: "lucy-restyle-2",
12
+ lucy_v2v_720p_rt: "lucy",
13
+ lucy_2_rt: "lucy-2",
14
+ live_avatar: "live-avatar",
15
+ "lucy-pro-v2v": "lucy-clip",
16
+ "lucy-restyle-v2v": "lucy-restyle-2",
17
+ "lucy-2-v2v": "lucy-2",
18
+ "lucy-pro-i2i": "lucy-image-2"
19
+ };
20
+ const _warnedAliases = /* @__PURE__ */ new Set();
21
+ function warnDeprecated(model) {
22
+ const canonical = MODEL_ALIASES[model];
23
+ if (canonical && !_warnedAliases.has(model)) {
24
+ _warnedAliases.add(model);
25
+ console.warn(`[Decart SDK] Model "${model}" is deprecated. Use "${canonical}" instead. See https://docs.platform.decart.ai/models for details.`);
26
+ }
27
+ }
5
28
  const realtimeModels = z.union([
29
+ z.literal("lucy"),
30
+ z.literal("lucy-2"),
31
+ z.literal("lucy-2.1"),
32
+ z.literal("lucy-2.1-vton"),
33
+ z.literal("lucy-restyle"),
34
+ z.literal("lucy-restyle-2"),
35
+ z.literal("live-avatar"),
36
+ z.literal("lucy-latest"),
37
+ z.literal("lucy-vton-latest"),
38
+ z.literal("lucy-restyle-latest"),
6
39
  z.literal("mirage"),
7
40
  z.literal("mirage_v2"),
8
41
  z.literal("lucy_v2v_720p_rt"),
@@ -10,12 +43,24 @@ const realtimeModels = z.union([
10
43
  z.literal("live_avatar")
11
44
  ]);
12
45
  const videoModels = z.union([
13
- z.literal("lucy-pro-v2v"),
46
+ z.literal("lucy-clip"),
47
+ z.literal("lucy-2"),
48
+ z.literal("lucy-2.1"),
49
+ z.literal("lucy-restyle-2"),
14
50
  z.literal("lucy-motion"),
51
+ z.literal("lucy-latest"),
52
+ z.literal("lucy-restyle-latest"),
53
+ z.literal("lucy-clip-latest"),
54
+ z.literal("lucy-motion-latest"),
55
+ z.literal("lucy-pro-v2v"),
15
56
  z.literal("lucy-restyle-v2v"),
16
57
  z.literal("lucy-2-v2v")
17
58
  ]);
18
- const imageModels = z.literal("lucy-pro-i2i");
59
+ const imageModels = z.union([
60
+ z.literal("lucy-image-2"),
61
+ z.literal("lucy-image-latest"),
62
+ z.literal("lucy-pro-i2i")
63
+ ]);
19
64
  const modelSchema = z.union([
20
65
  realtimeModels,
21
66
  videoModels,
@@ -54,26 +99,47 @@ const proResolutionSchema = () => {
54
99
  */
55
100
  const motionResolutionSchema = z.literal("720p").default("720p").optional().describe("The resolution to use for the generation");
56
101
  /**
57
- * Resolution schema for lucy-pro-v2v (supports 720p).
102
+ * Resolution schema for video-to-video models (supports 720p).
58
103
  */
59
- const proV2vResolutionSchema = z.literal("720p").optional().describe("The resolution to use for the generation").default("720p");
104
+ const v2vResolutionSchema = z.literal("720p").optional().describe("The resolution to use for the generation").default("720p");
105
+ const videoEditSchema = z.object({
106
+ prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
107
+ data: fileInputSchema.describe("The video data to use for generation (File, Blob, ReadableStream, URL, or string URL). Output video is limited to 5 seconds."),
108
+ reference_image: fileInputSchema.optional().describe("Optional reference image to guide what to add to the video (File, Blob, ReadableStream, URL, or string URL)"),
109
+ seed: z.number().optional().describe("The seed to use for the generation"),
110
+ resolution: v2vResolutionSchema,
111
+ enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
112
+ });
113
+ const imageEditSchema = z.object({
114
+ prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
115
+ data: fileInputSchema.describe("The image data to use for generation (File, Blob, ReadableStream, URL, or string URL)"),
116
+ reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
117
+ seed: z.number().optional().describe("The seed to use for the generation"),
118
+ resolution: proResolutionSchema(),
119
+ enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
120
+ });
121
+ const restyleSchema = z.object({
122
+ prompt: z.string().min(1).max(1e3).optional().describe("Text prompt for the video editing"),
123
+ reference_image: fileInputSchema.optional().describe("Reference image to transform into a prompt (File, Blob, ReadableStream, URL, or string URL)"),
124
+ data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
125
+ seed: z.number().optional().describe("Seed for the video generation"),
126
+ resolution: v2vResolutionSchema,
127
+ enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt (only valid with text prompt, defaults to true on backend)")
128
+ }).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'" });
129
+ const videoEdit2Schema = z.object({
130
+ prompt: z.string().max(1e3).describe("Text prompt for the video editing. Send an empty string if you want no text prompt."),
131
+ reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
132
+ data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
133
+ seed: z.number().optional().describe("The seed to use for the generation"),
134
+ resolution: v2vResolutionSchema,
135
+ enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
136
+ });
60
137
  const modelInputSchemas = {
61
- "lucy-pro-v2v": z.object({
62
- prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
63
- data: fileInputSchema.describe("The video data to use for generation (File, Blob, ReadableStream, URL, or string URL). Output video is limited to 5 seconds."),
64
- reference_image: fileInputSchema.optional().describe("Optional reference image to guide what to add to the video (File, Blob, ReadableStream, URL, or string URL)"),
65
- seed: z.number().optional().describe("The seed to use for the generation"),
66
- resolution: proV2vResolutionSchema,
67
- enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
68
- }),
69
- "lucy-pro-i2i": z.object({
70
- prompt: z.string().min(1).max(1e3).describe("The prompt to use for the generation"),
71
- data: fileInputSchema.describe("The image data to use for generation (File, Blob, ReadableStream, URL, or string URL)"),
72
- reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
73
- seed: z.number().optional().describe("The seed to use for the generation"),
74
- resolution: proResolutionSchema(),
75
- enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
76
- }),
138
+ "lucy-clip": videoEditSchema,
139
+ "lucy-image-2": imageEditSchema,
140
+ "lucy-restyle-2": restyleSchema,
141
+ "lucy-2": videoEdit2Schema,
142
+ "lucy-2.1": videoEdit2Schema,
77
143
  "lucy-motion": z.object({
78
144
  data: fileInputSchema.describe("The image data to use for generation (File, Blob, ReadableStream, URL, or string URL). Output video is limited to 5 seconds."),
79
145
  trajectory: z.array(z.object({
@@ -84,22 +150,24 @@ const modelInputSchemas = {
84
150
  seed: z.number().optional().describe("The seed to use for the generation"),
85
151
  resolution: motionResolutionSchema
86
152
  }),
87
- "lucy-restyle-v2v": z.object({
88
- prompt: z.string().min(1).max(1e3).optional().describe("Text prompt for the video editing"),
89
- reference_image: fileInputSchema.optional().describe("Reference image to transform into a prompt (File, Blob, ReadableStream, URL, or string URL)"),
90
- data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
91
- seed: z.number().optional().describe("Seed for the video generation"),
92
- resolution: proV2vResolutionSchema,
93
- enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt (only valid with text prompt, defaults to true on backend)")
94
- }).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'" }),
95
- "lucy-2-v2v": z.object({
96
- prompt: z.string().max(1e3).describe("Text prompt for the video editing. Send an empty string if you want no text prompt."),
97
- reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
98
- data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
153
+ "lucy-latest": videoEdit2Schema,
154
+ "lucy-restyle-latest": restyleSchema,
155
+ "lucy-clip-latest": videoEditSchema,
156
+ "lucy-motion-latest": z.object({
157
+ data: fileInputSchema.describe("The image data to use for generation (File, Blob, ReadableStream, URL, or string URL). Output video is limited to 5 seconds."),
158
+ trajectory: z.array(z.object({
159
+ frame: z.number().min(0),
160
+ x: z.number().min(0),
161
+ y: z.number().min(0)
162
+ })).min(2).max(1e3).describe("The trajectory of the desired movement of the object in the image"),
99
163
  seed: z.number().optional().describe("The seed to use for the generation"),
100
- resolution: proV2vResolutionSchema,
101
- enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
102
- })
164
+ resolution: motionResolutionSchema
165
+ }),
166
+ "lucy-image-latest": imageEditSchema,
167
+ "lucy-pro-v2v": videoEditSchema,
168
+ "lucy-pro-i2i": imageEditSchema,
169
+ "lucy-restyle-v2v": restyleSchema,
170
+ "lucy-2-v2v": videoEdit2Schema
103
171
  };
104
172
  const modelDefinitionSchema = z.object({
105
173
  name: z.string(),
@@ -112,6 +180,86 @@ const modelDefinitionSchema = z.object({
112
180
  });
113
181
  const _models = {
114
182
  realtime: {
183
+ lucy: {
184
+ urlPath: "/v1/stream",
185
+ name: "lucy",
186
+ fps: 25,
187
+ width: 1280,
188
+ height: 704,
189
+ inputSchema: z.object({})
190
+ },
191
+ "lucy-2": {
192
+ urlPath: "/v1/stream",
193
+ name: "lucy-2",
194
+ fps: 20,
195
+ width: 1280,
196
+ height: 720,
197
+ inputSchema: z.object({})
198
+ },
199
+ "lucy-2.1": {
200
+ urlPath: "/v1/stream",
201
+ name: "lucy-2.1",
202
+ fps: 20,
203
+ width: 1088,
204
+ height: 624,
205
+ inputSchema: z.object({})
206
+ },
207
+ "lucy-2.1-vton": {
208
+ urlPath: "/v1/stream",
209
+ name: "lucy-2.1-vton",
210
+ fps: 20,
211
+ width: 1088,
212
+ height: 624,
213
+ inputSchema: z.object({})
214
+ },
215
+ "lucy-restyle": {
216
+ urlPath: "/v1/stream",
217
+ name: "lucy-restyle",
218
+ fps: 25,
219
+ width: 1280,
220
+ height: 704,
221
+ inputSchema: z.object({})
222
+ },
223
+ "lucy-restyle-2": {
224
+ urlPath: "/v1/stream",
225
+ name: "lucy-restyle-2",
226
+ fps: 22,
227
+ width: 1280,
228
+ height: 704,
229
+ inputSchema: z.object({})
230
+ },
231
+ "live-avatar": {
232
+ urlPath: "/v1/stream",
233
+ name: "live-avatar",
234
+ fps: 25,
235
+ width: 1280,
236
+ height: 720,
237
+ inputSchema: z.object({})
238
+ },
239
+ "lucy-latest": {
240
+ urlPath: "/v1/stream",
241
+ name: "lucy-latest",
242
+ fps: 20,
243
+ width: 1088,
244
+ height: 624,
245
+ inputSchema: z.object({})
246
+ },
247
+ "lucy-vton-latest": {
248
+ urlPath: "/v1/stream",
249
+ name: "lucy-vton-latest",
250
+ fps: 20,
251
+ width: 1088,
252
+ height: 624,
253
+ inputSchema: z.object({})
254
+ },
255
+ "lucy-restyle-latest": {
256
+ urlPath: "/v1/stream",
257
+ name: "lucy-restyle-latest",
258
+ fps: 22,
259
+ width: 1280,
260
+ height: 704,
261
+ inputSchema: z.object({})
262
+ },
115
263
  mirage: {
116
264
  urlPath: "/v1/stream",
117
265
  name: "mirage",
@@ -153,24 +301,71 @@ const _models = {
153
301
  inputSchema: z.object({})
154
302
  }
155
303
  },
156
- image: { "lucy-pro-i2i": {
157
- urlPath: "/v1/generate/lucy-pro-i2i",
158
- queueUrlPath: "/v1/jobs/lucy-pro-i2i",
159
- name: "lucy-pro-i2i",
160
- fps: 25,
161
- width: 1280,
162
- height: 704,
163
- inputSchema: modelInputSchemas["lucy-pro-i2i"]
164
- } },
304
+ image: {
305
+ "lucy-image-2": {
306
+ urlPath: "/v1/generate/lucy-image-2",
307
+ queueUrlPath: "/v1/jobs/lucy-image-2",
308
+ name: "lucy-image-2",
309
+ fps: 25,
310
+ width: 1280,
311
+ height: 704,
312
+ inputSchema: modelInputSchemas["lucy-image-2"]
313
+ },
314
+ "lucy-image-latest": {
315
+ urlPath: "/v1/generate/lucy-image-latest",
316
+ queueUrlPath: "/v1/jobs/lucy-image-latest",
317
+ name: "lucy-image-latest",
318
+ fps: 25,
319
+ width: 1280,
320
+ height: 704,
321
+ inputSchema: modelInputSchemas["lucy-image-latest"]
322
+ },
323
+ "lucy-pro-i2i": {
324
+ urlPath: "/v1/generate/lucy-pro-i2i",
325
+ queueUrlPath: "/v1/jobs/lucy-pro-i2i",
326
+ name: "lucy-pro-i2i",
327
+ fps: 25,
328
+ width: 1280,
329
+ height: 704,
330
+ inputSchema: modelInputSchemas["lucy-pro-i2i"]
331
+ }
332
+ },
165
333
  video: {
166
- "lucy-pro-v2v": {
167
- urlPath: "/v1/generate/lucy-pro-v2v",
168
- queueUrlPath: "/v1/jobs/lucy-pro-v2v",
169
- name: "lucy-pro-v2v",
334
+ "lucy-clip": {
335
+ urlPath: "/v1/generate/lucy-clip",
336
+ queueUrlPath: "/v1/jobs/lucy-clip",
337
+ name: "lucy-clip",
170
338
  fps: 25,
171
339
  width: 1280,
172
340
  height: 704,
173
- inputSchema: modelInputSchemas["lucy-pro-v2v"]
341
+ inputSchema: modelInputSchemas["lucy-clip"]
342
+ },
343
+ "lucy-2": {
344
+ urlPath: "/v1/generate/lucy-2",
345
+ queueUrlPath: "/v1/jobs/lucy-2",
346
+ name: "lucy-2",
347
+ fps: 20,
348
+ width: 1280,
349
+ height: 720,
350
+ inputSchema: modelInputSchemas["lucy-2"]
351
+ },
352
+ "lucy-2.1": {
353
+ urlPath: "/v1/generate/lucy-2.1",
354
+ queueUrlPath: "/v1/jobs/lucy-2.1",
355
+ name: "lucy-2.1",
356
+ fps: 20,
357
+ width: 1088,
358
+ height: 624,
359
+ inputSchema: modelInputSchemas["lucy-2.1"]
360
+ },
361
+ "lucy-restyle-2": {
362
+ urlPath: "/v1/generate/lucy-restyle-2",
363
+ queueUrlPath: "/v1/jobs/lucy-restyle-2",
364
+ name: "lucy-restyle-2",
365
+ fps: 22,
366
+ width: 1280,
367
+ height: 704,
368
+ inputSchema: modelInputSchemas["lucy-restyle-2"]
174
369
  },
175
370
  "lucy-motion": {
176
371
  urlPath: "/v1/generate/lucy-motion",
@@ -181,6 +376,51 @@ const _models = {
181
376
  height: 704,
182
377
  inputSchema: modelInputSchemas["lucy-motion"]
183
378
  },
379
+ "lucy-latest": {
380
+ urlPath: "/v1/generate/lucy-latest",
381
+ queueUrlPath: "/v1/jobs/lucy-latest",
382
+ name: "lucy-latest",
383
+ fps: 20,
384
+ width: 1088,
385
+ height: 624,
386
+ inputSchema: modelInputSchemas["lucy-latest"]
387
+ },
388
+ "lucy-restyle-latest": {
389
+ urlPath: "/v1/generate/lucy-restyle-latest",
390
+ queueUrlPath: "/v1/jobs/lucy-restyle-latest",
391
+ name: "lucy-restyle-latest",
392
+ fps: 22,
393
+ width: 1280,
394
+ height: 704,
395
+ inputSchema: modelInputSchemas["lucy-restyle-latest"]
396
+ },
397
+ "lucy-clip-latest": {
398
+ urlPath: "/v1/generate/lucy-clip-latest",
399
+ queueUrlPath: "/v1/jobs/lucy-clip-latest",
400
+ name: "lucy-clip-latest",
401
+ fps: 25,
402
+ width: 1280,
403
+ height: 704,
404
+ inputSchema: modelInputSchemas["lucy-clip-latest"]
405
+ },
406
+ "lucy-motion-latest": {
407
+ urlPath: "/v1/generate/lucy-motion-latest",
408
+ queueUrlPath: "/v1/jobs/lucy-motion-latest",
409
+ name: "lucy-motion-latest",
410
+ fps: 25,
411
+ width: 1280,
412
+ height: 704,
413
+ inputSchema: modelInputSchemas["lucy-motion-latest"]
414
+ },
415
+ "lucy-pro-v2v": {
416
+ urlPath: "/v1/generate/lucy-pro-v2v",
417
+ queueUrlPath: "/v1/jobs/lucy-pro-v2v",
418
+ name: "lucy-pro-v2v",
419
+ fps: 25,
420
+ width: 1280,
421
+ height: 704,
422
+ inputSchema: modelInputSchemas["lucy-pro-v2v"]
423
+ },
184
424
  "lucy-restyle-v2v": {
185
425
  urlPath: "/v1/generate/lucy-restyle-v2v",
186
426
  queueUrlPath: "/v1/jobs/lucy-restyle-v2v",
@@ -203,16 +443,19 @@ const _models = {
203
443
  };
204
444
  const models = {
205
445
  realtime: (model) => {
446
+ warnDeprecated(model);
206
447
  const modelDefinition = _models.realtime[model];
207
448
  if (!modelDefinition) throw createModelNotFoundError(model);
208
449
  return modelDefinition;
209
450
  },
210
451
  video: (model) => {
452
+ warnDeprecated(model);
211
453
  const modelDefinition = _models.video[model];
212
454
  if (!modelDefinition) throw createModelNotFoundError(model);
213
455
  return modelDefinition;
214
456
  },
215
457
  image: (model) => {
458
+ warnDeprecated(model);
216
459
  const modelDefinition = _models.image[model];
217
460
  if (!modelDefinition) throw createModelNotFoundError(model);
218
461
  return modelDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",