videodraft 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,68 @@
1
1
  {
2
2
  "name": "videodraft",
3
- "version": "0.0.0",
4
- "description": "Official VideoDraft CLI — create AI videos, images, voiceovers and music from your terminal. Launching soon.",
3
+ "version": "0.1.0",
4
+ "description": "Official VideoDraft CLI — create AI videos, images, voiceovers and music from your terminal. Agent-friendly: --json everywhere, stable exit codes, async job polling.",
5
5
  "license": "MIT",
6
+ "type": "module",
6
7
  "homepage": "https://videodraft.ai/cli",
7
- "repository": "github:videodraft-ai/cli",
8
- "keywords": ["videodraft", "ai", "video", "cli", "agent", "mcp"]
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/videodraft-ai/cli.git"
11
+ },
12
+ "bugs": "https://github.com/videodraft-ai/cli/issues",
13
+ "keywords": [
14
+ "videodraft",
15
+ "ai",
16
+ "video",
17
+ "video-generation",
18
+ "image-generation",
19
+ "cli",
20
+ "agent",
21
+ "mcp"
22
+ ],
23
+ "bin": {
24
+ "videodraft": "./dist/index.js"
25
+ },
26
+ "main": "./dist/client.js",
27
+ "types": "./dist/client.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/client.d.ts",
31
+ "import": "./dist/client.js"
32
+ },
33
+ "./client": {
34
+ "types": "./dist/client.d.ts",
35
+ "import": "./dist/client.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "skills",
41
+ "README.md"
42
+ ],
43
+ "engines": {
44
+ "node": ">=20"
45
+ },
46
+ "scripts": {
47
+ "build": "tsup",
48
+ "build:watch": "tsup --watch",
49
+ "dev": "tsx src/index.ts",
50
+ "typecheck": "tsc --noEmit",
51
+ "test": "vitest run",
52
+ "test:watch": "vitest",
53
+ "test:e2e": "npm run build && node test/e2e-mock.mjs",
54
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build"
55
+ },
56
+ "dependencies": {
57
+ "commander": "^14.0.0",
58
+ "picocolors": "^1.1.1",
59
+ "undici": "^7.10.0"
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^20.19.2",
63
+ "tsup": "^8.5.0",
64
+ "tsx": "^4.21.0",
65
+ "typescript": "^5.6.2",
66
+ "vitest": "^3.2.0"
67
+ }
9
68
  }
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: videodraft
3
+ description: Create AI videos, images, voiceovers, music, storyboards, avatar videos and product/ad videos with VideoDraft. Use when the user mentions VideoDraft, or asks to generate/make a video, video ad, explainer, storyboard, talking-head/avatar video, AI image, voiceover/TTS, or background music — including batch/programmatic video generation in scripts or CI. Works via the `videodraft` CLI (preferred in terminals) or the VideoDraft MCP connector.
4
+ license: MIT
5
+ metadata:
6
+ author: VideoDraft (videodraft.ai)
7
+ homepage: https://videodraft.ai/cli
8
+ ---
9
+
10
+ # VideoDraft
11
+
12
+ VideoDraft is an AI video creation platform: idea → script → storyboard (scenes + shot images) → production (voiceover, captions, motion clips, music) → exported MP4. You can drive all of it from this environment.
13
+
14
+ ## How to connect
15
+
16
+ Two equivalent surfaces (same backend, same credits, same projects):
17
+
18
+ 1. **CLI** (preferred when you have a shell): run `videodraft` if it's on PATH; otherwise `npx videodraft` runs it with no install (needs Node ≥20; the package is fetched on first use and cached). For heavy use, `npm install -g videodraft`. If there's no Node/shell here but the MCP connector below is available, use that instead; if neither works, tell the user how to install (https://videodraft.ai/cli).
19
+ - Auth — pick by context, don't guess:
20
+ • INTERACTIVE (a human is in the session, e.g. Claude Code / Codex): on exit code 3 ("not authenticated"), tell the user to run `videodraft login` in their terminal — it opens their browser for a one-click VideoDraft sign-in (OAuth), no key to copy. Wait for them to confirm it succeeded, then retry the command. This is the preferred path when the user is present.
21
+ • HEADLESS / CI (no browser): set `VIDEODRAFT_API_KEY=vd_mcp_...` (a token the user mints at https://app.videodraft.ai/mcp-keys).
22
+ • SECURITY: never ask the user to paste a `vd_mcp_...` token into the chat — use browser `login` or the env var so the token never lands in the transcript.
23
+ - Every command accepts `--json` (parse this, don't scrape text). Exit codes: 0 ok, 1 error, 2 usage, 3 auth (see Auth above), 4 insufficient credits (→ tell the user, don't retry).
24
+ - Full API access: `videodraft tools list`, `videodraft tools schema <name>`, `videodraft call <tool> --args '<json>'`.
25
+ 2. **MCP connector**: if VideoDraft MCP tools (e.g. `generate_storyboard_from_idea`) are available, call them directly — the CLI's curated commands map 1:1 onto these tools.
26
+
27
+ ## First decision: asset or video?
28
+
29
+ - **One standalone asset** (a single image, clip, voiceover, or music track, no story): generate it directly. Do NOT create a project.
30
+ - `videodraft generate image "a red fox in snow, cinematic" --ar 16:9 --download ./out/`
31
+ - `videodraft generate video "slow dolly over a misty lake" --model google-veo3.1 --duration 6 --download ./out/`
32
+ - **A video / ad / explainer / anything multi-scene**: create a project so the work stays organized, editable in the web app, and exportable.
33
+ - `videodraft create "30s launch video for our espresso machine" --ar 9:16`
34
+ - **Just a script** (no video asked for): `videodraft create "..." --script-only`. Stop at the script — do not build a storyboard the user didn't ask for.
35
+ - **Iterating on existing work**: find it first (`videodraft projects list`) and reuse that project. Never create a new project to change an existing one.
36
+
37
+ ## Credits: confirm before spending
38
+
39
+ Generation costs credits (video is per-second; shot-image batches are the largest single spend). Before anything expensive:
40
+
41
+ 1. `videodraft credits` — check the balance.
42
+ 2. `videodraft generate video "..." --estimate` or `videodraft costs <model> --duration 8 --resolution 1080p` — get the quote.
43
+ 3. Tell the user the model + settings + rough cost and get a go-ahead. Ask rather than assume aspect ratio, duration, and model when they matter.
44
+
45
+ `videodraft models image|video` lists every model with its supported inputs (aspect ratios, resolutions, reference limits) — consult it instead of guessing capabilities.
46
+
47
+ ## Async jobs
48
+
49
+ Image/video generation is asynchronous: commands submit a job and **wait by default**, printing output URLs (and saving files with `--download`). In scripts/CI prefer explicit control:
50
+
51
+ ```bash
52
+ JOB=$(videodraft generate image "..." --no-wait --json | jq -r .job_id)
53
+ videodraft wait "$JOB" --download "./outputs/{job_id}_{index}.{ext}" --json
54
+ ```
55
+
56
+ For MANY jobs: submit each with `--no-wait`, collect ALL with one command — `videodraft wait <id1> <id2> ...` polls every job from one process with one batched request per tick. Do NOT spawn parallel `wait`/`generate --wait` processes for a batch.
57
+
58
+ If a wait times out, the job is still running server-side — `videodraft status <job_id>` later. Never re-submit just because a wait timed out (that double-spends credits).
59
+
60
+ ## Local files and reference images
61
+
62
+ Reference inputs must be public URLs. The CLI uploads local files automatically wherever a URL is expected (`--ref photo.jpg`, `--start-image frame.png`), or explicitly:
63
+
64
+ ```bash
65
+ URL=$(videodraft upload ./product.png --json | jq -r .url)
66
+ ```
67
+
68
+ Never silently drop a reference you couldn't upload — stop and tell the user. Never upload a user's file to a third-party host.
69
+
70
+ When the user attaches media, classify each item before acting: a recurring **visual asset** (character/product/location/style), actual **footage to place as shots**, or **inspiration only**. See [references/pipeline.md](references/pipeline.md) for how each role flows into a project.
71
+
72
+ ## The full pipeline (idea → MP4)
73
+
74
+ ```bash
75
+ videodraft credits
76
+ videodraft create "<idea>" --ar 9:16 # project: script → visual assets → storyboard
77
+ videodraft shots <project_id> --grid --estimate # cost preview, confirm with user
78
+ videodraft shots <project_id> --grid # batch shot images (waits, writes onto shot cards)
79
+ videodraft produce <project_id> # voiceovers + captions + production timeline
80
+ videodraft export <project_id> --download final.mp4
81
+ ```
82
+
83
+ Optional between produce and export: per-shot motion clips (`videodraft generate video ... --project <id>` then place it with `videodraft attach <project> --scene N --shot M --media <url|file> --type video --duration <s>`), and music (`videodraft generate music "..." --attach <project_id>`). Details, per-step tools and editing rules: [references/pipeline.md](references/pipeline.md).
84
+
85
+ Avatar/talking-head videos are their own short flow: `videodraft avatar script` → `avatar create` → `avatar render` (paid step).
86
+
87
+ ## Working with project data
88
+
89
+ A project is one JSON blob (script, storyboard scenes, shot cards, visual assets, production timeline). To inspect: `videodraft projects get <id>`. To edit: fetch `--raw`, modify, then `videodraft call update_project` — objects deep-merge, **arrays replace wholesale** (send the complete `storyboard.scenes` array to change one scene). Snapshot first with `videodraft checkpoint create <id>` before risky edits. Schema reference: `videodraft call get_project_schema`.
90
+
91
+ ## More
92
+
93
+ - [references/pipeline.md](references/pipeline.md) — project data model, step-by-step tools, attaching media, editing safely
94
+ - [references/models.md](references/models.md) — choosing image/video models, pricing patterns, voices and styles
95
+ - [references/examples.md](references/examples.md) — recipes: batch product videos from a CSV, talking-head from a script, changelog video in CI
@@ -0,0 +1,84 @@
1
+ # Recipes
2
+
3
+ Working patterns for common asks. All assume auth (`videodraft login` once, or `VIDEODRAFT_API_KEY` in the environment) and use `--json` for parsing.
4
+
5
+ ## 1. Batch product videos from a CSV
6
+
7
+ One 9:16 product clip per row of `products.csv` (`name,image_url,tagline`):
8
+
9
+ ```bash
10
+ #!/usr/bin/env bash
11
+ set -euo pipefail
12
+ mkdir -p outputs
13
+
14
+ while IFS=, read -r name image tagline; do
15
+ job=$(videodraft generate video \
16
+ "Premium product shot of ${name}: ${tagline}. Slow orbit, studio lighting." \
17
+ --model google-veo3.1 --ar 9:16 --duration 6 \
18
+ --start-image "$image" \
19
+ --no-wait --json | jq -r .job_id)
20
+ echo "$name,$job" >> outputs/jobs.csv
21
+ done < <(tail -n +2 products.csv)
22
+
23
+ # Collect ALL results with ONE process (batched polling — one request per tick)
24
+ videodraft wait $(cut -d, -f2 outputs/jobs.csv) \
25
+ --download "outputs/{job_id}_{index}.{ext}" --json > outputs/results.json
26
+ # map job ids back to product names via outputs/jobs.csv
27
+ ```
28
+
29
+ Submit-then-collect parallelizes server-side generation; the single multi-id `wait` keeps it to one local process and one batched poll request per tick no matter how many jobs. Estimate first: `videodraft costs google-veo3.1 --type video --duration 6` × rows, and confirm with the user.
30
+
31
+ ## 2. Full marketing video from one idea
32
+
33
+ ```bash
34
+ videodraft credits --json
35
+ videodraft create "30-second launch video for Solace, a sleep-tracking ring. Calm, premium, dark palette." \
36
+ --ar 9:16 --style cinematic --json > project.json
37
+ PROJECT=$(jq -r .project_id project.json)
38
+
39
+ videodraft shots "$PROJECT" --grid --estimate # show the user the cost; get a go-ahead
40
+ videodraft shots "$PROJECT" --grid
41
+ videodraft produce "$PROJECT"
42
+ videodraft generate music "minimal ambient, warm pads, 60 BPM" --attach "$PROJECT"
43
+ videodraft export "$PROJECT" --download solace-launch.mp4
44
+ ```
45
+
46
+ The project stays editable at the URL in `project.json` (`.urls`) — hand it to the user for tweaks.
47
+
48
+ ## 3. Talking-head (avatar) video
49
+
50
+ ```bash
51
+ SCRIPT=$(videodraft avatar script "why our espresso subscription saves you money" --style ad-style --json | jq -r .script)
52
+ AVATAR=$(videodraft avatar create ./founder.jpg --script "$SCRIPT" --ar 9:16 --json | jq -r .avatar_video_id)
53
+ videodraft avatar render "$AVATAR" --resolution 720p # paid step — confirm cost first (~20 credits/sec)
54
+ ```
55
+
56
+ ## 4. Changelog video in CI
57
+
58
+ In a GitHub Action with `VIDEODRAFT_API_KEY` set as a secret:
59
+
60
+ ```bash
61
+ NOTES=$(git log --oneline v1.2.0..HEAD | head -20)
62
+ videodraft create "Weekly product update video. Energetic, 20 seconds. Changes: ${NOTES}" --ar 16:9 --json > p.json
63
+ PROJECT=$(jq -r .project_id p.json)
64
+ videodraft shots "$PROJECT" && videodraft produce "$PROJECT"
65
+ videodraft export "$PROJECT" --download changelog.mp4 --wait-timeout 30m
66
+ ```
67
+
68
+ ## 5. Variations and picking a winner
69
+
70
+ ```bash
71
+ videodraft generate image "logo concept: minimalist fox, geometric" --num 4 --download "./concepts/{job_id}_{index}.{ext}" --json
72
+ # Show all 4 to the user; regenerate the chosen one at higher res:
73
+ videodraft generate image "<same prompt>" --model nano-banana-pro --resolution 4K
74
+ ```
75
+
76
+ ## 6. Reaching tools without a curated command
77
+
78
+ ```bash
79
+ videodraft tools list --json | jq -r '.[].name'
80
+ videodraft tools schema attach_media_to_shot --json
81
+ videodraft call attach_media_to_shot --args '{"project_id":"...","scene_index":0,"shot_index":1,"media_url":"https://...","media_type":"video","duration_seconds":6}'
82
+ ```
83
+
84
+ Anything the VideoDraft MCP exposes — character studio, product studio, timeline editing — is reachable this way even before it gets a curated command.
@@ -0,0 +1,43 @@
1
+ # Choosing models (and predicting cost)
2
+
3
+ Always consult the live catalog instead of memorizing this page — models change weekly:
4
+
5
+ ```bash
6
+ videodraft models image --json # every image model + inputs (aspect ratios, resolutions, max refs)
7
+ videodraft models video --json # every video model + inputs + per-second pricing metadata
8
+ videodraft models voices --json # TTS voices
9
+ videodraft models styles --json # visual style presets
10
+ ```
11
+
12
+ ## Defaults (safe starting points)
13
+
14
+ - **Image**: `nano-banana-2` (the platform default, 1K). Use `--num 1..4` for variations of one prompt in a single call — never loop for variations.
15
+ - **Video**: `google-veo3.1` at fast quality (6s / 720p) — the platform default.
16
+ - **Voiceover**: ElevenLabs Brittney (default voice).
17
+ - **Music**: `lyria-3-clip-preview` (30s, cheap); `lyria-3-pro-preview` for 180s/quality.
18
+
19
+ ## Capability gotchas
20
+
21
+ - Each model's `inputs` block is authoritative: supported `aspect_ratios`, `resolutions`, `quality_options`, `start_frame`/`end_frame`, `max_reference_images/videos/audio`, `multi_prompt`, `audio_toggle`. Passing an unsupported input fails with a clear error — check first, don't trial-and-error paid calls.
22
+ - Most video models support only 16:9 / 9:16 / 1:1. A 3:4 request hard-fails on most.
23
+ - `--seed` reproduces a specific output on models that support it (e.g. Flux, Ideogram V4); everything else ignores it. You do not need a seed for variation — `--num` already varies.
24
+ - `--rendering-speed` applies to Ideogram (V3: `Default`/`Turbo`/`Quality`; V4: `Turbo`/`Balanced`/`Quality`) and affects image cost — pass it to `videodraft costs ... --rendering-speed <tier>` for an accurate estimate. Always trust `videodraft models image --json` over this list; new models and tiers appear there the moment the platform ships them, with no CLI update.
25
+ - Reference inputs: `--ref <img>` (images), `--ref-video <v>` (Seedance 2, Wan 2.7), `--ref-audio <a>` (Seedance 2). The CLI uploads local files for all of these, so you can pass a path or a URL. `--segment "<prompt>:<seconds>"` (repeatable) drives multi-prompt models (Kling 3.0 / 3.0 Turbo / O3); total 3-15s. `generate image --video-ref` is the nano-banana-2 video reference.
26
+ - The top-level prompt is OPTIONAL for `generate video` with multi-prompt models and for Kling 3.0 Turbo (`--model kling-v3-turbo`) image-to-video — a `--segment`-only or `--start-image`-only call is valid. Every other model still needs a prompt; the server enforces per-model rules.
27
+ - AI Production: `videodraft produce <project> --mode full_video` generates one Seedance 2 video per scene; poll with `videodraft generations`, then `videodraft finalize <project>` swaps them into the timeline before `export`.
28
+
29
+ ## Cost model
30
+
31
+ - Images: per image (× `--num`). Matrix-priced models (GPT-Image, Nano Banana Pro) vary by resolution/quality.
32
+ - Video: usually credits/second × duration; rate depends on model + resolution + quality + native audio on/off.
33
+ - Shot-image batches: one image per shot (+1 grid image per scene in `--grid` mode) — the largest single spend in the pipeline.
34
+ - Avatar renders: ~10 credits/sec at 480p, ~20/sec at 720p.
35
+ - Upscales: priced by scale and source size.
36
+
37
+ Quote before spending:
38
+
39
+ ```bash
40
+ videodraft costs google-veo3.1 --type video --duration 8 --resolution 1080p --audio
41
+ videodraft generate video "..." --estimate # same quote, inline
42
+ videodraft credits # current balance
43
+ ```
@@ -0,0 +1,59 @@
1
+ # VideoDraft pipeline reference
2
+
3
+ Everything here works through the CLI (`videodraft <command>` / `videodraft call <tool>`) or the MCP connector (tool names in backticks). One backend; pick the surface you have.
4
+
5
+ ## Stages and their tools
6
+
7
+ | Stage | CLI | Underlying tool |
8
+ |---|---|---|
9
+ | Idea → full storyboard project | `videodraft create "<idea>"` | `generate_storyboard_from_idea` |
10
+ | Idea → script only (stop there) | `videodraft create "<idea>" --script-only` | `generate_script_from_idea` |
11
+ | Footage IS the video | `videodraft call generate_storyboard_from_media` | `generate_storyboard_from_media` |
12
+ | Batch shot images | `videodraft shots <project>` | `generate_shot_images` |
13
+ | One shot image | `videodraft generate image --project <id> --scene N --shot M` | `generate_image` |
14
+ | Produce (voiceover, captions, timeline) | `videodraft produce <project>` | `produce_project` |
15
+ | Per-shot motion prompts | `videodraft video-prompts <project>` | `generate_video_prompts` |
16
+ | Motion clip for a shot | `videodraft generate video --project <id>` | `generate_video` |
17
+ | Attach a finished clip to the timeline | `videodraft attach <project> --scene N --shot M --media <url> --type video` | `attach_media_to_shot` |
18
+ | Background music | `videodraft generate music --attach <project>` | `generate_music` / `set_background_music` |
19
+ | Scene voiceover | `videodraft generate voiceover --project <id> --scene N` | `generate_voiceover` |
20
+ | Final MP4 | `videodraft export <project>` | `export_video` + `check_export_status` |
21
+
22
+ ## Rules that prevent broken results
23
+
24
+ - **The storyboard is generated FROM the script**, never from the raw idea. `videodraft create` runs the whole chain correctly. Don't call `generate_storyboard_scenes` with a raw idea as the "script".
25
+ - **Visual consistency**: never generate a storyboard shot in isolation. Shot prompts carry `[[asset:Name]]` / `[[shot:X-Y]]` tags that `generate_shot_images` resolves against the project's visual assets and prior shots. When generating a single shot whose prompt has no tags, pass `--ref` images yourself (the project's visual assets and/or the previous shot's image — `projects get` exposes both). Grid mode (`--grid`) gives the strongest cross-shot consistency.
26
+ - **Hold off generating shot images while the user is still iterating** on storyboard structure.
27
+ - **produce → export ordering**: `export` requires a produced project where every production scene has timeline media. If `produce` returns `generating_shot_images`, poll the job ids it returns, then re-run produce.
28
+ - **Generated motion clips do not auto-attach**: after `generate video` completes, attach the clip with `attach_media_to_shot` (`media_type:"video"`, include `duration_seconds`) — it replaces the production timeline clip while keeping the storyboard still.
29
+ - **Timeouts on the one-shot create**: if `create` times out at the transport layer, the project was still created server-side — `videodraft projects list`, take the most recent, and resume with its id. Don't start a duplicate.
30
+
31
+ ## User-attached media: classify roles first
32
+
33
+ For EACH attached file decide:
34
+
35
+ - **visual_asset** — recurring reference (character / product / location / style). Upload, then pass in `visual_assets` of `generate_storyboard_from_idea` (via `videodraft call`), or add to an existing project with `add_visual_assets`. Type must be one of `character | object | location | style | custom` with a short name + concrete description.
36
+ - **shot** — the media IS footage for the video. Whole video = footage → `generate_storyboard_from_media`. Idea + footage → `generate_storyboard_from_idea` with `shot_media`. Existing storyboard → `attach_media_to_shots`.
37
+ - **reference** — inspiration only → fold a description into the idea/instructions; don't place it as a shot or asset.
38
+
39
+ Ambiguous (e.g. a person holding a product)? Ask the user.
40
+
41
+ Uploads persist in the media library — recall later with `videodraft media list`.
42
+
43
+ ## Editing project data safely
44
+
45
+ 1. `videodraft call get_project_schema` — read the structure once per session.
46
+ 2. `videodraft projects get <id> --raw` — the exact editable blob.
47
+ 3. Modify; then `videodraft call update_project --stdin` with `{"project_id": "...", "data": {...}}`.
48
+ - Objects deep-merge key-by-key; **arrays replace wholesale** — send the complete array you're changing (e.g. all of `storyboard.scenes`).
49
+ - Scene shot arrays (`image_prompt` / `shot_types` / `shot_actions` / `search_prompt` / `preview_media`) are auto-aligned; fix-ups come back as warnings.
50
+ 4. Snapshot before risky edits: `videodraft checkpoint create <id> --name "before re-script"`. Restore with `videodraft checkpoint restore <id> <version>`.
51
+
52
+ ## AI Studio sessions (standalone generations)
53
+
54
+ Project generations group automatically. For standalone work in a long conversation, create one session up front and reuse it:
55
+
56
+ ```bash
57
+ SESSION=$(videodraft call create_ai_studio_session --arg name="Fox brand explorations" --json | jq -r .session_id)
58
+ videodraft generate image "..." --session "$SESSION"
59
+ ```