code_docs
CLI Reference
Reference

CLI Reference

The Code_ CLI (codecard) is the primary interface for managing your financial stack. Every feature is accessible from the terminal with optional JSON output for scripting.

💡Every command supports the --json flag for machine-readable output. Pipe it into jq for scripting or feed it to AI agents.

Installation

Terminal
# Install from GitHub
npm install -g github:rajparekh7/codecard-cli

# Or clone and build from source
git clone https://github.com/rajparekh7/codecard-cli.git
cd codecard-cli && npm install && npm run build
npm link  # makes 'codecard' available globally

Authentication

codecard auth login

Authenticate with Code_. Opens a browser for OAuth or accepts an API key directly.

Terminal
# Browser OAuth flow
codecard auth login

# API key authentication
codecard auth login --api-key sk_live_abc123

codecard auth logout

Clear stored credentials from the local keychain.

Terminal
codecard auth logout

codecard auth whoami

Display the currently authenticated user.

Terminal
codecard auth whoami

# JSON output
codecard auth whoami --json

Project Management

codecard project list

List all projects with status, budget, and associated card.

Terminal
codecard project list

# Output:
#   ●  ai-tutor-app    active  $5,000.00/mo  •••• 001
#   ●  vibe-cli        active  $2,000.00/mo  •••• 002

codecard project create

Create a new project. A virtual Visa card is automatically provisioned.

FlagDescriptionDefault
<name>Project name (required, positional)
-d, --descriptionProject description""
-b, --budgetMonthly budget in dollars2000
--jsonOutput as JSONfalse
Terminal
codecard project create "my-saas" --budget 5000

# Output:
# ✓ Project "my-saas" created
# ✓ Card •••• 4821 assigned
# ✓ Budget limit: $5,000/mo

Spend Tracking

codecard spend

View spend breakdown by category, provider, and project.

FlagDescription
-p, --project <name>Filter by project name
--jsonOutput as JSON
Terminal
# All spend
codecard spend

# Per-project spend
codecard spend --project ai-tutor-app

# JSON for scripting
codecard spend --json | jq '.byProvider[0]'

codecard balance

Check account balance, pending charges, and credit utilization.

Terminal
codecard balance

# Output:
#   Available      $12,400.00
#   Credit limit   $25,000.00
#   Credit used    $7,890.00

codecard pnl <project>

View profit & loss for a specific project, including revenue (via Stripe integration), top providers, and margin.

Terminal
codecard pnl ai-tutor-app

# Output:
#   Spend     $2,340.00
#   Revenue   $8,120.00
#   Net       +$5,780.00
#   Margin    71.2%

Card Management

codecard card list

List all virtual cards with status and spend vs. limit.

Terminal
codecard card list

codecard card freeze <cardId>

Instantly freeze a card to block all transactions. Use when you detect a cost spike or want to pause a project.

Terminal
codecard card freeze card_001

# Output:
# ✓ Card •••• 4096 is now frozen.

codecard card unfreeze <cardId>

Re-enable transactions on a frozen card.

Terminal
codecard card unfreeze card_001

Rewards

codecard rewards

View your Code Credits balance, reward tiers, and recent activity.

Terminal
codecard rewards

# Output:
#   Available    $142.30
#   5% — AI Model APIs:    $234.00 earned
#   4% — Cloud & Infra:    $78.80 earned
#   3% — Dev Tools:        $20.10 earned

Alerts

codecard alerts

View spend alerts including anomaly detection, budget thresholds, and new merchant notifications.

Terminal
codecard alerts

# Output:
#   ● CRITICAL  Spend spike detected
#     client-dashco — OpenAI spend jumped 340%
#   ○ WARNING   Budget 80% reached

MCP Server Mode

Start the MCP server to let AI agents (Claude, ChatGPT, etc.) manage your finances via tool use.

Terminal
# Start MCP server (stdio transport)
codecard mcp

# Or directly
node dist/mcp-server.js

See the MCP Server docs for full details.

Global Flags

FlagDescription
--jsonOutput machine-readable JSON (available on all commands)
-V, --versionPrint CLI version
-h, --helpShow help for any command

Exit Codes

CodeMeaning
0Success
1Error (not authenticated, not found, validation failure)