platform-oauth-linked-billing
БесплатноЗапускает вложенные скриптыНе проверенUse when adding Claude Platform OAuth (linked billing) to an app, so that customers link their own Claude Console organization and the Claude calls they start…
от davila7★ 34 631 звезда на GitHubОб этом скилле
Claude Platform OAuth (linked billing)
Set up Claude Platform OAuth in the project you are running in, end to end: Console, signing key, backend routes, token storage and a verified billed call. Work in three phases and do not skip ahead: inspect, plan, execute.
<skill-dir> below is the folder that holds this file (usually .claude/skills/platform-oauth-linked-billing). The scripts need only Node 18+ on the machine running them, whatever language the backend is written in.
The feature is in beta. Tested with anthropic-version: 2026-10-21 and the beta header user-profiles-billing-2026-10-01. If the user has newer docs, they win: https://platform.claude.com/docs/en/manage-claude/oauth-apps/overview
What it is (tell the user if they are unsure)
- A customer links a Claude Console organization that pays Anthropic for API usage (prepaid credits or invoice) to the user's app once, and sets a monthly spend limit. From then on, the Claude calls they start in the app are billed to their organization.
- It is not "Sign in with Claude.ai". Pro/Max subscriptions cannot be linked (
403 user_profile_not_billable), and using Claude.ai subscription logins in third-party apps is not allowed. Organizations that buy through a cloud marketplace cannot link either. The person linking needs the Admin or Billing role. - There is no client secret. The backend signs short ES256 JWTs with its own key, registered in Console as an issuer with inline keys.
- The same key signs two assertions: the client one (
aud https://auth.claude.com, for PAR and the code exchange) and the operator one (aud https://api.anthropic.com, exchanged for an operator service-account token that creates user profiles and makes the billed calls).
If the user wants something this does not cover (end users paying with a Claude.ai plan, batches, billable code execution), say so before doing any work.
Phase 1: Inspect the project
Read, do not change anything. Find and note:
| Question | Where to look |
|---|---|
| Language and framework of the server code | package.json, pyproject.toml, requirements.txt, go.mod, Gemfile, composer.json, Cargo.toml |
| Where server code runs | wrangler.toml (Cloudflare Workers), vercel.json, netlify.toml, Dockerfile, fly.toml, serverless.yml, app.yaml |
| Is there a server at all | A static site or a mobile/desktop app with no backend cannot hold the key: the plan must add one (an edge function or small service) |
| Existing users and sessions | Auth libraries (Clerk, Auth.js/NextAuth, Supabase Auth, Lucia, Devise, Django auth, Passport) and the user table or id |
| Database for per-user state | ORM schema, migrations folder, DATABASE_URL-style env names |
| Secret store | .env.example, .dev.vars, wrangler secret, Vercel/Netlify env, Doppler, AWS/GCP secret managers. Read names only |
| Existing Anthropic usage | @anthropic-ai/sdk, anthropic (Python), raw calls to api.anthropic.com, current API key handling |
| Public URL and local dev URL | Deploy config, README, dev server port. The callback URL is built from these |
Rules while inspecting:
- Never open files that hold secrets:
.env,.env.*(except.env.example),.dev.vars,*.pem,*.key, credentials JSON,~/.aws,~/.config/gcloud. Variable names from.env.exampleor code are enough. - If the repository is public (check the remote or ask), all signing material, refresh tokens and billing code must stay out of it. Propose a private service or the platform's secret store.
Phase 2: Write the plan
Write CLAUDE_PLATFORM_OAUTH_PLAN.md at the project root (ask before committing it) with:
- Summary of what was found in Phase 1: stack, runtime, user model, database, secret store, public and local URLs.
- Console checklist (the user does these; see references/console-setup.md). Fill in the real values you can already know: app name, redirect URIs, subjects (
<app>:backend:client,<app>:backend:operator), audiences. - Secrets the backend will need, with the exact names you will use and where each one is stored: signing private key (PEM), key id (
kid), issuer URL, client subject, operator subject, client ID, organization ID, operator service account ID, operator federation rule ID, and a key to encrypt refresh tokens at rest. - Data model: a per-user record with
user_profile_id,connection_id, encrypted refresh token and its expiry, link status; a short-lived table or cache for pending link attempts (state, PKCE verifier, browser binding hash, user id, expiry 10 to 15 minutes). - Backend work, as files to create or change for this stack (see references/backend.md): signer, operator token cache, user profile creation,
link/start,link/callback, unlink/status, and the billed call wrapper. - Verification steps (see the end of this file).
- **Open questi
Установить platform-oauth-linked-billing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл platform-oauth-linked-billing?
Use when adding Claude Platform OAuth (linked billing) to an app, so that customers link their own Claude Console organization and the Claude calls they start are billed to them. Invoke it before writing any code for "connect your Claude org", "bill Claude usage to the customer", user profiles, auth.claude.com, PAR/PKCE with Anthropic, workload identity federation or billing_policy.
Как установить скилл platform-oauth-linked-billing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл platform-oauth-linked-billing запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic