API key
If you’d rather pay per-use on the Anthropic API instead of subscribing to claude.ai, CLACOROO can configure Claude Code to authenticate with an API key. The key is stored in your system’s secure storage (Keychain on macOS, DPAPI on Windows, an encrypted file on Linux when available) and never leaves your machine in clear text.
This is independent from a claude.ai login — you can have both configured and pick which one Claude Code uses.
Important: the API key takes over immediately. As soon as you save a key, Claude Code switches to API billing across every open session — including CLACOROO itself. Your Max subscription is no longer used until you remove the key. If you run out of API credits, all Claude Code sessions stop working at once. To go back to your subscription, remove the key from this panel.
Overview
The Anthropic API key panel lives in Settings, right below the Claude account panel. It shows the current state and offers actions:
- Not configured — when no key is set
- Configured · sk-ant-…XXXX — when a key is set, masked except for the last 4 chars
- Test connection — verifies the key against the Anthropic API
- Save key / Replace key / Remove key — depending on state
- Anthropic Console — a direct link to Anthropic’s console to create or manage keys
What it shows
Status badge
- Not configured — no API key stored
- Configured — a key is stored and ready for Claude Code to use
- Storage not encrypted — (Linux only) the key file is
chmod 600but not encrypted, because no system keyring was available
Storage backend
A line under the status indicates which storage backend is in use:
- macOS — the system Keychain
- Windows — DPAPI (Data Protection API)
- Linux — Secret Service (GNOME Keyring, KWallet) when available; otherwise a plain
chmod 600file in~/.config/clacoroo/
Helper path
CLACOROO points Claude Code at a small helper script (Anthropic’s apiKeyHelper mechanism) that reads the key from your keyring on demand. The path to that helper is shown for reference — it lives in your CLACOROO data folder.
Common tasks
How to add an API key
- Open Settings → Anthropic API key
- Paste your key in the input field — keys start with
sk-ant- - (Optional) Click Show to verify what you pasted
- Click Test connection — CLACOROO calls the Anthropic API once to confirm the key is valid
- If the test passes, click Save key
- CLACOROO stores the key in your keyring and registers the
apiKeyHelperwith Claude Code
If you don’t have a key yet, click Anthropic Console to open the dashboard where you can create one.
How to test an existing key
- In the panel, click Test connection
- CLACOROO makes one small API call (no payload, just an auth check)
- A green toast confirms success; a red toast shows the error message from Anthropic’s API
How to replace the key
- Click Replace key
- Paste the new key
- Test connection then Save
- The old key is removed from the keyring and the new one takes over
How to remove the key
- Click Remove key
- Confirm in the dialog
- CLACOROO deletes the key from your keyring and unregisters the helper
Removing the key does not affect your claude.ai session (if any) — that’s managed separately on the Claude account panel.
Tips & shortcuts
- The input field strictly validates the key shape (
sk-ant-plus characters) — this catches accidental copy-paste of partial strings before they reach your keyring - Test before save: CLACOROO won’t stop you from saving an untested key, but testing first avoids storing a bad value
- The masked display (
sk-ant-…XXXX) is shown everywhere CLACOROO references the key, including the Claude account panel - Claude Code’s
apiKeyHelperis a standard mechanism — if you ever inspectclaude config get apiKeyHelper, you’ll see the path CLACOROO registered
Edge cases & errors
- Test connection fails with “401 Unauthorized”. The key is either revoked or copied incorrectly. Create a new key on console.anthropic.com, paste it, test again.
- “Storage not encrypted” warning on Linux. No Secret Service (Keyring/KWallet) is available on your system. Install
gnome-keyringorlibsecretfor proper encryption; meanwhile the key file is at leastchmod 600so only your user can read it. - Claude Code doesn’t pick up the key. Make sure
apiKeyHelperis what Claude Code expects: runclaude config get apiKeyHelperin the built-in terminal and verify it points to the CLACOROO helper. - macOS prompts for Keychain access every time. Open Keychain Access, find the CLACOROO entry, and check “Always allow access” for the helper application.
- Both claude.ai and an API key are configured. The API key takes priority — Claude Code switches to API billing immediately across all sessions. Remove the key to go back to your claude.ai subscription.
Related
- Claude account — the subscription login, alternative to the API key
- Quota notifications — notifications when usage crosses 80% / 95% / 100% (works with either auth)
- Built-in terminal — useful for running
claude config get apiKeyHelperto verify the setup