Skip to content

Claude Code

Claude Code usage is tracked via the Anthropic Admin API.

Getting the API Key

  1. Go to Anthropic ConsoleSettings → Admin API keys

  2. Click Create Key (requires org admin access)

  3. Copy the key (starts with sk-admin-)

  4. Set the environment variable:

    Terminal window
    ANTHROPIC_ADMIN_KEY=sk-admin-...

Sync Behavior

SettingValue
ScheduleDaily at 6 AM UTC
DataToken counts, model, cost, API key ID
User MappingAPI keys are mapped to emails via the Anthropic API

Manual Sync

Sync recent data:

Terminal window
pnpm cli sync anthropic --days 7

Backfill historical data:

Terminal window
pnpm cli backfill anthropic --from 2025-01-01 --to 2025-06-01

Check sync status:

Terminal window
pnpm cli anthropic:status

User 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:

Terminal window
# List current mappings
pnpm cli mappings
# Sync from Anthropic API
pnpm cli mappings:sync
# Interactive assignment of unmapped keys
pnpm cli mappings:fix

See API Key Mappings for more details.