@decartai/sdk 0.0.25 → 0.0.27

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ImageModelDefinition, ImageModels, Model, ModelDefinition, RealTimeModels, VideoModelDefinition, VideoModels, models } from "./shared/model.js";
1
+ import { ImageModelDefinition, ImageModels, Model, ModelDefinition, RealTimeModels, VideoModelDefinition, VideoModels, isImageModel, isRealtimeModel, isVideoModel, models } from "./shared/model.js";
2
2
  import { FileInput, ProcessOptions } from "./process/types.js";
3
3
  import { ProcessClient } from "./process/client.js";
4
4
  import { JobStatus, JobStatusResponse, JobSubmitResponse, QueueJobResult, QueueSubmitAndPollOptions, QueueSubmitOptions } from "./queue/types.js";
@@ -109,4 +109,4 @@ declare const createDecartClient: (options?: DecartClientOptions) => {
109
109
  tokens: TokensClient;
110
110
  };
111
111
  //#endregion
112
- export { type CreateTokenResponse, DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, type ImageModelDefinition, type ImageModels, type JobStatus, type JobStatusResponse, type JobSubmitResponse, type Model, type ModelDefinition, type ModelState, type ProcessClient, type ProcessOptions, type QueueClient, type QueueJobResult, type QueueSubmitAndPollOptions, type QueueSubmitOptions, type RealTimeClient, type RealTimeClientConnectOptions, type RealTimeClientInitialState, type RealTimeModels, type TokensClient, type VideoModelDefinition, type VideoModels, createDecartClient, models };
112
+ export { type CreateTokenResponse, DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, type ImageModelDefinition, type ImageModels, type JobStatus, type JobStatusResponse, type JobSubmitResponse, type Model, type ModelDefinition, type ModelState, type ProcessClient, type ProcessOptions, type QueueClient, type QueueJobResult, type QueueSubmitAndPollOptions, type QueueSubmitOptions, type RealTimeClient, type RealTimeClientConnectOptions, type RealTimeClientInitialState, type RealTimeModels, type TokensClient, type VideoModelDefinition, type VideoModels, createDecartClient, isImageModel, isRealtimeModel, isVideoModel, models };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ERROR_CODES, createInvalidApiKeyError, createInvalidBaseUrlError } from "./utils/errors.js";
2
2
  import { createProcessClient } from "./process/client.js";
3
3
  import { createQueueClient } from "./queue/client.js";
4
- import { models } from "./shared/model.js";
4
+ import { isImageModel, isRealtimeModel, isVideoModel, models } from "./shared/model.js";
5
5
  import { createRealTimeClient } from "./realtime/client.js";
6
6
  import { createTokensClient } from "./tokens/client.js";
7
7
  import { readEnv } from "./utils/env.js";
@@ -67,4 +67,4 @@ const createDecartClient = (options = {}) => {
67
67
  };
68
68
 
69
69
  //#endregion
70
- export { ERROR_CODES, createDecartClient, models };
70
+ export { ERROR_CODES, createDecartClient, isImageModel, isRealtimeModel, isVideoModel, models };
@@ -13,7 +13,7 @@ type OnRemoteStreamFn = (stream: MediaStream) => void;
13
13
  type RealTimeClientInitialState = z.infer<typeof realTimeClientInitialStateSchema>;
14
14
  declare const realTimeClientConnectOptionsSchema: z.ZodObject<{
15
15
  model: z.ZodObject<{
16
- name: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">]>, 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-pro-flf2v">, z.ZodLiteral<"lucy-motion">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
16
+ name: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">]>, 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-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
17
17
  urlPath: z.ZodString;
18
18
  queueUrlPath: z.ZodOptional<z.ZodString>;
19
19
  fps: z.ZodNumber;
@@ -2,13 +2,16 @@ 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">]>;
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-pro-flf2v">, z.ZodLiteral<"lucy-motion">]>;
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-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-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.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-pro-flf2v">, z.ZodLiteral<"lucy-motion">]>, 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.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-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-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>;
11
11
  type ImageModels = z.infer<typeof imageModels>;
12
+ declare function isRealtimeModel(model: string): model is RealTimeModels;
13
+ declare function isVideoModel(model: string): model is VideoModels;
14
+ declare function isImageModel(model: string): model is ImageModels;
12
15
  declare const modelInputSchemas: {
13
16
  readonly "lucy-pro-t2v": z.ZodObject<{
14
17
  prompt: z.ZodString;
@@ -88,6 +91,13 @@ declare const modelInputSchemas: {
88
91
  seed: z.ZodOptional<z.ZodNumber>;
89
92
  resolution: z.ZodOptional<z.ZodDefault<z.ZodLiteral<"720p">>>;
90
93
  }, z.core.$strip>;
94
+ readonly "lucy-restyle-v2v": z.ZodObject<{
95
+ prompt: z.ZodString;
96
+ data: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL]>;
97
+ seed: z.ZodOptional<z.ZodNumber>;
98
+ resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
99
+ enhance_prompt: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
100
+ }, z.core.$strip>;
91
101
  };
92
102
  type ModelInputSchemas = typeof modelInputSchemas;
93
103
  type ModelDefinition<T extends Model = Model> = {
@@ -121,6 +131,7 @@ declare const models: {
121
131
  * - `"lucy-pro-flf2v"` - First-last-frame-to-video
122
132
  * - `"lucy-dev-i2v"` - Image-to-video (Dev quality)
123
133
  * - `"lucy-fast-v2v"` - Video-to-video (Fast quality)
134
+ * - `"lucy-restyle-v2v"` - Video-to-video (Restyling)
124
135
  */
125
136
  video: <T extends VideoModels>(model: T) => ModelDefinition<T>;
126
137
  /**
@@ -133,4 +144,4 @@ declare const models: {
133
144
  image: <T extends ImageModels>(model: T) => ModelDefinition<T>;
134
145
  };
135
146
  //#endregion
136
- export { ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, models };
147
+ export { ImageModelDefinition, ImageModels, Model, ModelDefinition, ModelInputSchemas, RealTimeModels, VideoModelDefinition, VideoModels, isImageModel, isRealtimeModel, isVideoModel, models };
@@ -14,7 +14,8 @@ const videoModels = z.union([
14
14
  z.literal("lucy-pro-i2v"),
15
15
  z.literal("lucy-pro-v2v"),
16
16
  z.literal("lucy-pro-flf2v"),
17
- z.literal("lucy-motion")
17
+ z.literal("lucy-motion"),
18
+ z.literal("lucy-restyle-v2v")
18
19
  ]);
19
20
  const imageModels = z.union([z.literal("lucy-pro-t2i"), z.literal("lucy-pro-i2i")]);
20
21
  const modelSchema = z.union([
@@ -22,6 +23,15 @@ const modelSchema = z.union([
22
23
  videoModels,
23
24
  imageModels
24
25
  ]);
26
+ function isRealtimeModel(model) {
27
+ return realtimeModels.safeParse(model).success;
28
+ }
29
+ function isVideoModel(model) {
30
+ return videoModels.safeParse(model).success;
31
+ }
32
+ function isImageModel(model) {
33
+ return imageModels.safeParse(model).success;
34
+ }
25
35
  const fileInputSchema = z.union([
26
36
  z.instanceof(File),
27
37
  z.instanceof(Blob),
@@ -111,6 +121,13 @@ const modelInputSchemas = {
111
121
  })).min(2).max(1e3).describe("The trajectory of the desired movement of the object in the image"),
112
122
  seed: z.number().optional().describe("The seed to use for the generation"),
113
123
  resolution: motionResolutionSchema
124
+ }),
125
+ "lucy-restyle-v2v": z.object({
126
+ prompt: z.string().min(1).max(1e3).describe("Text prompt for the video editing"),
127
+ data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
128
+ seed: z.number().optional().describe("Seed for the video generation"),
129
+ resolution: proV2vResolutionSchema,
130
+ enhance_prompt: z.boolean().default(true).optional().describe("Whether to enhance the prompt")
114
131
  })
115
132
  };
116
133
  const modelDefinitionSchema = z.object({
@@ -232,6 +249,15 @@ const _models = {
232
249
  width: 1280,
233
250
  height: 704,
234
251
  inputSchema: modelInputSchemas["lucy-motion"]
252
+ },
253
+ "lucy-restyle-v2v": {
254
+ urlPath: "/v1/generate/lucy-restyle-v2v",
255
+ queueUrlPath: "/v1/jobs/lucy-restyle-v2v",
256
+ name: "lucy-restyle-v2v",
257
+ fps: 22,
258
+ width: 1280,
259
+ height: 704,
260
+ inputSchema: modelInputSchemas["lucy-restyle-v2v"]
235
261
  }
236
262
  }
237
263
  };
@@ -254,4 +280,4 @@ const models = {
254
280
  };
255
281
 
256
282
  //#endregion
257
- export { modelDefinitionSchema, models };
283
+ export { isImageModel, isRealtimeModel, isVideoModel, modelDefinitionSchema, models };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",