-cli
Star on GitHub

The CLI
For Agents

Create, iterate, and deploy v0 chats from the terminal. Streaming render, parallel generations in background, stable JSON for agents.

Pairs with Claude Code Cursor and agents
bash
# Prompt → chat create.
v0 "landing page with hero + pricing"

# Path → chat init (no tokens, seeds a chat from local code).
v0 ./my-project

# Iterate.
v0 msg send <chat> "swap the hero copy"

# Ship.
v0 deploy <chat> <version>
# Preflight. Agents run this first.
v0 doctor --json

# Capture ids for later steps.
CHAT=$(v0 chat init --source . --json | jq -r '.data.id')
VER=$(v0 version list "$CHAT" --limit 1 --json \
  | jq -r '.data.data[0].id')

# Deploy and wait for terminal status.
v0 deploy create "$CHAT" "$VER" --yes --wait --json
{
  "data": {
    "id": "chat_8kwbm",
    "object": "chat",
    "latestVersion": {
      "id": "ver_14lmv",
      "files": [{ "name": "app/page.tsx" }]
    }
  }
}

One API key,
hundreds of commands

Single v0 binary maps the entire v0 Platform API. Chats, versions, deployments, env vars, webhooks, MCP servers — all covered.

Stable JSON,
human-readable default

TTY gets a formatted output. Pipe or add --json and the same command returns a stable envelope ready for jq.

Parallel chats,
non-blocking agents

--background returns a chat id in under a second. Fire N generations at once, keep working, reattach later with chat wait or chat watch.

Trust ladder built in: reads are silent (T0), writes log (T1), confirms gate T2, single-use intent tokens gate T3.
Install

Binary or skill.
One line either way.

CLI binary bash
bun install -g @crafter/v0-cli
v0 doctor

Needs V0_API_KEY. Self-contained, no post-install step.

Agent skill bash
npx skills add Railly/v0-cli

Teaches Claude Code, Cursor, or any agent the preflight recipe, the JSON contract, the trust ladder, and how intent tokens work.

Workflow

Human first.
JSON for agents.

Default output is readable. Add --json and the exact same command returns a stable envelope that pipes cleanly into jq.

human bash
# Prompt → chat create.
v0 "landing page with hero + pricing"

# Path → chat init (no tokens, seeds a chat from local code).
v0 ./my-project

# Iterate.
v0 msg send <chat> "swap the hero copy"

# Ship.
v0 deploy <chat> <version>
agent bash
# Preflight. Agents run this first.
v0 doctor --json

# Capture ids for later steps.
CHAT=$(v0 chat init --source . --json | jq -r '.data.id')
VER=$(v0 version list "$CHAT" --limit 1 --json \
  | jq -r '.data.data[0].id')

# Deploy and wait for terminal status.
v0 deploy create "$CHAT" "$VER" --yes --wait --json
Shorthand

One command.
Auto-routed.

v0 <arg> picks the right verb based on what you pass. Paths, URLs, and template ids route to chat init. Bare prompts route to chat create.

chat init chat create
v0 .
→ chat init (cwd)
v0 ./mi-proyecto
→ chat init (files)
v0 ~/code/app
→ chat init (files)
v0 https://github.com/foo/bar
→ chat init (repo)
v0 https://example.com/dist.zip
→ chat init (zip)
v0 https://example.com/registry.json
→ chat init (registry)
v0 https://v0.app/templates/optimus-…
→ chat init (template)
v0 template_abc
→ chat init (template)
v0 "landing page with hero"
→ chat create (prompt)
Parallel chats

Three chats.
One second of block time.

Each v0 generation takes 30–60s. Agents that serialize burn time doing nothing. --background detaches a worker and returns the chat_id immediately. Persisted across crashes. Reattach from any terminal.

chat pending chat wait chat watch
parallel bash
# Fire three chats. Each returns in <1s.
v0 "hero section"   --background --json
v0 "pricing table"  --background --json
v0 "footer"         --background --json

# Do other work. Then join.
v0 chat pending --json           # list all in-flight
v0 chat wait chat_abc --json     # block until ready
v0 chat watch chat_def           # live stream render
FAQ

Frequently
Asked Questions

What is v0-cli?
A single v0 binary that wraps the v0 Platform API. It mirrors the entire SDK surface, enforces a trust ladder, emits stable JSON for agents, and keeps an audit trail for every run.
How is the trust ladder enforced?
The CLI classifies every command into T0 (silent read) through T3 (destructive, intent-token required). Killswitch on disk blocks T2 and T3 instantly. Intent tokens are bound to action + hash(params), single-use, with a default 15-minute TTL.
What about rate limits and retries?
Writes consult /rate-limits before dispatching and exit 3 when under threshold. On HTTP 429 or 5xx the CLI retries with exponential backoff plus jitter, up to four attempts.
Can agents run it safely?
That's the point. --json is the canonical contract, exit codes are stable (0 ok, 1 API, 2 validation, 3 rate-limited, 4 killswitch, 5 intent required/invalid, 6 network). Every run writes a two-phase entry (pending then ok or error) to ~/.v0cli/audit/.
Where do I get an API key?
From v0.app/chat/settings/keys. Set it as V0_API_KEY in your shell or save it to a profile with v0 auth login.