DEV Community

Cover image for Anthropic just killed API keys. Here’s what Claude Platform OAuth actually does
Daniel (San) Ávila
Daniel (San) Ávila

Posted on Originally published at Medium

Anthropic just killed API keys. Here’s what Claude Platform OAuth actually does

If you’ve ever built something that calls Claude for other people, you know the awkward part. Somebody has to pay for the tokens.

Either your user pastes their API key into your app, which nobody should be doing, or you pay for their usage and work out the billing later.

On November 17 Anthropic shipped the fix. It’s called Claude Platform OAuth, and the billing piece is called Linked billing. I posted about it and it took off, so here’s the full version: what it does, how to set it up, and where it doesn’t work yet.

What Linked billing actually does

Your user clicks a button in your app that says “Link your Claude organization.” They get sent to Claude’s approval page, sign in, pick which organization to link, set a monthly spend limit, and approve. Then they come back.

After that, every call your app makes to Claude for them can be billed to their organization instead of yours. You choose per request: add billing_policy to the body with bill_to set to user_profile and your customer pays, or leave it out and you pay.

One thing to be clear about: your app still authenticates itself. It just stops using a static key. Your back end proves who it is with a short-lived token from your own identity provider (AWS, Google Cloud, Kubernetes) through Workload Identity Federation, and Anthropic hands back an access token. There is no client secret anywhere. The key that disappears is your customer’s.

How to set it up

Three one-time steps, all of them needing the Admin role in your Claude organization:

  1. Create the OAuth app in the Console, on the OAuth apps page. Give it a name and a redirect URI, select “Bill and link to organizations,” and copy the client ID. It’s public, so you can ship it in your front end.
  2. Set up client authentication. On the app’s Client authentication tab, pick your identity provider and which of its tokens Anthropic should accept.
  3. Create a service account, add a Workload Identity Federation rule for it, and select it as the app’s operator service account. That is the identity your back end bills customers with.

Then, for each customer, you run the round trip in the diagram: request an approval page, send the user there, catch the one-time code on your redirect URI, and exchange it for a connection you store.

Calling Claude for that customer looks like this:

curl https://api.anthropic.com/v1/messages \
  -H "anthropic-beta: user-profiles-billing-2026-10-01" \
  -H "anthropic-user-profile-id: uprof_01HV9Z" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-5-5","max_tokens":1024,"messages":[{"role":"user","content":"Hello, Claude"}],"billing_policy":{"type":"billing_policy","bill_to":"user_profile"}}'
Enter fullscreen mode Exit fullscreen mode

Be careful with that profile ID header. By default your operator credential can bill any customer linked through your app, so if the header names the wrong profile, Anthropic bills that organization and no error tells you. If you want a hard boundary, use a per connection access token, which can only ever bill its own customer.

What your customer sees

They pick a monthly spend cap for your app in whole dollars, right on the approval page. Afterwards they manage it on the Linked platforms page in the Console, where they can also see what your app has cost them this month and unlink you with one click.

When they hit the cap, the requests you bill to them come back with a 402 until the first of the next month, or until they raise it. When they unlink, you get a 403 user_profile_not_billable.

Anthropic doesn’t tell you when someone unlinks. No webhook, no email. You find out from the error.

Is it worth it?

For anything that runs agents on behalf of other people, yes. I’m already wiring it into aitmpl.com, so you will be able to browse the catalog, hit run on an agent, and have it execute against your own Claude organization with nothing to copy and paste.

Know the limits before you build on it, though. It’s in beta, and Anthropic says plainly it might not be suitable for production yet. It only works for customers whose organization pays Anthropic directly, so anyone billed through AWS, Google Cloud or Azure Marketplace is out, and so is anyone on a subscription plan alone. Message Batches can’t bill the customer either.

And this one matters more than the rest: the requests run in your organization, so your rate limits and your data retention terms apply, not your customer’s. If they need zero data retention, a BAA, or their own encryption keys, don’t route that work through this.

The setup isn’t a weekend afternoon either. Workload Identity Federation instead of a client secret is the right call, but it’s real infrastructure work before you link your first customer.

If you’re building a platform that calls Claude for other people, go read the Linked billing guide and start with a test app. Everything about how you charge for your product gets simpler once the token bill isn’t yours.

Links

You can follow me on my social media:

Top comments (0)