AI Observer CLI
A local dashboard for Claude Code, Codex CLI, Gemini CLI, Copilot and OpenCode that shows tokens, cost, latency and errors
- 283 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Reads agent session files in your home folder, which hold prompts and replies, and copies their metadata into a local database
- Opens ports 8080 and 4318 with no documented authentication, so on a network the data is open to anyone who can reach the port
Install
- Works in
Manual install
docker run -d -p 8080:8080 -p 4318:4318 -v ai-observer-data:/app/data --name ai-observer tobilg/ai-observer:latestThe dashboard opens at http://localhost:8080 and the OTLP receiver listens on port 4318.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Reads agent session files in your home folder, which hold prompts and replies, and copies their metadata into a local database
- Opens ports 8080 and 4318 with no documented authentication, so on a network the data is open to anyone who can reach the port
This is third-party code. Review the repository files before installing.
What it does
AI Observer is a single executable with a web UI that receives OpenTelemetry telemetry from AI coding assistants and shows it on a dashboard at `http://localhost:8080`. An embedded DuckDB database stores the data and no external services are needed. It runs through Docker, Homebrew on Apple Silicon macOS or a prebuilt binary from releases. For Claude Code, Codex CLI and Gemini CLI there are two paths. Either set up OTLP export to port 4318, where `ai-observer setup claude-code` prints environment variables such as `CLAUDE_CODE_ENABLE_TELEMETRY=1`. Or configure nothing and run `ai-observer watch all`: the program follows session files in `~/.claude/projects`, `~/.codex/sessions` and `~/.gemini/tmp` and picks up new entries. `ai-observer import all` loads past history and computes cost from built-in prices. GitHub Copilot and OpenCode work through OTLP only. On the dashboard tokens, cost, API latency, error rate and session activity update over WebSocket. You can build your own dashboards from widgets by dragging. `ai-observer export` dumps data to Parquet and `ai-observer delete` removes it for a chosen period.
Who it is for. Developers and teams who use several AI assistants and want to see token and money spend in one place on their own machine.
Good fit when
- The Claude Code and Codex bill is growing and you cannot tell which sessions ate the budget
- You want one dashboard for Claude Code, Codex CLI, Gemini CLI and OpenCode without sending telemetry to third parties
- You do not want to configure OTLP export and `ai-observer watch all` is enough to read session files
- Months of logs have piled up and you need to calculate cost retroactively
- You need to archive the data to Parquet and hand it to a colleague for analysis
Not a fit when
- You need a cloud service with accounts and shared team access: AI Observer is built for one machine and a local database
- A one-off terminal report from Claude Code logs is enough: `ccusage` is simpler
- You work with agents outside the list: Claude Code, Codex CLI, Gemini CLI, GitHub Copilot and OpenCode are supported
- You need costs matching the provider's invoice exactly: prices are built in and can lag behind tariffs
Example request
Run AI Observer in Docker, hook up observation of my Claude Code and Codex sessions and show how much I spent this monthLimitations
- Five tools are supported: Claude Code, Codex CLI, Gemini CLI, GitHub Copilot and OpenCode. Copilot and OpenCode have no file reading and need OTLP export.
- Cost is computed from a built-in model price table. If a tariff changes, the calculation lags until the program is updated.
- The Homebrew package covers only Apple Silicon macOS; on other systems use Docker or the binary.
- The dashboard and ports 8080 and 4318 are meant for local access. If you expose them, add your own protection, as the description mentions no built-in authentication.
How to disable. Stop the container with `docker stop ai-observer` or end the process. Remove the OTLP variables from the environment, for example `CLAUDE_CODE_ENABLE_TELEMETRY` and `OTEL_EXPORTER_OTLP_ENDPOINT`. The database lives in `./data/ai-observer.duckdb` or a Docker volume and can be deleted. `ai-observer delete all --from DATE --to DATE` erases data for a period.
FAQ
How do I run AI Observer?
The shortest path is `docker run -d -p 8080:8080 -p 4318:4318 -v ai-observer-data:/app/data --name ai-observer tobilg/ai-observer:latest`, then open `http://localhost:8080`. On Apple Silicon Macs `brew tap tobilg/ai-observer` and `brew install ai-observer` work.
How do I connect Claude Code?
Run `ai-observer setup claude-code` and set the variables it shows, including `CLAUDE_CODE_ENABLE_TELEMETRY=1` and `OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318`. Or run `ai-observer watch claude-code` and skip the export.
Can I see spend for past months?
Yes, for Claude Code, Codex CLI and Gemini CLI. `ai-observer import all` reads session files and computes cost. `--dry-run` first shows what would be imported, and `--from` and `--to` limit the period.
Does data go to external services?
By the project description, no: telemetry stays in the local DuckDB database and no external services are required.
How do I move data to another tool?
`ai-observer export all --output ./export` saves data to Parquet files. Claude Code, Codex and Gemini also have a `--from-files` mode, while Copilot and OpenCode export from the database.
Discussion
No questions or reviews yet.
Related
CLI toolsOpenTelemetry-based CLI tracing for Claude Code, Cursor and Codex sessions, showing what the agent actually did and what it cost
Token and cost reports across Claude Code, Gemini CLI, Codex and Cursor in one view, built from local logs with no keys.
Tokscale
tokscale
A CLI with an interactive TUI that tracks token usage and cost across AI coding agents: Claude Code, Codex, Copilot, Cursor and more
A local telemetry collector for AI coding agents: tokens, sessions and tool calls in one OpenTelemetry-style event schema
Claude Usage
claude-usage
A local dashboard from Claude Code logs: tokens, models, sessions and projects. For Pro and Max subscribers it shows the full picture instead of a gauge
Token Monitor
token-monitor
A desktop widget for tracking tokens, cost and limits across 43 or more tools: Claude Code, Codex, Cursor, OpenRouter and others, for Windows and macOS
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| AI Observer (this card) | no | 283 | |
| ccusage | no | 19,337 | terminal reports from local logs, while AI Observer runs a web dashboard with OTLP, history and custom dashboards |
| Claude Code Agent Monitor | no | 1,152 | a dashboard for Claude Code and Codex, while AI Observer also covers Gemini CLI, Copilot and OpenCode |
README in short
The page explains why assistants need observability, lists features and gives four ways to run it: Docker, Homebrew, a binary and a source build. Then come environment variables, a command table, details of import, export and file-watching mode, and setup for Claude Code, Gemini CLI, Codex, Copilot and OpenCode.