Skip to content

Node.js SDK overview

cut_cli ships an npm package alongside the standalone binary. Most users only need the binary (install via curl -s https://cutcli.com/cli | bash) — but if you're building automation in JavaScript / TypeScript, the SDK exposes the same operations as plain functions.

Install

bash
npm install cut_cli

Minimal example

typescript
import { createDraft, addCaptions, addImages, addAudios } from 'cut_cli';

const draft = await createDraft({ width: 1080, height: 1920 });

await addCaptions({
  draftId: draft.draftId,
  captions: [{ text: 'Hello', start: 0, end: 3000000 }],
  fontSize: 8,
  bold: true,
});

await addImages({
  draftId: draft.draftId,
  imageInfos: [{
    imageUrl: 'https://cutcli.com/assets/demo/scene-01.jpg',
    width: 1080,
    height: 1920,
    start: 0,
    end: 3000000,
  }],
});

await addAudios({
  draftId: draft.draftId,
  audioInfos: [{
    audioUrl: 'https://cutcli.com/assets/demo/bgm-light.mp3',
    duration: 3000000,
    start: 0,
    end: 3000000,
    volume: 0.5,
  }],
});

Available functions

The SDK mirrors the CLI surface 1:1. Function names are camelCase versions of the CLI subcommands:

CLISDK
cutcli draft createcreateDraft({ width, height, name? })
cutcli draft listlistDrafts()
cutcli draft infogetDraftInfo({ draftId })
cutcli draft easyeasyCreateMaterial({ draftId, audioUrl, imgUrl?, videoUrl?, text? })
cutcli draft zipzipDraft({ draftId, output? })
cutcli draft uploaduploadDraft({ draftId })
cutcli captions addaddCaptions({ draftId, captions, ...style })
cutcli captions listgetCaptions({ draftId })
cutcli images addaddImages({ draftId, imageInfos })
cutcli images listgetImages({ draftId })
cutcli videos addaddVideos({ draftId, videoInfos })
cutcli videos listgetVideos({ draftId })
cutcli audios addaddAudios({ draftId, audioInfos })
cutcli audios listgetAudios({ draftId })
cutcli effects addaddEffects({ draftId, effectInfos })
cutcli effects listgetEffects({ draftId })
cutcli sticker addaddSticker({ draftId, stickerId, start, end, scale? })
cutcli sticker listgetStickers({ draftId })
cutcli keyframes addaddKeyframes({ draftId, keyframes })
cutcli keyframes listgetKeyframes({ draftId, segmentId })
cutcli masks addaddMasks({ draftId, segmentIds, ...options })
cutcli masks listgetMasks({ draftId, segmentId? })
cutcli filters addaddFilters({ draftId, filterInfos })
cutcli text-styleaddTextStyle({ text, keyword, ...style })

Field shapes

The JSON shapes accepted by the SDK are exactly the same as the CLI's --captions / --image-infos / etc. arrays. See:

TypeScript types

typescript
import type {
  Caption,
  ImageInfo,
  VideoInfo,
  AudioInfo,
  EffectInfo,
  Keyframe,
  // ... and so on
} from 'cut_cli';

Where the full per-function reference lives

The exhaustive parameter tables (every option, default value, error case) live in:

  • /zh/reference/api — full Chinese reference, auto-synced from the source repo
  • TypeScript declaration files inside the npm package: node_modules/cut_cli/dist/index.d.ts
  • Source on the closed-source repo (request access via the maintainer)

Or simply:

bash
node -e "console.log(Object.keys(require('cut_cli')))"

to see every exported name.