---
name: vidjutsu
description: Use when building video editing workflows, automating timeline
  edits, uploading and rendering footage, managing projects with agents, or
  integrating video production into agent-driven applications. Reach for this
  skill when you need to programmatically edit timelines, manage media
  libraries, render videos, or coordinate video work between agents and humans.
metadata:
  mintlify-proj: vidjutsu
  version: "1.0"
---

# VidJutsu Skill

## Product summary

VidJutsu is a fully hosted video editor driven by API, CLI, or MCP. Upload video, audio, and stills; edit timelines with JSON operations; render to 1080p or 4K on cloud machines; and manage projects with full revision history. All operations are atomic and idempotent. Access via REST API (`https://api.vidjutsu.ai`), CLI (`vidjutsu`), MCP server (`https://api.vidjutsu.ai/mcp`), or TypeScript SDK. Key files: API keys stored in `~/.config/vidjutsu/cloud.json` (CLI), environment variable `VIDJUTSU_API_KEY` (CI/agents). Primary docs: https://docs.vidjutsu.ai

## When to use

Use VidJutsu when:
- An agent needs to edit video timelines programmatically (cut clips, trim, adjust audio, apply fades)
- You're uploading media files and need them stored and indexed for editing
- You need to render edited timelines to MP4 (1080p or 4K) on cloud infrastructure
- You're building workflows where agents and humans collaborate on the same project
- You need to track video project history and support undo/redo of individual changes
- You're managing a shot list (scenes, shots, takes) alongside timeline edits
- You need to extract captions, transcripts, or stills from video
- You're publishing rendered videos to social platforms (TikTok, Instagram, YouTube)

Do not use VidJutsu for: generating video from scratch, applying complex effects or transitions, variable-speed playback, or free-form transforms (rotation, perspective).

## Quick reference

### Authentication
- Sign up: `POST /auth/email` → `POST /auth/verify` (creates account and API key on first verify)
- CLI: `vidjutsu login` (saves key to `~/.config/vidjutsu/cloud.json`)
- API: Send `Authorization: Bearer vj_live_...` on every call
- MCP: Use `https://api.vidjutsu.ai/mcp` with OAuth or API key in header

### Core workflow
| Task | CLI | API | MCP |
|------|-----|-----|-----|
| Upload file | `vidjutsu upload file.mp4` | `POST /uploads` (multipart) | `create_upload` + `complete_upload` |
| Create project | `vidjutsu init project-name` | `POST /projects` | `init` |
| Edit timeline | `vidjutsu edit project ops.json` | `POST /projects/{project}/edits` | `edit` |
| Render | `vidjutsu render project --out out.mp4` | `POST /projects/{project}/renders` | `render` |
| Check status | `vidjutsu status job_id` | `GET /jobs/{job_id}` | `render_status` |

### Edit operations (JSON)
| Operation | Purpose |
|-----------|---------|
| `add_media` | Make uploaded media available to project |
| `insert_clip` | Place a clip on a track (with optional `ripple` to shift later clips) |
| `delete_clip` | Remove a clip (with optional `ripple` to close gap) |
| `trim_clip` | Change which part of media a clip plays |
| `move_clip` | Reposition clip on timeline or to another track |
| `set_gain` | Adjust audio clip volume (ratio or null for unity) |
| `set_fade` | Add linear fades (video to/from black, audio in/out volume) |
| `cut_pauses` | Remove ranges from all tracks at once |
| `set_layout` | Position video track (PiP, side-by-side, shapes) |
| `add_track` | Add video or audio track |

### Render options
```json
{
  "height": 1080,           // or 2160 for 4K
  "loudness": -14,          // LUFS normalization (optional)
  "captions": {"position": "bottom"},  // burn in captions (optional)
  "force": false            // re-render even if unchanged
}
```

### Key file paths and environment
| Variable | Purpose |
|----------|---------|
| `VIDJUTSU_API_KEY` | API key for CLI/SDK (overrides saved key) |
| `VIDJUTSU_API_URL` | API endpoint (default `https://api.vidjutsu.ai`) |
| `VIDJUTSU_CLIENT` | Name shown in history (default: key name) |
| `~/.config/vidjutsu/cloud.json` | Saved API key (CLI) |

## Decision guidance

| Scenario | Use | Why |
|----------|-----|-----|
| Uploading large file (>4 MB) | Direct upload (`POST /uploads` + PUT parts) | Presigned links, parallel parts, retry per part |
| Uploading small file (<4 MB) | Inline bytes (`POST /media` with octet-stream) | Simpler, one request |
| File already online | Link ingest (`POST /media` with URL) | No download/re-upload needed |
| Editing timeline | JSON operations (atomic batch) | All-or-nothing, safe retries with `expected_head` |
| Checking for changes | `GET /projects/{project}/head` | Cheap, no timeline body |
| Reading full project | `GET /projects/{project}` | Includes timeline, revision, duration |
| Rendering after small edit | Render normally | Unchanged ranges reused automatically |
| Rendering exact revision | Use `revision` param | Locks revision when job starts |
| Rendering current head | Omit `revision` param | Renders whatever is head now |
| Polling render status | `GET /jobs/{job_id}` every few seconds | `state` is queued/running/succeeded/failed/canceled |
| Undo single change | `POST /projects/{project}/undo` with `change` index | Keeps later edits, brings back one change |
| Undo whole revision | `POST /projects/{project}/undo` without `change` | Restores parent revision exactly |
| Restore old revision | `POST /projects/{project}/restore` | Brings back earlier timeline, keeps history |

## Workflow

### Typical agent-driven editing session

1. **Authenticate**
   - If new account: `POST /auth/email` → `POST /auth/verify` → open `checkout_url` to add card
   - If existing: use saved key or `VIDJUTSU_API_KEY` environment variable

2. **Upload media**
   - For each file: `POST /uploads` → PUT each part to presigned URL → `POST /uploads/{id}/complete`
   - Or: `POST /media` with `{url: "https://..."}` for files already online
   - Keep returned `media` and `audio` objects (if video with sound)

3. **Create project**
   - `POST /projects {project: "name"}` creates empty project with v1 (video) and a1 (audio) tracks
   - Or: `POST /projects` with `manifest` to start from existing timeline

4. **Build timeline**
   - `POST /projects/{project}/edits` with operations array:
     - `add_media` for each uploaded item
     - `add_track` if you need more tracks
     - `insert_clip` to place clips (with `ripple: true` to shift later clips)
     - `set_gain`, `set_fade`, `cut_pauses` to refine
   - Always send `expected_head` (revision you read) to catch conflicts
   - Always send `Idempotency-Key` header to make retries safe

5. **Check and iterate**
   - `GET /projects/{project}` to read current timeline
   - `POST /projects/{project}/undo` to undo changes (creates new revision)
   - `POST /projects/{project}/history` to see all revisions
   - Repeat edits until satisfied

6. **Render**
   - `POST /projects/{project}/renders {height: 1080}` with `Idempotency-Key`
   - Returns job with `job_id` and `state: queued`
   - Poll `GET /jobs/{job_id}` until `state: succeeded`
   - Download from `output.url` (valid 7 days)

7. **Optional: publish**
   - `POST /projects/{project}/publishing/connect` to link social account
   - `POST /projects/{project}/publishing/schedule` to post render to accounts

### Editing with expected_head and retries

```json
// Read current state
GET /projects/my-project
// Response: {"revision": "r42", "manifest": {...}}

// Edit with conflict detection
POST /projects/my-project/edits
{
  "expected_head": "r42",
  "operations": [
    {"op": "add_media", "media": {...}},
    {"op": "insert_clip", "track_id": "v1", "occurrence": {...}}
  ],
  "Idempotency-Key": "edit-1"
}
// If someone edited since r42: 409 conflict, nothing changes
// If same Idempotency-Key sent again: returns first result, no double-apply
```

## Common gotchas

- **Times must be exact**: Use strings (`"12.5"`, `"1001/30000"`) or `{ticks, rate}` objects, never JSON decimals (12.5 is imprecise)
- **Ranges are half-open**: `{start: 0, end: 20}` plays from 0 up to, not including, 20 seconds
- **Video clips need layout**: Every video clip requires `layout: {x, y, width, height}` (1000x1000 canvas); audio clips must not have layout
- **Clips split on ripple/cut**: When a ripple insert or cut splits a clip, leftmost piece keeps original id, later pieces get new ids—read them from `show` instead of guessing
- **Edits are atomic**: If any operation fails, entire edit is rejected and timeline unchanged; split large edits into multiple requests (max 64 operations per edit)
- **Idempotency-Key is required**: Always send it on renders and edits; reuse same key when retrying so work happens once
- **expected_head prevents conflicts**: Send the revision you read; if timeline moved, you get 409 instead of silent overwrite
- **Render is billed after**: No upfront cost; charged by box time used ($0.03/vCPU-minute); render your balance doesn't cover is refused with `top_up_url`
- **Transcripts are per-file**: Made once per media item; asking again while one exists or is being made costs nothing
- **Media IDs come from file names**: `take1.mov` becomes media id `take1`; name files the way you want to refer to them
- **Video with sound returns two items**: Upload `take.mp4` → get `media` (picture) and `audio` (sound) objects; add both to project and place on separate tracks
- **Revision is pinned at render start**: Edits you make while render runs don't change what it renders; use `revision` param to lock an older revision
- **Payment required before work**: New account has `status: no_plan`; open `checkout_url` to add card; all work paused until first payment
- **Wallet below zero pauses new work**: Reads still work; use `top_up_url` to add credits; stored media deleted 30 days after payment fails
- **Key scopes limit permissions**: Default key has all rights; create limited keys with `scopes: []` (no billing/keys) or `scopes: ["keys"]` (keys only); can't change scopes later, must revoke and create new key

## Verification checklist

Before submitting work:

- [ ] API key is valid and has required scopes (check with `GET /account`)
- [ ] Account status is `active` (not `no_plan` or `payment_failed`)
- [ ] Wallet has sufficient balance for planned renders (`GET /usage` shows balance)
- [ ] All uploaded media has `media` and `audio` objects extracted (if video with sound)
- [ ] Edit operations use exact times (strings or `{ticks, rate}`, not decimals)
- [ ] Video clips have `layout` field; audio clips do not
- [ ] `expected_head` matches the revision you read (prevents conflicts)
- [ ] `Idempotency-Key` is unique per request (enables safe retries)
- [ ] Render job reached `state: succeeded` before downloading
- [ ] Download link from `output.url` is used within 7 days
- [ ] If using undo/restore, verify correct revision was restored with `GET /projects/{project}`
- [ ] Shot list operations sent with correct `expected_revision` (prevents stale edits)
- [ ] Comments and presence updates sent before major changes (so humans see what agent is doing)

## Resources

- **Full page navigation**: https://docs.vidjutsu.ai/llms.txt
- **API Reference**: https://docs.vidjutsu.ai/api-reference/introduction
- **Edit operations guide**: https://docs.vidjutsu.ai/guides/editing
- **Rendering guide**: https://docs.vidjutsu.ai/guides/rendering
- **MCP tools reference**: https://docs.vidjutsu.ai/mcp

---

> For additional documentation and navigation, see: https://docs.vidjutsu.ai/llms.txt