diff --git a/examples/express-api/src/server.ts b/examples/express-api/src/server.ts index 2c5b1db..5994ee4 100644 --- a/examples/express-api/src/server.ts +++ b/examples/express-api/src/server.ts @@ -3,7 +3,7 @@ import express from "express"; import { createDecartClient, models } from "@decartai/sdk"; const app = express(); -app.use(express.json()); +app.use(express.json({ limit: "50mb" })); const client = createDecartClient({ apiKey: process.env.DECART_API_KEY!, diff --git a/examples/sdk-core/README.md b/examples/sdk-core/README.md index f5995a8..f1caa03 100644 --- a/examples/sdk-core/README.md +++ b/examples/sdk-core/README.md @@ -21,8 +21,8 @@ pnpm build ```sh cd examples/sdk-core -pnpm tsx video/text-to-video.ts -pnpm tsx image/text-to-image.ts +pnpm tsx video/video-to-video.ts +pnpm tsx image/image-to-image.ts ``` ## Examples @@ -31,16 +31,13 @@ pnpm tsx image/text-to-image.ts Image models use the synchronous Process API - they return immediately with a Blob. -- `image/text-to-image.ts` - Edit image with a prompt (`lucy-pro-i2i`) -- `image/image-to-image.ts` - Transform existing image +- `image/image-to-image.ts` - Transform existing image with a prompt (`lucy-pro-i2i`) ### Video Generation Video models use the asynchronous Queue API - jobs are submitted and polled for completion. -- `video/text-to-video.ts` - Edit video with a prompt (`lucy-pro-v2v`) -- `video/image-to-video.ts` - Edit video with a prompt (`lucy-pro-v2v`) -- `video/video-to-video.ts` - Transform existing video +- `video/video-to-video.ts` - Transform existing video with a prompt (`lucy-pro-v2v`) - `video/video-editing.ts` - Edit video with prompt, reference image, or both (`lucy-2-v2v`) - `video/long-form-video-restyle.ts` - Transform existing video with `lucy-restyle-v2v` - `video/manual-polling.ts` - Manual job status polling diff --git a/examples/sdk-core/image/text-to-image.ts b/examples/sdk-core/image/text-to-image.ts deleted file mode 100644 index f498e45..0000000 --- a/examples/sdk-core/image/text-to-image.ts +++ /dev/null @@ -1,24 +0,0 @@ -import fs from "node:fs"; -import { createDecartClient, models } from "@decartai/sdk"; -import { run } from "../lib/run"; - -run(async () => { - const client = createDecartClient({ - apiKey: process.env.DECART_API_KEY!, - }); - - console.log("Editing image..."); - - const inputImage = fs.readFileSync("input.png"); - - const blob = await client.process({ - model: models.image("lucy-pro-i2i"), - prompt: "A cyberpunk cityscape at night with neon lights", - data: new Blob([inputImage]), - }); - - // Save to file - const output = Buffer.from(await blob.arrayBuffer()); - fs.writeFileSync("output.png", output); - console.log("Image saved to output.png"); -}); diff --git a/examples/sdk-core/video/image-to-video.ts b/examples/sdk-core/video/image-to-video.ts deleted file mode 100644 index 206e9c6..0000000 --- a/examples/sdk-core/video/image-to-video.ts +++ /dev/null @@ -1,30 +0,0 @@ -import fs from "node:fs"; -import { createDecartClient, models } from "@decartai/sdk"; -import { run } from "../lib/run"; - -run(async () => { - const client = createDecartClient({ - apiKey: process.env.DECART_API_KEY!, - }); - - console.log("Editing video..."); - - const inputVideo = fs.readFileSync("input.mp4"); - - const result = await client.queue.submitAndPoll({ - model: models.video("lucy-pro-v2v"), - prompt: "The scene transforms with a vibrant new style", - data: new Blob([inputVideo]), - onStatusChange: (job) => { - console.log(`Job ${job.job_id}: ${job.status}`); - }, - }); - - if (result.status === "completed") { - const output = Buffer.from(await result.data.arrayBuffer()); - fs.writeFileSync("output.mp4", output); - console.log("Video saved to output.mp4"); - } else { - console.log("Job failed:", result.error); - } -}); diff --git a/examples/sdk-core/video/text-to-video.ts b/examples/sdk-core/video/text-to-video.ts deleted file mode 100644 index 09967c4..0000000 --- a/examples/sdk-core/video/text-to-video.ts +++ /dev/null @@ -1,30 +0,0 @@ -import fs from "node:fs"; -import { createDecartClient, models } from "@decartai/sdk"; -import { run } from "../lib/run"; - -run(async () => { - const client = createDecartClient({ - apiKey: process.env.DECART_API_KEY!, - }); - - console.log("Editing video..."); - - const inputVideo = fs.readFileSync("input.mp4"); - - const result = await client.queue.submitAndPoll({ - model: models.video("lucy-pro-v2v"), - prompt: "An astronaut riding a horse on Mars, cinematic lighting", - data: new Blob([inputVideo]), - onStatusChange: (job) => { - console.log(`Job ${job.job_id}: ${job.status}`); - }, - }); - - if (result.status === "completed") { - const output = Buffer.from(await result.data.arrayBuffer()); - fs.writeFileSync("output.mp4", output); - console.log("Video saved to output.mp4"); - } else { - console.log("Job failed:", result.error); - } -});