[FEATURE] Bedrock: add per-user cost tracking metadata to usage JSONL

Resolved 💬 3 comments Opened Mar 8, 2026 by chikosan Closed Apr 6, 2026

Problem

When Claude Code is used with AWS Bedrock in a team setting (multiple developers sharing an AWS account), there is currently no way to break down costs per user.

AWS Cost Explorer supports grouping by Account, Service, Region, Usage Type, and Tags — but not by IAM user. Since Claude Code does not attach any user-identifying metadata to Bedrock API calls, Cost Explorer returns a single aggregate number for the entire team with no breakdown.

What we tried

  • GROUP_BY = LINKED_ACCOUNT — only works across accounts, not users within one account
  • GROUP_BY = TAG — requires every Bedrock invocation to carry a cost allocation tag like user=alice; Claude Code doesn't add these
  • AWS Cost Explorer has no GROUP_BY = IAM_USER dimension for Bedrock

AWS Bedrock does not support per-request tagging on InvokeModel calls — tags are resource-level only. So this limitation cannot be solved purely on the AWS side.

Proposed Solution

Add user-identifying metadata to the local usage JSONL files that Claude Code already writes to ~/.claude/projects/**/*.jsonl.

Minimal ask: include the OS username (or a configurable identifier) in each JSONL entry, for example:

{
  "type": "assistant",
  "usage": { "input_tokens": 1234, "output_tokens": 456 },
  "costUSD": 0.012,
  "user": "alice",          // <-- new
  "awsAccount": "123456789012",  // <-- new (when using Bedrock)
  "provider": "bedrock"     // <-- new
}

This would allow teams (and third-party tools) to aggregate costs per user from local logs without any network calls or AWS API changes.

Alternative / Complementary Approach

A claude usage CLI subcommand that outputs a cost summary per user/session, similar to what claude cost does today but scoped to Bedrock and filterable by date range or user.

Who Is Affected

Teams using Claude Code on AWS Bedrock with a shared AWS account — common in corporate/enterprise environments where:

  • Each developer authenticates via SSO/IAM Identity Center as their own IAM user
  • All Bedrock API calls flow through a single AWS account
  • Finance/FinOps teams need per-user or per-team cost chargebacks

Current Workaround

Third-party tools read the existing JSONL files to compute Claude Code costs, but can only produce a single-machine total — not a per-user view across a team.

References

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗