How to Attribute Claude Code and Cursor Spend to Teams and Repos
To attribute AI coding spend, every agent turn needs three facts attached: who ran it, what it cost, and which repository it ran in. Once each turn has those, totals per developer, repo, pull request, client, and month are just sums. The vendor dashboards give you the first two at best. The repository is the missing piece, and it has to be captured where the agent runs.
This guide covers what Claude Code and Cursor give you out of the box, what each misses, and a setup that attributes spend across every tool your team uses.
What each tool reports on its own
Checked on 2026-10-25:
| Source | Per developer | Per repository | Per PR or client | Cost |
|---|---|---|---|---|
| Cursor team dashboard | Yes (Teams, Enterprise) | No | No | Yes |
| Cursor AI Code Tracking API | Per commit | Per commit | No | No, code attribution |
| Claude Team/Enterprise analytics | Yes; spend via CSV export or the Enterprise Analytics API | No | No | Estimated, refreshed daily |
| Claude Code OpenTelemetry | Yes (user.email when signed in, or one key per developer) | Yes, with OTEL_METRICS_INCLUDE_REPOSITORY=true | No | Estimated cost_usd per request |
| PromptConduit hooks (Cursor, Claude Code, Codex, Gemini CLI, Copilot, Grok Build) | Yes, by API key | Yes | Yes: branch, open PR, client tag | API-equivalent per turn |
Two gaps stand out. No vendor dashboard reports spend per repository, and none combines tools: Cursor’s report doesn’t know about Claude Code, and Claude’s doesn’t know about Cursor.
The three facts, and where they come from
Who. Give each developer their own key. With PromptConduit that’s the API key each person creates on their profile; with a raw OpenTelemetry setup it’s the user.email attribute (present when the developer is signed in to a Claude account) or a per-developer header. Claude Code’s user.id is a random per-install id, so don’t group by it. Shared keys merge people together, and no later step can separate them.
What it cost. Every agent turn has token counts: input, output, cache read, and cache write. Price them at the model’s published rates. Claude Code does this itself in its telemetry (cost_usd). For Cursor and the other tools, the CLI prices each turn locally against the rate card.
Which repo. Read it from the workspace’s git origin remote at the moment the turn runs. The branch matters too: a branch with an open pull request lets you total spend per PR. Repos then map to clients for re-billing.
Set it up for a team
-
Create the team at app.promptconduit.dev/team and invite each developer with the accept link the team page gives you.
-
Each developer installs the CLI and the hooks for the tools they use:
curl -fsSL https://promptconduit.dev/install | bash promptconduit initinitsigns them in and installs hooks for the tools it finds. Each turn is written to a local file first, then synced with the repo, branch, commit, and linked pull request. -
Claude Code users who’d rather not install anything can send cost through Claude Code’s OpenTelemetry export instead. It’s six settings, covered in the Claude Code telemetry guide. It gives per-member and per-repo cost, but not branch or PR.
-
Tag repositories with clients, if you bill them, on the team page.
-
Set budgets for the team, a repo, or a member. Alerts go out by email and to Slack at 80% and 100%.
The team page then shows cost by member, model, repository, client, pull request, and day, with a CSV export for each grouping.
Common pitfalls
- Counting a session twice. If a developer runs both the CLI and Claude Code telemetry, the same spend arrives twice. PromptConduit keeps the CLI’s numbers for any session the CLI has priced and drops the telemetry cost for it.
- Monorepos. Attribution is per repository, not per directory. A monorepo shows as one repo, with pull requests as the finer grain.
- Worktrees and forks. The repo name comes from
origin, so a fork with its own origin counts as a different repo. - Expecting invoice totals. Rates are public API list prices. Seat plans, included usage, and discounts are not modeled.
Related guides
- Cursor expense tracker for teams
- Claude Code OpenTelemetry cost tracking
- AI coding spend per client repo, for agencies
- Track Claude Code token usage and cost, for one developer
Teams of up to 3 are free. Team is $99 per month flat for up to 15 members, and Growth is $249 per month for up to 50. See pricing.
Frequently asked questions
How do I attribute Claude Code and Cursor spend to teams and repos?
Record every agent turn with three things: who ran it, its cost, and the git repository it ran in. Each developer syncs with their own key, which answers who. The cost comes from the turn's token counts. The repo comes from the workspace's git remote. Totals per member, repo, pull request, and client then fall out of the same records.
How do I see AI usage broken down by repository or project?
Neither Cursor's team dashboard nor Claude's Team analytics breaks spend down by repository. Capture usage with its git context: Claude Code's OpenTelemetry export can include the repository when OTEL_METRICS_INCLUDE_REPOSITORY is true, and PromptConduit's hooks tag every Cursor, Claude Code, Codex, and Gemini CLI turn with its repo and branch.
Can I charge AI spend back to clients?
Yes, if each client's work happens in that client's repositories. Map each repository to a client, total spend per client for the period, and export it. PromptConduit's team page does this and exports CSV by client, repository, pull request, member, or day.
Are these costs exact?
They are estimates at public API rates. Claude Code describes its own cost_usd as an estimate, and Cursor's plan pools and Cursor Token Rate are not modeled. They show where spend goes; your invoices show what you owe.