npm i vidjutsu
import { readFileSync } from "node:fs";
import { VidJutsu } from "vidjutsu";
const client = new VidJutsu({ apiKey: process.env.VIDJUTSU_API_KEY });
const take = await client.upload("take1.mov", new Uint8Array(readFileSync("take1.mov")));
await client.init("film");
await client.edit("film", [
{ op: "add_media", media: take.media },
{ op: "insert_clip", track_id: "v1", occurrence: {
id: "c1", media_id: take.media.id, timeline_start: 0,
source: { start: 0, end: 20 },
layout: { x: 0, y: 0, width: 1000, height: 1000 } } },
]);
const job = await client.render("film", { height: 1080 }, "film-1");
const done = await client.waitForRender(job.job_id);
console.log(done.output); // {hash, bytes, url, expires_at}
fetch, so it runs in Node 18+, Bun, Deno and browsers.
Options
new VidJutsu({
apiKey: "vj_live_...", // or an OAuth access token
baseUrl: "https://api.vidjutsu.ai", // default
fetch: customFetch, // default: global fetch
apiVersion: "2026-11-03", // default: the version this SDK was built for
clientName: "My Agent", // the name history and Activity show for your edits
});
VidJutsu-Version header. See Versioning.
Methods
| Method | Operation |
|---|---|
signIn(email), verify(attempt, code) | Sign up or sign in. verify returns {api_key, account_id, status, checkout_url?}. No key needed. |
account(), usage(), wallet(), entitlements() | Your account, usage, wallet and limits. |
createKey(name), listKeys(), revokeKey(keyId) | API keys. |
billingCheckout({amount_usd?, success_url?, cancel_url?}), billingTopUp({amount_usd?, success_url?, cancel_url?}), billingPortal({return_url?}) | Stripe links to sign up with your first payment, to add credits, or to manage your saved card. |
billingAutoTopUp({enabled, threshold_usd?, amount_usd?}) | Turn auto top-up on or off. |
upload(name, bytes, {source?, project?}) | A direct upload: starts it, PUTs each part, completes it, and aborts on failure. |
ingestUrl(url, name?, idempotencyKey?, {source?, project?}) | Add media from a link. |
createUpload(name, bytes, sha256), completeUpload(uploadId, parts, {source?, project?}), abortUpload(uploadId) | Direct upload steps, if you want to send parts yourself (in parallel, or from a stream). |
mediaInfo(hash), mediaUrl(hash, ttlSeconds?) | A media item, and a download link for it. |
makePreview(hash, {project?}), mediaPreview(hash), makeTranscript(hash, {project?}), mediaTranscript(hash) | Previews and transcripts. |
listProjects({cursor?, limit?}), init(project, {template?, idempotencyKey?}), show(project, {revision?}), head(project) | List, create and read projects. |
edit(project, operations, {expected_head?, summary?, branch?, idempotency_key?}) | Edit a timeline. |
timelineWords(project, {revision?, pause?}) | The words and pauses on the edited timeline. |
history(project, {limit?, before?}), undo(project, revision, {change?, expected_head?}), restore(project, revision, {expected_head?}) | Undo and history. |
shotList(project, {scene?, resolve?}), getShot(project, shot), shotListEdit(project, expectedRevision, operations), shotListImport(project, expectedRevision, episode, {replace?}), files(project), searchWords(project, words, {limit?}) | The shot list, episode plans, the project’s files and word search. |
templates(), saveTemplate({name, columns, id?} or {name, project, id?}), deleteTemplate(template) | Shot list templates. |
layouts(), saveLayout({name, screen, camera}), deleteLayout(layoutId), applyLayout(project, preset, {from?, to?}) | Screen and camera layouts. |
studioSound(project, {media?}), level(project, body) | Studio Sound and leveling. |
frame(project, times, {height?, revision?}), check(project, {sections?, revision?}) | Look at and check a cut. Both start jobs; read output when they succeed. |
importTimeline({project, timeline, files, format?}) | Open a Descript export as a new project. |
events(project, {after?, limit?}), stream(project, {lastEventId?, signal?}) | Live updates: notices as JSON, or the live stream as an async iterator. |
setPresence(project, {selection?, playhead?}), workingOn(project, {text, clips?, range?, scene?}) | Say where you are and what you’re doing. |
comments(project), addComment(project, body), resolveComment(project, commentId, resolved?), deleteComment(project, commentId) | Comments. |
render(project, body?, idempotencyKey?) | Start a render. body.captions burns in captions. |
captions(project, {format?, revision?, branch?}) | The cut’s captions as SRT or WebVTT. Free. |
renderStatus(jobId), cancelRender(jobId) | Read any job, or cancel a render. |
waitForJob(jobId, {intervalMs?, onUpdate?}) | Poll a job until it ends (every 3 seconds by default). waitForRender is the same. |
connectAccount(platform, {return_to?}), socialAccounts(), updateSocialAccount(socialAccountId, {approve_before_posting}), disconnectAccount(socialAccountId) | Connect, list and disconnect social accounts. |
schedulePost({media, accounts, caption?, at?, idempotency_key?}), posts({state?, cursor?, limit?}), getPost(postId), reschedulePost(postId, at | null), cancelPost(postId), approvePost(postId), postStats(postId) | Publishing: post a render or stored file now or at a time, follow it, approve it, and read its numbers. |
request(method, path, body?, idempotencyKey?) | Any other call. |
Live updates
const controller = new AbortController();
for await (const { event, id, data } of client.stream("film", { signal: controller.signal })) {
if (event === "revision") console.log("new revision", data);
}
stream() yields {event, id?, data} for each Server-Sent Event. It reconnects when the server ends the stream (about every five minutes) and resumes from the last notice it saw.
Errors
Failed calls throwVidJutsuError with the API’s status, code and message, and the whole error body. For a 402, fixUrl is the link that fixes it: the checkout link before sign-up, the top-up link when your wallet runs low, or the upgrade link when a feature isn’t in your plan.
import { VidJutsuError } from "vidjutsu";
try {
await client.render("film");
} catch (error) {
if (error instanceof VidJutsuError && error.code === "payment_required") {
console.log("Add credits here:", error.fixUrl);
} else throw error;
}