Claude Code
Claude Code usage is tracked via the Anthropic Admin API.
Getting the API Key
-
Go to Anthropic Console → Settings → Admin API keys
-
Click Create Key (requires org admin access)
-
Copy the key (starts with
sk-admin-) -
Set the environment variable:
Terminal window ANTHROPIC_ADMIN_KEY=sk-admin-...
Sync Behavior
| Setting | Value |
|---|---|
| Schedule | Daily at 6 AM UTC |
| Data | Token counts, model, cost, API key ID |
| User Mapping | API keys are mapped to emails via the Anthropic API |
Manual Sync
Sync recent data:
pnpm cli sync anthropic --days 7Backfill historical data:
pnpm cli backfill anthropic --from 2025-01-01 --to 2025-06-01Check sync status:
pnpm cli anthropic:statusUser Mapping
The Anthropic Admin API provides API key IDs but not always user emails. Abacus automatically syncs mappings from the API, but some keys may need manual assignment.
To view and manage mappings:
# List current mappingspnpm cli mappings
# Sync from Anthropic APIpnpm cli mappings:sync
# Interactive assignment of unmapped keyspnpm cli mappings:fixSee API Key Mappings for more details.