Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

agentwatch

Local-first token cost tracker for AI coding agents. Single Rust binary. Zero signup.

License: MIT Rust crates.io

![screenshot placeholder — will be replaced with real TUI screenshot]

The problem

AI coding agents — Claude Code, Codex, Gemini CLI — burn tokens invisibly. You finish a session and have no idea what it cost. Langfuse and Datadog are enterprise tools that require accounts, dashboards, and cloud data to get started. There was no simple, local, zero-signup way to watch your spend in real time as you code.

What agentwatch does

  • Sits between your terminal and the AI API as a local proxy
  • Intercepts every request from Claude Code, Codex, and Gemini CLI
  • Shows a live Ratatui TUI dashboard with token burn rate and cost per session
  • Stores everything in a local SQLite database — your data never leaves your machine
  • Single binary, cargo install agentwatch, no Docker required to run

Quick start

# install
cargo install agentwatch

# start the proxy + live dashboard
agentwatch start

# in another terminal — point your agent at the proxy
export ANTHROPIC_BASE_URL=http://localhost:7878   # Claude Code
export OPENAI_BASE_URL=http://localhost:7878       # Codex
export GOOGLE_API_ENDPOINT=http://localhost:7878   # Gemini CLI

# that's it — use your agent normally, watch the dashboard

Docker (optional)

# one-liner
docker run -p 7878:7878 -v agentwatch-data:/root/.agentwatch ghcr.io/zaydmulani09/agentwatch

# or with docker compose
docker compose up

Commands

Command Description
agentwatch start Start proxy + open live TUI dashboard
agentwatch report Print 7-day spend report
agentwatch report --days N Report for last N days (1–90)
agentwatch report --json Output report as JSON
agentwatch sessions List last 10 sessions
agentwatch reset Delete all data (prompts for confirmation)
agentwatch reset --force Delete all data without confirmation
agentwatch config Print current config file path and contents

Config

agentwatch creates ~/.agentwatch/config.toml on first run. Edit it to customize behavior:

# proxy port — point your agent's base URL here
port = 7878

# agents to track — remove any you don't use
track_agents = ["claude-code", "codex", "gemini-cli"]

# optional per-provider cost overrides (USD per 1k tokens)
# leave unset to use agentwatch's built-in pricing
[cost_overrides]
# anthropic_input_per_1k = 0.003
# anthropic_output_per_1k = 0.015
# openai_input_per_1k = 0.005
# openai_output_per_1k = 0.015
# gemini_input_per_1k = 0.00025
# gemini_output_per_1k = 0.00075

How it works

agentwatch runs a local HTTP proxy on port 7878. When your AI agent makes a request, agentwatch forwards it to the real upstream API unchanged — your API keys pass through untouched. It reads the usage object from each response, calculates the USD cost, writes the result to a local SQLite database, and broadcasts the event to the TUI via a tokio channel. The dashboard updates in real time.

Privacy

All data is stored in ~/.agentwatch/agentwatch.db on your local machine. Nothing is sent anywhere except the real API upstream — agentwatch is purely a pass-through proxy with local bookkeeping.

vs. alternatives

agentwatch Langfuse Datadog LLM LiteLLM
Local-first ⚠️
Zero signup
Single binary
Live TUI
Claude Code
Codex
Gemini CLI ⚠️ ⚠️ ⚠️
Free ⚠️

License

MIT

About

Local-first token cost tracker for AI coding agents. Single Rust binary. Zero signup.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages