Skip to main content
All posts

How to Track OpenAI, Anthropic, and Bedrock Costs by Team

The billing unit to give each team at every provider, the API calls that return cost per team, Bedrock's cost per IAM user, and one view across all of them.

Bruno RochaFounder
Ler em portuguêsComo acompanhar o custo de OpenAI, Anthropic e Bedrock por time

Give each team its own billing unit at every provider: an OpenAI project, an Anthropic workspace, and an AWS IAM role or application inference profile for Amazon Bedrock. Each provider then reports cost per unit, OpenAI and Anthropic through their cost APIs and AWS through the Cost and Usage Report. Set a spend limit on each unit, and map all of them to one list of team names so finance reads one number per team, the practice our glossary calls AI cost allocation.

Below: the setup for each provider, the API calls that return cost per team, how Bedrock now attributes cost to each IAM user or role, and how to bring the three into one view. Every step links to the provider's own docs.

What does each provider let you split by?

OpenAI
Give each team
A project, with its own API keys
Where cost per team shows
Costs API, daily, grouped by project, user, API key, or line item
Spend limit
A monthly hard limit per project
Anthropic
Give each team
A workspace, with API keys scoped to it
Where cost per team shows
Cost API, daily, grouped by workspace
Spend limit
A monthly limit per workspace
Amazon Bedrock
Give each team
An IAM role or user, or an application inference profile with tags
Where cost per team shows
Cost and Usage Report 2.0, by IAM principal or by cost allocation tag
Spend limit
AWS Budgets
Google Agent Platform (Vertex AI)
Give each team
Labels on each request
Where cost per team shows
Billing data by label
Spend limit
Not covered here

From each provider's own docs, checked October 24, 2026.

How do you split OpenAI costs by team?

  • Create one project per team and issue each service its own API key inside that project. Projects can also allow or block specific models. OpenAI admin APIs.
  • Set a monthly hard spend limit on each project. When a project hits it, requests fail with a 429 project_spend_limit_exceeded error; alerts only notify. OpenAI spend limits.
  • Read cost per team with an admin key from the Costs API, GET /v1/organization/costs, in daily buckets grouped by project_id, user_id, api_key_id, or line_item. Some combinations of user_id and project_id return a 400 error.
  • Read tokens per model from the Usage API, GET /v1/organization/usage/completions and its siblings, in 1-minute, 1-hour, or 1-day buckets grouped by project, user, API key, model, batch, or service tier. Usage and Costs API reference.
Terminal
curl "https://api.openai.com/v1/organization/costs?start_time=1790812800&bucket_width=1d&group_by=project_id" \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY"

How do you split Anthropic costs by team?

  • Create one workspace per team and scope each team's API keys to it. Each workspace takes its own monthly spend limit, alerts, and rate limits. Keys that aren't scoped send an anthropic-workspace-id header with each request instead. You can't set spend limits on the Default Workspace, and its usage reports an empty workspace ID, so move keys out of it. Claude workspaces.
  • Read cost per team from the Cost API, /v1/organizations/cost_report, in daily buckets grouped by workspace or by description. It leaves out Priority Tier usage and shows data within about five minutes. Usage and Cost API.
  • Read tokens from the Usage API, /v1/organizations/usage_report/messages, in 1-minute, 1-hour, or 1-day buckets grouped by API key, workspace, model, service tier, or context window.
  • For Claude Code, the Claude Code workspace is the only one that supports per-user monthly spend limits. On usage-based Claude Enterprise, the Enterprise Analytics API returns cost per user, from January 1, 2026, about 4 to 24 hours behind. Enterprise Analytics API.
Terminal
curl "https://api.anthropic.com/v1/organizations/cost_report?starting_at=2026-10-01T00:00:00Z&group_by[]=workspace_id" \
  -H "x-api-key: $ANTHROPIC_ADMIN_KEY" \
  -H "anthropic-version: 2023-06-01"

How do you split Amazon Bedrock costs by team or by person?

AWS documents four ways to attribute Bedrock cost: IAM principal attribution, application inference profiles, projects and workspaces, and request metadata, which lands in the invocation logs rather than the bill. In the bill, each goes down to usage type per day. Bedrock cost management.

  • IAM principal attribution, launched April 9, 2026. Create a new Cost and Usage Report 2.0 export with the caller identity option, and each Bedrock line carries the IAM user or role that made the call in line_item_iam_principal, a column AWS fills for Bedrock only. Tags on principals and sessions appear as iamPrincipal/ tags once activated in the payer account. It isn't retroactive and takes up to 24 hours to appear. IAM principal cost tracking · AWS announcement.
  • Behind a shared gateway, every call comes from the gateway's role. Give each user's session its own RoleSessionName and session tags, so the report still shows who asked.
  • Application inference profiles: create a profile per team and per model, tag it, and call the profile instead of the model. The tags flow to your cost allocation reports.
  • Model invocation logging, off by default, writes each request to CloudWatch Logs or S3 in the same account and Region, with the caller's identity ARN, your request metadata, the model ID, and token counts. Use it to see what a request did; the bill still comes from the CUR. Invocation logging.

What about Google's Agent Platform and the Gemini API?

On Gemini Enterprise Agent Platform, Google's name for Vertex AI since April 22, 2026, add labels to each call: up to 64 per request for Google's models and 32 for partner models such as Claude. Labels on partner models reach your billing data only on pay-as-you-go, and a label key with more than 1,000 values may be dropped. Agent Platform request labels. The Gemini Developer API bills per project, not per key, and its project spend caps are experimental, so give each team its own Google Cloud project there. Gemini API billing.

How do you bring all of it into one view per team?

Each provider reports in its own shape. AWS, Google Cloud, and Microsoft publish their billing data in the FOCUS 1.2 format; OpenAI's and Anthropic's docs describe no FOCUS export, so their cost API output needs mapping to the same columns. FOCUS data generators.

  • Keep one list of team names, and map each OpenAI project, Anthropic workspace, AWS role or tag, and Google label to a name on it.
  • Pull every provider daily into one table, in one currency, with the same columns: date, provider, team, model, and cost.
  • Report the spend no rule maps as its own line, with an owner, so it shrinks over time instead of hiding inside the other teams.
  • Use the same team names for showback first, then chargeback once the teams agree with the numbers.
  • Or let a tool do the mapping and the daily pull. We compare ten in The Best FinOps Tools for AI in 2026.

Common mistakes when tracking AI costs by team

  • One shared API key for the whole company, which makes per-team cost impossible to recover later.
  • Keys left in Anthropic's Default Workspace, where you can't set a spend limit and usage shows no workspace.
  • Turning on Bedrock's IAM principal attribution and expecting last month's data. It starts from the day you enable it, in a new CUR 2.0 export.
  • Alerts without limits. OpenAI's alerts only notify; a project's hard limit is what stops spend.
  • Splitting by provider and stopping there, when a team's AI spend spans OpenAI, Anthropic, and the cloud bill.

LevelFour reads OpenAI, Anthropic, and your AWS, Google Cloud, and Azure bills in one place. Virtual tags map them to your teams without retagging: one rule can give team=Payments an AWS account, an OpenAI project, and an Anthropic workspace. See what LevelFour can save you in 5 minutes, with read-only access.

Frequently asked questions

How do I see OpenAI API cost per project?

Call the Costs API, GET /v1/organization/costs, with an admin key and group_by=project_id. It returns cost in daily buckets. For tokens per model, use the Usage API in 1-minute, 1-hour, or 1-day buckets. OpenAI Usage and Costs API.

How do I track Anthropic API cost by team?

Give each team a workspace, scope its API keys to it, and call the Cost API, /v1/organizations/cost_report, grouped by workspace. Usage in the Default Workspace reports no workspace, so move keys out of it.

Can I see Amazon Bedrock cost per user?

Yes, since April 9, 2026. Create a Cost and Usage Report 2.0 export with the caller identity option, and each Bedrock line carries the IAM user or role in line_item_iam_principal. It isn't retroactive. Behind a gateway, give each user's session its own role session name and session tags.

Do OpenAI and Anthropic support FOCUS?

Not as of October 2026. The FOCUS project lists AWS, Google Cloud, and Microsoft as publishing FOCUS 1.2 data, and neither OpenAI's nor Anthropic's docs describe a FOCUS export. What is FOCUS?.

How do I set a spend limit per team on AI APIs?

On OpenAI, set a monthly hard limit on each team's project; requests fail with a 429 error once it's reached. On Anthropic, set a monthly spend limit on each team's workspace. On AWS, set a budget on the team's tag or account.

What's the difference between OpenAI's Usage API and Costs API?

The Usage API returns tokens and requests, in 1-minute, 1-hour, or 1-day buckets, grouped by project, user, key, model, and more. The Costs API returns dollars in daily buckets, grouped by project, user, key, or line item. Use the Costs API for the bill and the Usage API to explain it.

More posts

See what LevelFour can save you