LLM Cost Ops - CLI
Command-line interface for LLM Cost Ops platform
A powerful, user-friendly CLI tool for managing LLM costs, generating reports, and administering the Cost Ops platform.
Features
- Database Management - Initialize, migrate, and manage databases
- Data Import/Export - Import usage data from various formats
- Report Generation - Generate and download cost/usage reports
- Cost Queries - Query and analyze cost data
- User Management - Create and manage users and API keys
- Organization Management - Manage organizations and permissions
- Server Management - Start and manage API servers
- Interactive Mode - REPL-style interactive shell
Installation
From crates.io
From source
Verify installation
Quick Start
Initialize Database
# SQLite (default)
# PostgreSQL
Import Usage Data
# Import from OpenAI format
# Import from Anthropic format
# Batch import
Query Costs
# Query costs for organization
# Query with grouping
# Export to CSV
Generate Reports
# Cost report
# Usage report
# Email report
Forecast Costs
# 30-day forecast
# Anomaly detection
User Management
# Create user
# Generate API key
# List users
# Update roles
Organization Management
# Create organization
# Set budget
# List organizations
Server Management
# Start API server
# Start with custom config
# Health check
Commands
Database Commands
# Initialize database
# Run migrations
# Rollback migrations
# Reset database (WARNING: deletes all data)
# Database status
Import Commands
# Import usage data
|||
# Import pricing data
# Import batch
Query Commands
# Query costs
# Top consumers
# Usage summary
Report Commands
# Generate report
||||||
# List reports
# Download report
# Schedule report
Forecast Commands
# Cost forecast
# Usage forecast
# Detect anomalies
User Commands
# Create user
# List users
# Generate API key
# Revoke API key
# Update roles
Organization Commands
# Create organization
# List organizations
# Set budget
||
# View budget status
Server Commands
# Start server
# Health check
# Generate config
Configuration
Configuration File
Create ~/.config/cost-ops/config.toml:
[]
= "postgresql://user:pass@localhost/costops"
[]
= "0.0.0.0"
= 8080
[]
= "your-secret-key"
[]
= "org-123"
= "table"
Environment Variables
Interactive Mode
Start an interactive shell:
cost-ops> query --organization org-123
cost-ops> report --type cost --format csv
cost-ops> forecast --horizon 30
cost-ops> exit
Output Formats
- table - Formatted ASCII table (default)
- json - JSON format
- csv - CSV format
- yaml - YAML format
- excel - Excel spreadsheet
- pdf - PDF report
Examples
Monthly Cost Report Pipeline
#!/bin/bash
# Generate monthly cost report and email it
ORG="org-123"
MONTH=
Import and Analyze
#!/bin/bash
# Import usage data and analyze
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
Links
- Documentation: https://docs.rs/llm-cost-ops-cli
- Core Library: https://crates.io/crates/llm-cost-ops
- Repository: https://github.com/globalbusinessadvisors/llm-cost-ops