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.
jq for scripting or feed it to AI agents.Installation
# 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 globallyAuthentication
codecard auth login
Authenticate with Code_. Opens a browser for OAuth or accepts an API key directly.
# Browser OAuth flow
codecard auth login
# API key authentication
codecard auth login --api-key sk_live_abc123codecard auth logout
Clear stored credentials from the local keychain.
codecard auth logoutcodecard auth whoami
Display the currently authenticated user.
codecard auth whoami
# JSON output
codecard auth whoami --jsonProject Management
codecard project list
List all projects with status, budget, and associated card.
codecard project list
# Output:
# ● ai-tutor-app active $5,000.00/mo •••• 001
# ● vibe-cli active $2,000.00/mo •••• 002codecard project create
Create a new project. A virtual Visa card is automatically provisioned.
| Flag | Description | Default |
|---|---|---|
| <name> | Project name (required, positional) | — |
| -d, --description | Project description | "" |
| -b, --budget | Monthly budget in dollars | 2000 |
| --json | Output as JSON | false |
codecard project create "my-saas" --budget 5000
# Output:
# ✓ Project "my-saas" created
# ✓ Card •••• 4821 assigned
# ✓ Budget limit: $5,000/moSpend Tracking
codecard spend
View spend breakdown by category, provider, and project.
| Flag | Description |
|---|---|
| -p, --project <name> | Filter by project name |
| --json | Output as JSON |
# 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.
codecard balance
# Output:
# Available $12,400.00
# Credit limit $25,000.00
# Credit used $7,890.00codecard pnl <project>
View profit & loss for a specific project, including revenue (via Stripe integration), top providers, and margin.
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.
codecard card listcodecard card freeze <cardId>
Instantly freeze a card to block all transactions. Use when you detect a cost spike or want to pause a project.
codecard card freeze card_001
# Output:
# ✓ Card •••• 4096 is now frozen.codecard card unfreeze <cardId>
Re-enable transactions on a frozen card.
codecard card unfreeze card_001Rewards
codecard rewards
View your Code Credits balance, reward tiers, and recent activity.
codecard rewards
# Output:
# Available $142.30
# 5% — AI Model APIs: $234.00 earned
# 4% — Cloud & Infra: $78.80 earned
# 3% — Dev Tools: $20.10 earnedAlerts
codecard alerts
View spend alerts including anomaly detection, budget thresholds, and new merchant notifications.
codecard alerts
# Output:
# ● CRITICAL Spend spike detected
# client-dashco — OpenAI spend jumped 340%
# ○ WARNING Budget 80% reachedMCP Server Mode
Start the MCP server to let AI agents (Claude, ChatGPT, etc.) manage your finances via tool use.
# Start MCP server (stdio transport)
codecard mcp
# Or directly
node dist/mcp-server.jsSee the MCP Server docs for full details.
Global Flags
| Flag | Description |
|---|---|
| --json | Output machine-readable JSON (available on all commands) |
| -V, --version | Print CLI version |
| -h, --help | Show help for any command |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (not authenticated, not found, validation failure) |