Version 2.0 Available

Track, Audit, and Control Agent Expenditure.

The enterprise-grade observability platform for tracking infrastructure costs, developer sessions, and API usage across multi-provider deployments.

bash
$npm install -g codesession-cli

Integrates securely with

OpenAI
Anthropic
Google Gemini
Azure AI
Cohere
Local LLMs
localhost:3737
CostHQ Dashboard Overview

Core Observability Modules

A comprehensive toolkit for auditing application behavior and expenditure, engineered for strict compliance.

cs log-ai --provider anthropic

Expenditure & Token Auditing

Log API calls with exact provider, model, and token counts. Built-in pricing definitions for 17+ commercial models alongside custom pricing support for self-hosted instances. Strict budget enforcement prevents runaway scripts.

VCS Telemetry

Automated Git polling captures commit hashes, messages, and authorship. Backfills historical data on session termination via standard diff analysis.

Filesystem Watcher

Chokidar-based event monitoring detects structural changes, scoped exclusively to the repository root to ensure host isolation.

Session & Duration Control

Cryptographically identified sessions with precise duration tracking. Supports concurrent execution environments and automated recovery protocols for stale or interrupted processes.

cs start "data-pipeline"cs end

Native TypeScript SDK

Implement strict architectural controls programmatically. Wrap operational loops and enforce expenditure limits via automated circuit breakers.

BudgetExceededErrorCircuit breaker exception handling
session.canAfford(n)Pre-flight expenditure validation
--json flagStandardized machine-readable outputs
pipeline.ts
import { AgentSession, BudgetExceededError }
  from 'codesession-cli/agents'

const session = new AgentSession(
'ETL processing',
{ budget: 5.00, git: true }
)

session.start()

// Mid-process validation
if (!session.canAfford(2.00)) {
// Failsafe execution route
}

const metrics = session.end()

Licensing

Transparent, predictable flat-rate licensing for engineering teams.

Free Tier

$0 / forever
  • Full CLI access & built-in AI pricing
  • Local SQLite Database & Git Integration
  • Basic Dashboard & session history
Recommended

Pro Subscription

$12 / month

Billed monthly. Cancel anytime.

  • The Spend Firewall & Custom Pricing
  • Runaway Agent Alerts & Alarms Dashboard
  • Advanced Insights (Heatmaps, Hotspots)
  • Shareable Stats Card & CSV Export

Pro Lifetime

$249 / once
  • All Pro Tier features included forever
  • Pay once, own it forever
  • Lifetime updates & future Pro features

CostHQ — Free CLI to Track Coding Sessions and AI Costs

CostHQ (formerly codesession-cli) is an open-source Node.js command-line tool published on npm. It tracks developer coding sessions including session duration, file changes, git commits, and AI API costs. Supported AI providers include Anthropic (Claude), OpenAI (GPT-4o, GPT-4), Google (Gemini), Azure OpenAI, and Cohere — with built-in pricing for 17+ models.

Install with: npm install -g codesession-cli. Use cs start to begin a session, cs log-ai to record AI usage costs, cs end to finish and summarize, and cs dashboard to open the real-time web analytics UI at localhost:3737. All data is stored locally in a SQLite database at ~/.codesession/sessions.db. No cloud sync, no telemetry.

Keywords

CostHQ, codesession-cli, codesession cli, coding session tracker, code session tracker, AI cost tracking CLI, AI API cost tracker, track AI costs developer, claude cost tracker, openai cost tracker cli, anthropic cost tracker, gpt4 cost tracking, llm cost tracker, developer session tracker, coding time tracker, terminal session tracker, npm session tracker, git commit session tracker, file change tracker cli, developer productivity cli, ai agent session manager, openclaw codesession, free developer time tracker cli, open source coding session tracker