Skip to content

API key

An api-key profile stores an Anthropic API key (sk-ant-…). Claude Code reads it via the apiKeyHelper mechanism on global switch, or ANTHROPIC_API_KEY env var for per-shell.

  • You have an API key from console.anthropic.com
  • You want different keys for different projects or billing contexts
Terminal window
ccswitch add
# choose "API key", paste your key

Or snapshot from current settings:

Terminal window
ccswitch save work --type api-key

On global switch, ccswitch probes the Anthropic API to verify the key is valid. If it returns 401, you’ll see an error. Skip with --no-check.

  • API key → OS keychain
  • On global switch: settings.json gets an apiKeyHelper command that reads the key from the keychain at runtime

This site uses GoatCounterfor page counts — no cookies, no personal data, no tracking across sites.