Skip to content

All posts

AI

How to track AI coding tool cost per developer

Ritesh Patel

AI: How to track AI coding tool cost per developer

To track AI coding tool cost per developer, attribute each paid request to a person and total spend per person. Claude Code exports per-user cost through OpenTelemetry, and Team and Enterprise admins see estimated spend per user in the admin console. GitHub Copilot shows monthly cost per developer. Set Claude Code’s contracted rates first, or the figures miss the invoice.

Checked against Claude Code’s cost, monitoring and settings docs, and GitHub’s Copilot metrics and budget docs, as of 2026-10-28. The docs name no Claude Code CLI version for the commands, OpenTelemetry variables or metric names in this post. The one version gate is the modelPricing setting: v2.1.242 or later, and v2.1.271 or later for a markup.

Choose the cost source for each setup

Each setup reports spend in a different place, and only some of them report per person. A Claude Code session on an individual plan, a Team seat, a Console workspace and a cloud account each produce different numbers, so find the billing path your developers use before you build a report.

Setup Where spend shows Per-person view Cap available What the dollar figure covers
Claude Code on Team or Enterprise Spend report in org analytics Estimated spend per user and per model, CSV export, updated daily Spend limits on usage credits Usage-credit spend only
Claude Console (API) Console usage page Console dashboard and Claude Code Analytics API Workspace spend limits Per-token billing
Amazon Bedrock, Google Cloud, Microsoft Foundry Cloud billing console OpenTelemetry or an LLM gateway Cloud budget controls Per-token billing to your cloud account
GitHub Copilot under usage-based billing Impact dashboard Usage metrics API per user, plus monthly cost per developer in the dashboard Budgets, including per-user budgets AI credits consumed

The table has one gap that a dashboard cannot close. On Team and Enterprise plans, usage inside the seat allowance is not metered in dollars. A per-user dollar figure therefore covers only the part billed to usage credits. Report the seat allowance and the usage-credit spend as two separate lines, and do not add them together as one cost.

Track Claude Code cost with OpenTelemetry

OpenTelemetry works on every Claude Code setup. The costs page calls it the only option that streams per-user token and cost metrics into your own observability stack in near real time. Claude Code emits claude_code.cost.usage in USD and claude_code.token.usage, split by a type attribute with the values input, output, cacheRead and cacheCreation. Both carry a model attribute and a query_source attribute (main, subagent or auxiliary). The claude_code.session.count metric counts sessions and is the one to check first.

  1. Turn telemetry on and send metrics over OTLP. Put these variables in the env block of managed settings, so they apply to every session rather than one shell.
  2. Set the OTLP protocol. Claude Code has no default protocol for OTLP, so the variable must be explicit.
  3. Add team tags with OTEL_RESOURCE_ATTRIBUTES. Values cannot contain spaces, so use team.id=platform rather than a team name with spaces.
  4. Start one session and confirm that claude_code.session.count arrives in your backend. The default export interval is 60000 ms. The docs’ example uses 10000 ms.
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_METRIC_EXPORT_INTERVAL=10000
export OTEL_RESOURCE_ATTRIBUTES=department=engineering,team.id=platform,cost_center=eng-123

Replace the endpoint with your collector’s address. The values above come from the docs’ quick start and attribute example, so the team and cost center names are only examples.

Pick the identity attribute

Every metric carries an identity attribute, but they do not behave the same way. Group Claude Code cost by the first two rows. Do not group by the third.

Attribute Set by Use for per-developer cost
user.email Sign-in, or the session’s own credentials in a cloud session Yes, when present. It matches your identity provider
user.account_uuid Sign-in, on by default through OTEL_METRICS_INCLUDE_ACCOUNT_UUID Yes. A stable ID for the account
user.id A random value created on first run and stored in ~/.claude.json No. One developer on two machines shows as two users

The docs say user.id is an anonymous identifier that contains no personal information and is not derived from the Claude account. Deleting the file produces a new, unrelated value, so it cannot join a person across machines. Dashboards that group by user.id will split one developer’s spend in two.

Set contracted rates so the numbers match the bill

By default Claude Code reports every cost figure at list price. The costs page says the figures in /usage, the status line and OpenTelemetry do not match your bill when your organization pays contracted rates. The modelPricing managed setting fixes that. It changes what Claude Code reports, not what Anthropic charges. Claude Code ignores the key in user, project and local settings and in --settings, so it must come from managed settings.

  1. Take the per-million-token rates for each model from your contract. Claude Code does not fetch them, so update the setting when the contract changes.
  2. Set multiplier for a flat discount or markup, overrides for per-model rates, or both. Each override needs input, output, cacheRead and cacheWrite.
  3. Deploy the setting in managed settings, then run /usage in a session that received it. The Total cost line should carry the note at your organization's configured rates.
{
  "modelPricing": {
    "multiplier": 0.85,
    "overrides": {
      "claude-sonnet-4-6": {
        "input": 2.4,
        "output": 12,
        "cacheRead": 0.24,
        "cacheWrite": 3
      }
    }
  }
}

The multiplier applies to every computed cost, including the overridden models. In this example it also reduces the Sonnet override by 15 percent, so the overridden rates are not the final figures. If your contract gives final rates, leave the multiplier out. The figures remain estimates even with contracted rates, so they are not a substitute for the invoice.

Read per-person spend on Team, Enterprise and API plans

On Team and Enterprise, the spend report in org analytics shows estimated spend per user and per model. It updates daily, exports as CSV, and appears once usage credits are on. On the Enterprise plan, the Enterprise Analytics API returns per-user usage and cost across Claude surfaces, including Claude Code. A Primary Owner creates a key with the read:analytics scope. Teams plans export the CSV instead.

For Console billing, use the workspace that Claude Code creates:

  1. Sign in to Claude Code with your Console account. The docs say a workspace named “Claude Code” is created automatically, and you cannot create API keys in it.
  2. Set a workspace spend limit on that workspace.
  3. Read the per-member figures in the Console dashboard, or pull the daily metrics from the Claude Code Analytics API with an Admin API key.

On an individual Pro or Max plan, the session cost figure is not relevant for billing. Track usage-credit spend on the account’s usage settings page instead.

Track Claude Code on cloud providers

Claude Code on Amazon Bedrock, Google Cloud and Microsoft Foundry is billed to your cloud account, and Anthropic’s analytics do not cover it. The docs say Claude Code does not send metrics from your cloud back to Anthropic. Your cloud’s billing console shows the total, but not the per-developer split.

For per-user attribution, use OpenTelemetry from each machine, or an LLM gateway that tracks spend per key. The docs name LiteLLM as one gateway that several enterprises use. It is unaffiliated with Anthropic and has not been audited for security, so review it before you depend on it. The docs also describe a self-hosted Claude apps gateway, which provides per-user attribution and per-user spend limits on these providers.

Track Copilot cost per developer

Copilot splits the work between two places. The impact dashboard shows the monthly Copilot cost per developer, based on the AI credits each person consumed. The usage metrics API returns per-user detail by IDE, feature, language and model. Its reports do not include seat data, and the docs do not say the API returns cost. Its dashboard shows 28-day trends across the enterprise and its organizations, and organization-level analytics became available on December 12, 2025.

  1. Turn on IDE telemetry for every developer. The docs say end users need telemetry enabled in their IDE for the richest data. Only listed IDEs count: Eclipse, JetBrains, Visual Studio, VS Code and Xcode. Each has a minimum IDE and Copilot Chat version. The docs’ example is VS Code 1.107.1 with Copilot Chat 0.35.3.
  2. Pull per-user usage from the REST usage metrics endpoints at enterprise, organization or user level. The docs say you can expect data to be available within two full days.
  3. Pull seats from the REST user management endpoints. The docs call those the source of truth for license and seat information.
  4. Read per-developer monthly cost in the impact dashboard. The docs do not say how to join cost to usage in an export, so this post does not include a join script.

Put a cap on the spend you track

Tracking shows spend after it happens. A cap stops it. On Team and Enterprise, Claude Code spend limits on usage credits can be set at the organization, group or individual member level. Console workspaces take a spend limit as well. The OpenTelemetry export only observes, so pair it with one of these controls.

For Copilot under usage-based billing, a budget works in three steps:

  1. Choose the scope: the whole enterprise, one organization, one repository or one cost center. For the bundled AI credits budget, the scope can also be a single user.
  2. Set alerts at 75, 90 and 100 percent of the budget. They go out by email and as a GitHub banner.
  3. Select “Stop usage when budget limit is reached” if the limit must hold. Without that option, usage continues and you get email notices only. User-level budgets always stop usage, and they are checked before cost center and enterprise budgets.

A checklist before you report the numbers

  • Map each developer to user.email or user.account_uuid before you read any dashboard, and never group by user.id.
  • Set contracted rates in managed settings, and confirm the /usage note that shows they are in effect.
  • Report seat allowance and usage-credit spend on separate lines.
  • Export Copilot per-user usage through the API, and read monthly Copilot cost in the impact dashboard.
  • Set a cap for each tool. For Copilot, select the stop option if the limit must hold.
  • Record the Claude Code version and the docs date with every figure you publish internally.

Enforcing this with AIControls

The steps above depend on each tool’s own reporting, which lives in several consoles and shows spend after it happens. AIControls sits in front of Claude Code as a gateway. It supports Claude Code through the gateway for both the CLI and VS Code. It issues per-user tokens and sets per-user and per-session cost and budget limits on that traffic. It also supports Copilot in VS Code.

To put Claude Code behind a gateway first, read how to route Claude Code through an AI gateway. For the policy side, read Claude Code managed settings for enterprises. For the business case behind these numbers, read Tokenomics: From Tokenmaxxing to Valuemaxxing. For the governance side of coding agents, see governance for AI coding agents, and download AIControls to run it in your own environment.

Frequently asked questions

Does the Claude Code cost in OpenTelemetry match the invoice?

Not by default. Claude Code computes the dollar figure locally from token counts at list price unless a modelPricing table is in effect. The costs page says the figures in /usage, the status line and OpenTelemetry therefore do not match the bill. If your organization pays contracted rates, an administrator can set modelPricing in managed settings, and the figures then change to match. For Console billing, the Usage page in the Claude Console is the authoritative record. The modelPricing setting needs Claude Code v2.1.242 or later.

Which attribute should I use to group Claude Code cost by developer?

Use user.email when you need a name you can match to your identity provider, and user.account_uuid when you need a stable account ID. Both come from sign-in. Do not use user.id. It is a random value created on first run and stored in each machine's ~/.claude.json, so one developer on two laptops appears as two users, and deleting the file creates a new value.

Does a Team or Enterprise spend report show everything a developer uses?

No. The docs say usage inside the seat allowance is not metered in dollars. The per-user spend report covers only usage-credit spend, it shows estimates updated daily, and it can be exported as CSV. Read it as the dollar cost of usage beyond the allowance, and track seat usage on its own line.

Can I see cost per developer for GitHub Copilot?

Yes, in the impact dashboard, which shows the monthly Copilot cost per developer based on the AI credits each person consumed. The usage metrics API returns per-user usage, and its reports do not include seat data. ROI estimates appear only in the dashboard and are not in the API or NDJSON exports, and the richest data needs IDE telemetry enabled.

Does tracking cost also stop overspend?

No. OpenTelemetry export and usage reports show spend after it happens. To stop overspend, set a limit. Team and Enterprise admins can set spend limits on usage credits, and Console admins can set workspace spend limits. For Copilot, a budget sends alerts at 75, 90 and 100 percent, and it stops usage only when you select the stop option.

Ritesh Patel, Founder & VP Product, Nirmata

Ritesh Patel is a founder of Nirmata and leads its products. He writes about governing AI coding agents, MCP security and Kubernetes policy as code.

LinkedIn

Govern AI agents with AIControlsControl what AI agents do, and prove it.
ShareXLinkedIn

Stay up-to-date with the latest in AI, governance, and infrastructure

Subscribe to our free monthly newsletter to get industry news, DevOps tips, and articles right to your inbox on Kyverno, containerization, Kubernetes deployment & management and more.