Skip to main content

AI code intelligence: token tracking, attribution, cost analysis for Claude Code, Codex, Cursor

Project description

obsly-ai

AI code intelligence: token tracking, attribution, and cost analysis for Claude Code, Codex, and Cursor.

Weekly budget panel Full dashboard Live calls

obsly-ai is one place to see what your AI coding agents are spending, what's left in your usage windows, and which lines of code they actually wrote. It works locally, supports Claude Max + Codex side by side, and ships a zero-dependency core so you can drop it into any agent's process without a virtualenv dance.

What you get

  • Live dashboard — Claude weekly / Sonnet / 5h utilization and Codex 7d / 5h windows in one view, with burndown charts and live API calls.
  • macOS menubarClaude: xx% and Codex: yy% always visible, with reset times and pace in the dropdown.
  • AI code attribution (gitai) — git-notes-based record of which code each AI agent wrote, queryable with ai-blame and ai-stats. Zero dependencies, runs in agent hooks.
  • LLM proxy (optional) — mitmproxy addon that captures provider, model, tokens, cost, repo, branch, and git user from intercepted API calls. Enterprise team dashboard included.

Claude stays on its own calculation path. Codex is added as a separate source with its own cycle and resets — never forced into Claude's billing window.

Installation

# Core: dashboard + gitai attribution (zero dependencies)
pip install obsly-ai

# With macOS menubar
pip install "obsly-ai[menubar]"

# With LLM proxy + team dashboard
pip install "obsly-ai[proxy]"

# Everything (for development)
pip install -e ".[all]"

Requires Python 3.10+.

Quickstart

# Live web dashboard at http://localhost:8765
obsly-ai live

# macOS menubar
obsly-ai menubar

# One-shot analytics
obsly-ai analyze
obsly-ai burndown
obsly-ai report

The legacy claude-dashboard entrypoint is kept as an alias.

Main views

Live dashboard

  • Claude weekly utilization, Sonnet utilization, and 5h window
  • Codex 7d used / left, 5h used, reset times, plan type
  • Claude burndown chart + separate Codex chart from local session logs
  • Live API calls, session costs, and recent activity
obsly-ai live
obsly-ai live --no-browser --port 8765

Menubar

  • Claude: xx% and Codex: yy% in the bar
  • Claude weekly / Sonnet / 5h, Codex 7d / 5h, reset times, pace, recent session costs in the dropdown
obsly-ai menubar

AI code attribution (gitai)

obsly-ai ships a zero-dependency attribution engine that records which AI agent wrote each line of code, stored in refs/notes/ai (git notes). It installs hooks into Claude Code, Codex, Cursor, and Windsurf so attribution happens automatically as the agent edits files.

Install the hooks

# Install hooks into every detected agent (Claude Code, Codex, Cursor, Windsurf)
# plus pre-commit / post-commit / post-rewrite hooks in the current repo
obsly-ai ai-install

# Or target a single agent
obsly-ai ai-install --agent claude-code
obsly-ai ai-install --dry-run        # preview without writing

# Check what's wired up
obsly-ai ai-status

# Remove hooks
obsly-ai ai-uninstall

ai-install writes to each agent's own settings file (~/.claude/settings.json, ~/.codex/hooks.json, ~/.cursor/hooks.json, ~/.codeium/windsurf/hooks.json) and to .git/hooks/ in the current repo. It never touches your git config, staging area, or working tree.

Query attribution

ai-blame path/to/file.py            # like git blame, with AI agent + session per line
ai-blame path/to/file.py -L 40,80   # limit to a line range
ai-blame path/to/file.py --cost     # join with proxy cost data

ai-stats                            # recent commits, % AI per commit
ai-stats --repo                     # repo-wide breakdown by agent / author
ai-stats --durability               # how much AI-written code survives over time

The whole gitai/ package uses only Python stdlib so it can run safely inside any agent's process without polluting their environment.

LLM proxy + team dashboard (optional)

pip install "obsly-ai[proxy]"
obsly-ai proxy        # start mitmproxy with the obsly addon
obsly-ai server       # team dashboard at http://localhost:8800
obsly-ai doctor       # health checks for proxy + cert + storage

Captures every LLM API call (Anthropic, OpenAI, Mistral, DeepSeek) and attributes it via PID → cwd → git remote → branch → git config user.email. Events are persisted as JSONL locally and aggregated in the team dashboard.

Data sources

Claude

Reads the Claude Code OAuth token from macOS Keychain (Claude Code-credentials) and calls:

GET https://api.anthropic.com/api/oauth/usage
Authorization: Bearer <your token>
anthropic-beta: oauth-2025-04-20

That's the same utilization source behind /usage. It also parses ~/.claude/projects/**/*.jsonl for per-call detail.

Codex

Local-only, from ~/.codex/sessions/**/*.jsonl. Parses token_count events and uses:

  • rate_limits.secondary.used_percent → 7-day window
  • rate_limits.primary.used_percent → 5-hour window
  • resets_at → reset times
  • plan_type when present

Privacy

  • All log parsing is local
  • Claude project logs and Codex session logs are read-only
  • The only outbound call is the Claude usage API to Anthropic, using your own local OAuth token
  • The proxy stores events locally as JSONL by default; the team dashboard is opt-in

Project layout

claudedashboard/        # Core package
  cli.py                # Unified entrypoint (obsly-ai / claude-dashboard)
  live.py               # Live SSE dashboard (port 8765)
  analyze.py            # Text analytics
  burndown.py           # Weekly burndown
  report.py             # One-shot HTML report
  menubar.py            # macOS menubar [extra: menubar]
  proxy/                # LLM traffic proxy [extra: proxy]
  gitai/                # AI code attribution (zero deps)
saas/                   # Web product (landing, onboarding, dashboard)
tests/                  # pytest suite

See CLAUDE.md for development guidelines (TDD, dependency tiers, hook safety rules).

Development

pip install -e ".[all]"
pytest tests/ -v

The project follows strict TDD and a three-tier dependency policy: core + gitai/ are pure stdlib, optional features are pinned in pyproject.toml extras, dev tools are isolated. See CLAUDE.md for details.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsly_ai-0.3.1.tar.gz (114.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

obsly_ai-0.3.1-py3-none-any.whl (102.7 kB view details)

Uploaded Python 3

File details

Details for the file obsly_ai-0.3.1.tar.gz.

File metadata

  • Download URL: obsly_ai-0.3.1.tar.gz
  • Upload date:
  • Size: 114.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for obsly_ai-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b914de7d441337b70dcb670cfd2e76e7663583374663c5cdf9a17dfe74c723ad
MD5 be2dd0c7fd7077ef2ef62a889dd19e96
BLAKE2b-256 ebac54a8062cb90fb70b03b5a2c4561acbe1f5a7336b8a20624b01a53d114fe4

See more details on using hashes here.

File details

Details for the file obsly_ai-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: obsly_ai-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 102.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for obsly_ai-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a86057df23d164a897e96645f6ba5ebd8ecc74d66974be2a6721312e6e6f73
MD5 86614229533618056534590ff59fda8d
BLAKE2b-256 ddaf84330282d6c74a698abfc2b3b92d745d0f1e7517640a863d35dad7d7aeda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page