The API key lockdown kit: revoke, cap and stop reusing your Anthropic keys
The short version
On Friday 16 Oct 2026 attackers got into the OpenCode Console, the hosted workspace where people save their AI provider keys. OpenCode says the breach hit 1.4% of its Console users, the ones who had linked outside providers, and that the Anthropic and OpenAI keys saved there may have been exposed. Some of those keys were then spent by strangers. One user reported 1,700 USD in losses.
The real problem is not one tool. It is one key pasted into every AI tool you try, with no ceiling on what it can spend. The fix is three moves: revoke the old keys in the Claude Console itself, give every tool its own workspace, key and monthly spend limit, and never send a live key through a model router. After that, a leaked key costs you the cap you set, not whatever a stranger feels like spending.
| Number | What it means |
|---|---|
| 1.4% | of OpenCode Console users hit, per OpenCode |
| 1,700 USD | the largest loss one user reported |
| 428 | model routers researchers tested (28 paid, 400 free) |
| 17 | free routers that touched AWS keys planted as bait |
| 1 | router that drained a planted crypto wallet |
Sources: OpenCode on X, 17 Oct 2026 · OpenCode GitHub issue #56833 (quotes the email) · Dealroom, 18 Oct 2026 (user charges) · Cyera: how to rotate exposed AI keys · Claude docs: Workspaces · "Your Agent Is Mine", arXiv 2604.08407
Copy these prompts
Paste them into Claude Code (or any AI that can see your laptop and project), in this order. Prompt 1 finds the keys, prompt 2 plans the new setup, prompt 3 checks nothing is still leaking.
1. Find every key you have ever pasted somewhere
I want to find every AI provider API key stored on this machine. Search my home folder for files that contain
Anthropic keys (they start with sk-ant-) or OpenAI keys (they start with sk-proj- or sk-), skipping node_modules,
.git, Library and .Trash. Print the file paths only, never the key values. For each file, tell me what it
probably is (an .env file, a shell config, a notes file, a tool's settings) and which project or tool it belongs
to. Then list the AI tools I seem to have tried, based on their config folders, so I know which keys to revoke.
2. Plan one workspace, one key and one cap per tool
Using the list from the last step, write me a table with one row per tool that needs an Anthropic key. For each
row give: a short workspace name for the Claude Console, a sensible monthly spend limit in USD based on how I use
that tool (ask me if you can't tell), and where in that tool the new key goes. Then give me the exact clicks in
platform.claude.com to create each workspace, create the key inside it and set its spend limit. Don't create
or change any key yourself. I will do the Console steps by hand.
3. Check nothing still routes a live key through someone else
Look through my shell configs, .env files and AI tool settings for any base URL or proxy that is not the
provider's official endpoint (for Anthropic that is api.anthropic.com). List every place a request could go
through a third party router, proxy or "free model" service, and which key it would carry. For each one, tell me
how to switch it back to the official endpoint, and remind me to revoke any key that ever went through it.
Move 1: revoke in the Console, not in the tool
Go to platform.claude.com, then Settings, then API keys. Find every key you ever saved in OpenCode, or in any tool you do not fully trust, and disable or delete it there. Then make a new one.
Deleting a key inside OpenCode does not kill it. It only removes OpenCode's copy. The key keeps working until Anthropic revokes it, and the only place that happens is the Console.
Do the same on OpenAI (platform.openai.com, API keys) and Google. Type these addresses yourself. Do not click links in a breach email: breach emails are a favourite phishing template.
Move 2: one workspace, one key, one spend limit per tool
- In the Claude Console, open Settings, then Workspaces, then Create workspace. Name it after the tool, for example "opencode", "cursor" or "my-app-prod". You can have up to 100.
- Create the API key inside that workspace. A workspace key can only act inside its own workspace, so one leak kills one key, not your account.
- Open the workspace, then Spend limits, and set the monthly cap and the alert thresholds.
You can't set limits on the Default Workspace. That is why you make a workspace first. Per workspace rate limits live on the Rate limits page if you want a second guard.
Move 3: the bigger leak, model routers
This part is not about OpenCode. A model router (or proxy, or "free model" API) sits between your tool and the provider, and it can read everything it forwards: your prompts, your code and your API key.
In "Your Agent Is Mine" (arXiv 2604.08407, April 2026), researchers tested 428 LLM API routers that people buy or grab for free:
- 9 injected malicious code into responses (1 paid, 8 free).
- 17 free routers touched AWS credentials the researchers had planted as bait.
- 1 drained crypto from a wallet key they had planted.
- Their decoys saw 99 credentials exposed across 440 coding agent sessions.
So: use the provider's official endpoint, or a tool you trust and can check. Never send a live key through a free router. If a key ever went through one, revoke it.
Check the damage
- Console, then Usage and Cost: look at every day since 16 Oct for spikes, models you don't use, or calls at hours you were asleep.
- Do the same on OpenAI and Google billing.
- If you see charges you didn't make, write to OpenCode with the dates and amounts, and contact the provider's support.
- If you did not get OpenCode's email, OpenCode says you were not affected. The report covers the hosted Console, not the app on your laptop.
The bonus: the command that finds every key on your laptop
This lists every file under your home folder that holds an Anthropic or OpenAI key. It prints file names only, never the keys:
grep -rIl --exclude-dir={node_modules,.git,Library,.Trash} -e 'sk-ant-' -e 'sk-proj-' ~ 2>/dev/null
It can take a minute or two. Every file it finds is a place a key can leak from: old .env files, notes, scripts you forgot. Keep what you still need in one password manager or one env file that is in no repo, and revoke the rest.
Steal this for your app
- Treat every third party AI tool as a place your key can leak. Give it a key made for it, in its own workspace, with a cap.
- Prefer tools that let you sign in with your provider account over tools that ask you to paste a key.
- Never commit a key: add .env to .gitignore and turn on GitHub secret scanning, which flags Anthropic keys.
- Set billing alerts on every provider, not just Anthropic. A cap you never see is a cap you forget.
- A leaked key should cost you twenty dollars, not seventeen hundred. Size each cap to that.
Run this on your codebase
Audit this project for API key risk. Find every place a provider key is read, stored or logged: env files,
config files, client side code, build output, error logs and test fixtures. Flag any key that could end up in a
browser bundle, a git commit or a log line, and any request that goes through a third party proxy instead of the
provider's official endpoint. For each finding, tell me the file, the risk in one sentence and the smallest fix.
Never print a key value.