Prtokens – See how much AI agent tokens cost a PR Prtokens, a new open-source tool, estimates AI agent token costs per pull request by reading local coding-agent transcripts and posting a single cost comment on GitHub. The tool supports Claude Code, Codex, and OpenCode, ensuring aggregate data never leaves the user's machine. Attribute coding-agent token usage to the GitHub pull request that shipped it. prtokens reads your local Claude Code, Codex, and OpenCode transcripts, attributes token usage to the commits on your PR branch, and posts a single estimated-cost comment. Only aggregate numbers leave your machine. - Authenticate the GitHub CLI once: gh auth login - From a repository, on a branch with an open PR, run: npx prtokens prtokens finds the open PR, reads your local transcripts, and posts or updates the comment. Run it again anytime to refresh. A single comment showing total estimated cost, token and session counts, models used, agent costs, and a collapsible per-commit table. The same comment is updated in place on later runs; multiple contributors each get their own labeled section. Sessions counts top-level coding-agent sessions. For OpenCode, child/subagent sessions are grouped under their parent session. Example commit table collapsed by default : 980k in / 42k out · 7 sessions Models: claude-sonnet-4-6 , gpt-5-codex Agents: claude-code ~$3.40 · codex ~$0.72 Commit breakdown | Commit | Message | In | Out | Cost | Sessions | |---|---|---|---|---|---| a1b2c3d | feat: add usage readers | 420k | 18k | ~$1.55 | 3 | e4f5a6b | test: cover attribution | 310k | 12k | ~$1.10 | 2 | c7d8e9f | fix: dedupe sessions | 250k | 12k | ~$1.47 | 2 | Generated by prtokens | Command | What it does | |---|---| prtokens | Resolve the current branch's open PR, read local usage, and post or update the comment. | prtokens --pr