-cli
Star on GitHub
Docs · Getting started

Get from zero to shipped in four lines.

Quickstart

Install, authenticate, ship a chat. Four lines.

bash
bun install -g @crafter/v0-cli
v0 init                          # paste API key, save profile
v0 doctor                        # health check
v0 "landing page with hero"      # create your first chat

No API key yet? Grab one at v0.app/chat/settings/keys.

Installation

The CLI is published as a Bun-native binary. bun install -g drops a single v0 command on your PATH. It also runs fine via bunx for one-shot use.

bash
bun install -g @crafter/v0-cli
# or: bunx shadcn@latest add Railly/v0-cli
v0 init
v0 doctor

Minimum requirements: Bun 1.3+. Node 22+ works for the compiled binary as fallback.

Authentication

Two paths. v0 init (interactive) saves a profile to the config dir. V0_API_KEY env var overrides everything — useful in CI.

bash
# Get a key at https://v0.app/chat/settings/keys
export V0_API_KEY="v1_..."
v0 auth whoami --json

Profiles live under XDG paths. Switch with --profile work or V0_PROFILE=work.

Health check

v0 doctor is a preflight any agent or human should run before a session. It validates the API key, network reachability, plan credits, the current rate-limit window, and the OpenAPI spec the CLI was built against.

bash
$ v0 doctor
v0 doctor
  api key  v1_***
  api reach  api.v0.dev/v1 (212ms)
  plan  pro  (credits: 4820/5000)
  rate limit  985/1000 (resets in 42min)
  openapi  55 operations
  killswitch  off

In --json mode it returns one envelope with all checks; exit code is non-zero if anything critical failed.

Shorthand

v0 <arg> auto-routes based on the shape of the arg. Paths, URLs, and template ids go to chat init (zero token cost, seeds a chat from existing source). Bare prompts and anything that is not path-like go to chat create. The explicit forms still work and show up cleaner in v0 audit tail.

Input
Routes to
v0 .
chat init — cwd
v0 ./dir
chat init — files
v0 ~/path · v0 /abs/path
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 (shadcn)
v0 https://v0.app/templates/…
chat init — template (id extracted)
v0 template_abc · v0 tpl_abc
chat init — template
v0 "landing page with hero"
chat create — prompt

Bare words like v0 dashboard go to chat create. Only paths, URLs, and template prefixes (template_, tpl_) route to chat init.

bash
# Prompts route to chat create
v0 "landing page with hero and pricing"

# Paths, URLs, and template ids route to chat init (no token cost)
v0 .                                            # cwd
v0 ./my-project                                 # local dir
v0 https://github.com/foo/bar                   # public repo
v0 https://example.com/dist.zip                 # zip archive
v0 https://example.com/registry.json            # shadcn registry
v0 https://v0.app/templates/optimus-…-LHv4frpA7Us   # template url
v0 template_abc                                 # template id

# Explicit forms still work (cleaner audit trail for agents)
v0 chat create --message "landing page with hero and pricing" --json
v0 chat init ./my-project --json