@modelstat/agent
v0.0.10
Published
modelstat companion — reads local AI-tool usage and ships tokenised events to modelstat.
Downloads
129
Maintainers
Readme
modelstat
See every AI token your team spends. Local companion for modelstat — reads the session logs your AI coding tools already write (Claude Code, Codex, Cursor, Cline, Continue, Aider, Windsurf, Zed, Copilot, Claude Desktop), tokenises events on-device, and uploads only metadata to your modelstat dashboard.
Your prompts never leave your machine. The agent uploads only token counts, model ids, timestamps, and a provider-assigned session id. Source is auditable on GitHub.
Install
The fastest way:
curl -fsSL https://install.modelstat.ai | shOr via Homebrew:
brew install modelstat/tap/modelstat
modelstat connectOr via npm / pnpm / bun:
npm install -g @modelstat/agent && modelstat connect
pnpm add -g @modelstat/agent && modelstat connect
bun add -g @modelstat/agent && modelstat connectmodelstat connect installs a launchd user agent on macOS (at ~/Library/LaunchAgents/ai.modelstat.agent.plist) or a systemd user unit on Linux (at ~/.config/systemd/user/modelstat.service). The daemon starts automatically on login.
Requires Node 20+ (or skip Node entirely with the Homebrew route). macOS and Linux (x86_64, arm64) supported.
Commands
modelstat connect # pair + install background service, then exit
modelstat status # show pairing + service state
modelstat paths [--json] # print state file + log paths + API URL
modelstat stop # stop and uninstall the service
modelstat scan # one-shot parse + upload of local JSONL
modelstat watch # foreground watcher (no service install)
modelstat discover # report detected tool installs + identitiesProgrammatic pairing (used by harness skills for OpenClaw, NanoClaw, etc.):
modelstat connect --json --no-browserEmits one NDJSON event per line. Schema documented at integrations/harness-skills/modelstat-connect/README.md.
Shared state across install methods
Installing via both Homebrew and npm on the same laptop produces the same binary reading the same state file — on macOS that's ~/Library/Preferences/modelstat-agent-dev-nodejs/config.json. Your device UUID, bearer token, and pairing state persist across install methods. No duplicate devices on the server side either — the API upserts on (user_id, machine_id).
MCP server
Pair the agent, then install @modelstat/mcp to query your own spend from inside Claude Desktop, Cursor, Cline, Continue, or Zed:
# Claude Code
claude mcp add modelstat -- npx -y @modelstat/mcpFull wire-up docs per client: https://modelstat.ai/mcp
Self-host
To point the agent at your own modelstat API (not the hosted SaaS):
export AGENT_API_URL=https://your-modelstat-api.example.com
modelstat connectAGENT_API_URL can also be set persistently via .env or in the systemd/launchd unit.
Privacy
- Agent reads local session logs written by the tools you use. Nothing is intercepted — the tools already write these files.
- Upload payload: token counts, model name, timestamps, provider-assigned session id, git remote URL (redactable), redacted work-type summary.
- Never uploaded: prompt text, model responses, file contents, tool-call arguments, environment variables, SSH keys, secrets.
- Redaction is on-device via
@modelstat/parsers. - Offline mode: buffered locally, uploaded when network returns.
modelstat scan --dry-runfor local-only analytics.
Pricing
- Free: 100M tokens/month, 1 device, no card.
- Team: $5/seat/month with 250M pooled tokens; overage at $25/billion.
- Enterprise: SSO/SCIM, on-prem ingest, SLAs — contact
[email protected].
License
Apache-2.0. Source at https://github.com/modelstat/modelstat/tree/main/apps/agent-dev.
