Tools

CLI Reference

Complete reference for the aicostguard CLI tool. Monitor costs, set budgets, and query usage from your terminal.

Installation

npm install -g @aicostguard/cli


Authentication

# Set your API key


aicostguard auth login





# Or use environment variable


export COST_GUARD_API_KEY=cg_your_key_here


Commands

Dashboard

# View real-time cost summary


aicostguard dashboard





# Filter by project


aicostguard dashboard --project my-chatbot





# Filter by date range


aicostguard dashboard --from 2026-03-01 --to 2026-03-15


Cost Query

# View costs grouped by model


aicostguard costs --group-by model





# View costs grouped by feature


aicostguard costs --group-by feature --period weekly





# Export as CSV


aicostguard costs --format csv --output costs.csv





# Export as JSON


aicostguard costs --format json


Budget Management

# List active budgets


aicostguard budgets list





# Create a budget


aicostguard budgets create \


  --name "Production Daily" \


  --amount 100 \


  --period daily \


  --alert-at 50,80,100 \


  --auto-stop





# Delete a budget


aicostguard budgets delete --id budget_abc123


Project Management

# List projects


aicostguard projects list





# Create a project


aicostguard projects create --name "My Chatbot"





# View project costs


aicostguard projects costs --id proj_abc123


Alerts

# View recent alerts


aicostguard alerts list





# Acknowledge an alert


aicostguard alerts ack --id alert_abc123


Simulation

# Simulate switching models


aicostguard simulate \


  --from gpt-4 \


  --to gpt-4o-mini \


  --project my-chatbot





# Output:


# Current cost:  $4,200/month (GPT-4)


# Projected cost: $42/month (GPT-4o-mini)


# Savings:       $4,158/month (99%)


Global Options

Flag Description
--api-key Override API key
--project Filter by project
--format Output format: table, json, csv
--no-color Disable colored output
--verbose Enable debug output