# TokenZero CLI (v0.2.2)

One command, no code changes: audits your repository locally (source never leaves the machine), creates a workspace and writes the gateway base URLs to .env.

## Install

    curl -fsSL https://tokenzero.sh/install.sh | sh        # single file to ~/.local/bin/tokenzero, needs Node.js 20+
    npx -y @tokenzero/cli init                       # or run it without installing
    npx -y https://tokenzero.sh/cli/tokenzero.tgz init      # same bundle, served from this gateway

Assets: https://tokenzero.sh/cli/tokenzero.mjs (the bundle), https://tokenzero.sh/cli/tokenzero.tgz (npm-installable tarball). Source and tests: https://github.com/tokenzero-ai/tokenzero (Apache-2.0).

## Commands

    tokenzero signup [--name NAME]                  create a workspace, save the key to ~/.config/tokenzero/credentials.json
    tokenzero dashboard [--json]                    one-click dashboard link for the saved key (key travels in the URL fragment only)
    tokenzero init [dir] [--yes] [--mcp] [--agent-rules] [--github-action]
                                                    audit locally, create a workspace, point OPENAI_BASE_URL / ANTHROPIC_BASE_URL at the gateway;
                                                    --mcp writes .mcp.json and .cursor/mcp.json, --agent-rules adds an AGENTS.md section
    tokenzero audit [dir] [--json | --format markdown] [--diff file|-] [--fail-over PCT]
                                                    static token-waste audit; nothing is uploaded; --fail-over makes it a CI gate
    tokenzero usage [--json]                        routed spend vs the free tier, savings, fee preview
    tokenzero doctor [--key K] [--json]             six-check connection and receipt doctor (gateway, signer, pricing, key, quota, settings)
    tokenzero metrics [--window 30d] [--key K] [--json] [--demo]   value scorecard: savings, ROI, engines, speed, parity, reliability, per-model, recommendations
    tokenzero verify <request_id>                   verify a savings receipt's signature offline
    tokenzero verify --chain [--limit N]            verify the workspace's append-only receipt chain (signatures, seq, prev hashes)
    tokenzero rotate-key [--yes]                    issue a new workspace key; the old one dies immediately
    tokenzero version

Env: TOKENZERO_URL, TOKENZERO_KEY, NO_COLOR

## Gateway

Point any SDK at https://tokenzero.sh/v1 (OpenAI-compatible) or https://tokenzero.sh (Anthropic) with your own provider key. Docs for agents: https://tokenzero.sh/llms.txt · OpenAPI: https://tokenzero.sh/openapi.json · MCP: https://tokenzero.sh/mcp
