Misc
SDK
Cludz JavaScript SDK for Node.js and Bun.
The Cludz SDK is the recommended way to interact with Cludz API. It provides a type-safe, module-based interface for all our services.
Installation
bunx jsr add @cludz/sdk
npx jsr add @cludz/sdk
yarn add jsr:@cludz/sdk
deno add jsr:@cludz/sdk
Initialization
Initialize the Cludz client with your API configuration.
import { Cludz } from "@cludz/sdk";
const cludz = new Cludz({
api: "https://api.cludz.net",
key: "YOUR_API_KEY"
});
Modules
The SDK is organized into modules matching our API structure.
downloader
Download media from various platforms.
const task = await cludz.downloader.youtube.download("https://www.youtube.com/watch?v=...");
console.log(`Task ID: ${task.data.taskId}`);
tools
Utility tools like QR generation, web check, and DNS lookup.
const qr = await cludz.tools.qr("Hello World");
// Returns a Response object (image/png)
image
Process and manipulate images.
const meme = await cludz.image.meme("./base.png", "Top text", "Bottom text");
tasks
Monitor background tasks.
const result = await cludz.tasks.waitFor(taskId);
console.log(result.data);
account
Manage your account and check API status.
const me = await cludz.account.me();
const status = await cludz.account.status();
Example: Waiting for a Task
Many operations in Cludz API are asynchronous. Here is how to use the tasks module to wait for a result:
// 1. Start a download task
const { data: { taskId } } = await cludz.downloader.tiktok.download(url);
// 2. Wait for completion
try {
const result = await cludz.tasks.waitFor(taskId);
console.log("Download URL:", result.data.url);
} catch (error) {
console.error("Task failed:", error.message);
}
