[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AEZBK5F9P9PBRACH84N5KZ":3,"skill-same:01M7AEZBK5F9P9PBRACH84N5KZ":71},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":5,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7AEZBK5F9P9PBRACH84N5KZ","anthropic-spend-report",null,"Generate a per-person, per-month Anthropic API spend report for a Claude Console organization, splitting Claude Code vs developer vs service usage and reconciling exactly to the Cost API total. Use when someone asks for Anthropic\u002FClaude API spend or cost by user, team, or API key, monthly usage cost, a cost\u002Fusage export, or \"how much are we spending on Claude\". Requires an organization Admin API key.","convictional\u002Fresearch","convictional","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F36997997?v=4","01M7AEXT3D9T75KWP7ZS4HMDAA","Convictional","01M7AEXT4MC29KKQEXD0PEGD72",4,"MIT","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: anthropic-spend-report\ndescription: Generate a per-person, per-month Anthropic API spend report for a Claude Console organization, splitting Claude Code vs developer vs service usage and reconciling exactly to the Cost API total. Use when someone asks for Anthropic\u002FClaude API spend or cost by user, team, or API key, monthly usage cost, a cost\u002Fusage export, or \"how much are we spending on Claude\". Requires an organization Admin API key.\n---\n\n# Anthropic spend report\n\nPulls org usage + cost from the Anthropic **Admin API** and produces a CSV of\n**spend per person per month**, split into `claude_code` \u002F `dev` \u002F `service`.\nDollars come from the Cost API and are allocated to API keys by token share, so\nthe per-key totals **reconcile exactly to the Cost API total** (no pricing table).\nMatching that total to your *actual invoice* — which can include priority\u002Fflex-tier\nspend the Cost API omits — is a one-time human check (Layer 3 below); don't\ndescribe a pull as \"reconciled to the bill\" until that anchor is done.\n\n## Prerequisite: an Admin API key\n\nThe script needs an **Admin API key** (`sk-ant-admin01-…`) — distinct from a\nnormal `sk-ant-api…` key. An org **admin** creates one at\n\u003Chttps:\u002F\u002Fplatform.claude.com\u002Fsettings\u002Fadmin-keys> (Console orgs have full Admin\nAPI access; no scope picker). Then, in the shell the agent will run in:\n\n```bash\nexport ANTHROPIC_ADMIN_KEY=sk-ant-admin01-...\n```\n\nIf the user hasn't set it, stop and walk them through the link above — do not\nproceed without it, and never echo the key value.\n\n**Where it runs:** the pull needs outbound network access *and* the admin key, so\nrun it from **Claude Code or a local\u002FCI shell** — not inside a claude.ai chat,\nwhose code sandbox has no internet egress (the API call would fail). On claude.ai,\nuse this skill only to analyze a CSV that was already exported elsewhere. Never\npaste an admin key into a web chat.\n\n## Quick start\n\n```bash\npython3 scripts\u002Fanthropic_spend.py                              # last 12 full months\npython3 scripts\u002Fanthropic_spend.py --start 2024-01 --end 2026-06 --out spend.csv\n```\n\nOutput CSV columns: `month, user, key_type, api_key_name, spend_usd,\nuncached_input_tokens, cache_read_input_tokens, cache_creation_input_tokens,\noutput_tokens`. A per-person summary table prints to stderr. Pivot the CSV by\n`user`, `key_type`, or `month` as the user asks. (`api_key_id` is used internally\nfor the allocation but intentionally not written out.)\n\n## Verify it's working\n\nThree layers. **Never silently skip Layer 2 or Layer 3.** Run them by default; if\nthere's a real reason to skip (rate limit, already-anchored invoice), say so and let\nthe user decide — don't just omit them and imply the numbers are confirmed.\n\n1. **Offline tests — always, free, instant (no API\u002Fkey).** Cover the cost→key\n   allocation (reconciliation + remainder-to-largest + non-negativity + deterministic\n   tie-break), month windows, month-arg validation, and token parsing. Run before\n   trusting a pull and after any edit (from the skill root):\n\n       cd experiments\u002Fanthropic-spend-report && python3 -m unittest discover -s tests\n\n2. **Live self-test — run it on every real pull (2 API calls).** Pulls one month\n   and asserts the endpoints still return the expected fields, the pull reconciles to\n   the Cost API total, unattributed cost is negligible (\u003C $1.00), and implied unit\n   prices are sane (catches a silent cents↔dollars change). No stored numbers:\n\n       python3 scripts\u002Fanthropic_spend.py --self-test 2026-05\n\n   Run it **first**, before a large pull (both share the ~1-req\u002Fmin limit — self-test\n   then big pull, not two big pulls back-to-back). Skipping it is a decision for the\n   user to make, not a silent default.\n\n3. **Invoice reconciliation — the only proof the dollars are actually right\n   (one-time per org, human-in-the-loop).** Layers 1–2 and a run's own\n   \"unattributed $0.00\" line prove *internal* consistency with the Cost API — **not**\n   that the Cost API matches your real invoice (it omits priority\u002Fflex-tier spend).\n   **Do not assume this was ever done.** Unless the user has confirmed it's anchored\n   for this org *in this conversation*, surface it and offer to walk them through\n   REFERENCE.md → \"Confirming the numbers are right.\" Never call a pull \"reconciled\n   to your bill\" until this is done — say \"reconciles to the Cost API total\" instead.\n\n## Workflow\n\n> This lives in a protected repo — **never push to `main`**. Any code change (a\n> fix, or a roster edit) goes through a **branch + PR**.\n\n1. Run the offline tests (`cd experiments\u002Fanthropic-spend-report && python3 -m unittest\n   discover -s tests`) — instant, no API. **If any fail, do not quietly fix them:** report the failure and ask the\n   user how they want to proceed. An ops user will usually open an issue in the\n   project's tracker; a maintainer may fix it on a branch + PR.\n2. Confirm `ANTHROPIC_ADMIN_KEY` is set (see above).\n3. **Run the live self-test** (`--self-test \u003Crecent-full-month>`, 2 API calls) before\n   the real pull — Layer 2 above. **Do not skip it silently.** If you're skipping it\n   (e.g. to protect the rate limit ahead of a huge pull), tell the user and get their\n   OK first.\n4. Pick the date range (default: last 12 full months). Stay ≤ a couple of years\n   per run; the Admin API is rate-limited (~1 req\u002Fmin sustained), so **don't re-run\n   back-to-back** — the script throttles and retries, but repeated full passes 429.\n5. Run the script. The CSV lands in the git-ignored `output\u002F` folder next to the\n   skill by default (override with `--out`).\n6. Read back the stderr summary + CSV and answer the user's actual question\n   (totals by person, Claude Code vs dev, month-over-month, top keys, etc.). When you\n   report figures, say the pull **reconciles to the Cost API total** — **not**\n   \"reconciled to your bill\" unless Layer 3 has been done for this org. If it hasn't,\n   say so plainly and **offer to run the one-time invoice reconciliation** (Layer 3 \u002F\n   REFERENCE.md → \"Confirming the numbers are right\"); never present the numbers as\n   invoice-confirmed when they're only Cost-API-consistent.\n7. Check the **\"⚠ could not be categorized\"** list the run prints. For each flagged\n   key that's clearly a person or known project, propose the fragment to add to\n   `PEOPLE` \u002F `BUCKET` in the ORG CONFIG — then **confirm with the user and make the\n   edit on a branch + PR** (a roster add is low-risk, but `main` is still protected).\n\n## Org configuration\n\n`scripts\u002Fanthropic_spend.py` has an **ORG CONFIG** block near the top:\n`PEOPLE` (person → key-name fragments), `BUCKET` (non-person key → category),\nand `KEY_NAME_PREFIX_CLAUDE_CODE`. Edit these for your org \u002F as people and keys\nchange. The mapping is heuristic from key names — review the summary before\ntrusting per-person totals.\n\n## How it works & caveats\n\nMethodology (cost-allocation join), known limitations (priority\u002Fflex tiers and\nWorkbench\u002Fno-key usage), and extension notes are in [REFERENCE.md](REFERENCE.md).\n","# Anthropic spend report\n\nPulls org usage + cost from the Anthropic **Admin API** and produces a CSV of\n**spend per person per month**, split into `claude_code` \u002F `dev` \u002F `service`.\nDollars come from the Cost API and are allocated to API keys by token share, so\nthe per-key totals **reconcile exactly to the Cost API total** (no pricing table).\nMatching that total to your *actual invoice* — which can include priority\u002Fflex-tier\nspend the Cost API omits — is a one-time human check (Layer 3 below); don't\ndescribe a pull as \"reconciled to the bill\" until that anchor is done.\n\n## Prerequisite: an Admin API key\n\nThe script needs an **Admin API key** (`sk-ant-admin01-…`) — distinct from a\nnormal `sk-ant-api…` key. An org **admin** creates one at\n\u003Chttps:\u002F\u002Fplatform.claude.com\u002Fsettings\u002Fadmin-keys> (Console orgs have full Admin\nAPI access; no scope picker). Then, in the shell the agent will run in:\n\n```bash\nexport ANTHROPIC_ADMIN_KEY=sk-ant-admin01-...\n```\n\nIf the user hasn't set it, stop and walk them through the link above — do not\nproceed without it, and never echo the key value.\n\n**Where it runs:** the pull needs outbound network access *and* the admin key, so\nrun it from **Claude Code or a local\u002FCI shell** — not inside a claude.ai chat,\nwhose code sandbox has no internet egress (the API call would fail). On claude.ai,\nuse this skill only to analyze a CSV that was already exported elsewhere. Never\npaste an admin key into a web chat.\n\n## Quick start\n\n```bash\npython3 scripts\u002Fanthropic_spend.py                              # last 12 full months\npython3 scripts\u002Fanthropic_spend.py --start 2024-01 --end 2026-06 --out spend.csv\n```\n\nOutput CSV columns: `month, user, key_type, api_key_name, spend_usd,\nuncached_input_tokens, cache_read_input_tokens, cache_creation_input_tokens,\noutput_tokens`. A per-person summary table prints to stderr. Pivot the CSV by\n`user`, `key_type`, or `month` as the user asks. (`api_key_id` is used internally\nfor the allocation but intentionally not written out.)\n\n## Verify it's working\n\nThree layers. **Never silently skip Layer 2 or Layer 3.** Run them by default; if\nthere's a real reason to skip (rate limit, already-anchored invoice), say so and let\nthe user decide — don't just omit them and imply the numbers are confirmed.\n\n1. **Offline tests — always, free, instant (no API\u002Fkey).** Cover the cost→key\n   allocation (reconciliation + remainder-to-largest + non-negativity + deterministic\n   tie-break), month windows, month-arg validation, and token parsing. Run before\n   trusting a pull and after any edit (from the skill root):\n\n       cd experiments\u002Fanthropic-spend-report && python3 -m unittest discover -s tests\n\n2. **Live self-test — run it on every real pull (2 API calls).** Pulls one month\n   and asserts the endpoints still return the expected fields, the pull reconciles to\n   the Cost API total, unattributed cost is negligible (\u003C $1.00), and implied unit\n   prices are sane (catches a silent cents↔dollars change). No stored numbers:\n\n       python3 scripts\u002Fanthropic_spend.py --self-test 2026-05\n\n   Run it **first**, before a large pull (both share the ~1-req\u002Fmin limit — self-test\n   then big pull, not two big pulls back-to-back). Skipping it is a decision for the\n   user to make, not a silent default.\n\n3. **Invoice reconciliation — the only proof the dollars are actually right\n   (one-time per org, human-in-the-loop).** Layers 1–2 and a run's own\n   \"unattributed $0.00\" line prove *internal* consistency with the Cost API — **not**\n   that the Cost API matches your real invoice (it omits priority\u002Fflex-tier spend).\n   **Do not assume this was ever done.** Unless the user has confirmed it's anchored\n   for this org *in this conversation*, surface it and offer to walk them through\n   REFERENCE.md → \"Confirming the numbers are right.\" Never call a pull \"reconciled\n   to your bill\" until this is done — say \"reconciles to the Cost API total\" instead.\n\n## Workflow\n\n> This lives in a protected repo — **never push to `main`**. Any code change (a\n> fix, or a roster edit) goes through a **branch + PR**.\n\n1. Run the offline tests (`cd experiments\u002Fanthropic-spend-report && python3 -m unittest\n   discover -s tests`) — instant, no API. **If any fail, do not quietly fix them:** report the failure and ask the\n   user how they want to proceed. An ops user will usually open an issue in the\n   project's tracker; a maintainer may fix it on a branch + PR.\n2. Confirm `ANTHROPIC_ADMIN_KEY` is set (see above).\n3. **Run the live self-test** (`--self-test \u003Crecent-full-month>`, 2 API calls) before\n   the real pull — Layer 2 above. **Do not skip it silently.** If you're skipping it\n   (e.g. to protect the rate limit ahead of a huge pull), tell the user and get their\n   OK first.\n4. Pick the date range (default: last 12 full months). Stay ≤ a couple of years\n   per run; the Admin API is rate-limited (~1 req\u002Fmin sustained), so **don't re-run\n   back-to-back** — the script throttles and retries, but repeated full passes 429.\n5. Run the script. The CSV lands in the git-ignored `output\u002F` folder next to the\n   skill by default (override with `--out`).\n6. Read back the stderr summary + CSV and answer the user's actual question\n   (totals by person, Claude Code vs dev, month-over-month, top keys, etc.). When you\n   report figures, say the pull **reconciles to the Cost API total** — **not**\n   \"reconciled to your bill\" unless Layer 3 has been done for this org. If it hasn't,\n   say so plainly and **offer to run the one-time invoice reconciliation** (Layer 3 \u002F\n   REFERENCE.md → \"Confirming the numbers are right\"); never present the numbers as\n   invoice-confirmed when they're only Cost-API-consistent.\n7. Check the **\"⚠ could not be categorized\"** list the run prints. For each flagged\n   key that's clearly a person or known project, propose the fragment to add to\n   `PEOPLE` \u002F `BUCKET` in the ORG CONFIG — then **confirm with the user and make the\n   edit on a branch + PR** (a roster add is low-risk, but `main` is still protected).\n\n## Org configuration\n\n`scripts\u002Fanthropic_spend.py` has an **ORG CONFIG** block near the top:\n`PEOPLE` (person → key-name fragments), `BUCKET` (non-person key → category),\nand `KEY_NAME_PREFIX_CLAUDE_CODE`. Edit these for your org \u002F as people and keys\nchange. The mapping is heuristic from key names — review the summary before\ntrusting per-person totals.\n\n## How it works & caveats\n\nMethodology (cost-allocation join), known limitations (priority\u002Fflex tiers and\nWorkbench\u002Fno-key usage), and extension notes are in [REFERENCE.md](REFERENCE.md).\n",{"name":5,"description":7},"main","9126050d84c5fb8a3d57209074a5ef723c6bb2fc",0,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch","https:\u002F\u002Fgithub.com\u002Fconvictional","https:\u002F\u002Fconvictional.com","2026-11-14 04:55:01",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add convictional\u002Fresearch --skill anthropic-spend-report",{"tool":37,"command":38},"bunx","bunx skills add convictional\u002Fresearch --skill anthropic-spend-report",{"tool":40,"command":41},"pnpm","pnpm dlx skills add convictional\u002Fresearch --skill anthropic-spend-report","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002FSKILL.md",true,[45,51,57,61,67],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},".gitignore","OTHER","其他",110,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002F.gitignore",{"path":52,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":55,"sourceHtmlUrl":56},"README.md","REFERENCE","参考文档",4298,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002FREADME.md",{"path":58,"resourceType":53,"resourceTypeDesc":54,"sizeBytes":59,"sourceHtmlUrl":60},"REFERENCE.md",6425,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002FREFERENCE.md",{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"scripts\u002Fanthropic_spend.py","SCRIPT","脚本",23756,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002Fscripts\u002Fanthropic_spend.py",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"tests\u002Ftest_offline.py",6288,"https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Fanthropic-spend-report\u002Ftests\u002Ftest_offline.py",[72,79,86,93,100,107],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7AEZ9XHPY0E68QJ8SRJB3JE","submit-actions","Submit your actions for the current turn. Write actions.json first.","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fsubmit-actions\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7AEZ889P4R05V6BJ5AQWZ0Y","posts","Create, read, comment on, and decide on durable Posts (topic-scoped threads)","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fposts\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7AEZ6W8RTRWR7SJTM8KRPM6","observe","Get your function's view of the current game state","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fobserve\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7AEZ3YFV8R8BFFPQJXWA2M9","goals","View the shared goal tree, comment on goals, and create your own goals or sub-goals","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fgoals\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7AEZ24WEFB4A9X31DJ9PJXY","goal-update","Comment on any goal, or report status and progress on a goal you created","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fgoal-update\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7AEYZK12TK93DSR4QYPYN7J","game-status","Check game progress — turn, MRR, runway, game over state","https:\u002F\u002Fgithub.com\u002Fconvictional\u002Fresearch\u002Fblob\u002Fmain\u002Falignsim\u002Fplayer_condition4b\u002F.claude\u002Fskills\u002Fgame-status\u002FSKILL.md",[],[]]