- Confirmed by OpenCode: a breach of OpenCode Console, linked to a large scale distillation attack, hit 1.4% of Console users who had external providers linked. Affected users were emailed; no email means not affected. The incident was still ongoing on 18 October.
- Confirmed by an OpenCode co-founder: it was the hosted Console, "not OpenCode itself"; keys used with the local tool never reach OpenCode.
- Not confirmed: how the attacker got in, and whether the exposed keys were used.
- Order: create new key, deploy new key, delete old key, then watch usage for 48 hours.
- Set a spend cap on every provider that offers one. Anthropic, Google AI Studio and Groq document a monthly cap; OpenAI documents a project budget that can be enforced as hard.
- Keys also live in shell files,
.envfiles, CI secrets and IDE settings. Grep for them; the commands are below.
If you ever saved an OpenAI, Anthropic or other provider key in an OpenCode workspace, create a replacement key today, deploy it, then delete the old one and watch usage for 48 hours. On 17 October 2026 OpenCode posted that it "had a security breach last night related to a large scale distillation attack that impacted 1.4% of OpenCode Console users" and that it had emailed every affected user[12]; a follow-up post added that it was "a subset of users who had external providers linked"[15]. The Hacker News thread passed 850 points within a day[1]. This post is a rotation checklist, not a post-mortem: what is confirmed, what is still unknown, the exact order of operations, and where each of seven providers keeps its revoke button, usage view and spend cap.
What we know as of 21 October 2026
This section is the part to update when a post-mortem lands. Everything here is attributed. Updated 19 October 2026: the first version quoted OpenCode's email second-hand from the Hacker News thread; it now quotes OpenCode's own public post and a co-founder's follow-up. Updated 21 October 2026: added what Anthropic, Google and OpenAI staff say they did for affected users. OpenCode has not published a post-mortem yet.
Confirmed by the OpenCode team
OpenCode's first post on X says: "We had a security breach last night related to a large scale distillation attack that impacted 1.4% of OpenCode Console users. We have notified them all this morning via email." It adds that the incident is ongoing and that the team is "working with Anthropic, OpenAI, and Google to remediate"[12]. A second post twelve minutes later says: "If you did not get an email you were not impacted, it was a subset of users who had external providers linked"[15].
An OpenCode co-founder followed up that this was "the OpenCode Console", "not OpenCode itself, those keys never come to us": keys you give the local CLI, TUI or desktop app stay on your machine[13]. The next day he wrote that attackers had been "non stop trying to attack our systems for the past 48 hours"[13].
The email to affected users is titled "Action Required: Potential provider key breach", per The Hacker News[14]. Users quoting it in the Hacker News thread say it reports "unauthorized access to a legacy system", says provider keys saved in a workspace "may have been exposed", and tells users to revoke and replace them and review usage[1]. We have not seen the email itself, so treat those quotes as reported, not verified.
What Anthropic, Google and OpenAI say
Anthropic's Lydia Hallie wrote on 17 October: "We’ve been working with OpenCode on yesterday’s breach and have revoked Claude API keys we believe were affected." She added: "If you saved a key in OpenCode and want to be extra careful, please create a new one!"[16] Less than two hours later Evan Otero, who works on the Gemini API at Google DeepMind, wrote: "We are aware of the OpenCode security incident involving Gemini API keys stored in OpenCode." He said Google had blocked the exposed keys and was working with affected customers and OpenCode, and told users to "create a new key in AI Studio, delete the old one, and review your usage", and to contact Google Cloud Billing support about charges they did not make[18]. On 19 October OpenAI's Tibo Sottiaux wrote that his team "worked with OpenCode to have their users who are also OpenAI API customers back in business and any credits refunded which would have been drawn in the attack"[17].
All three are posts by individual staff on X, not formal notices. None says how a refund is issued or whether you have to ask for one. If Anthropic or Google already revoked or blocked your key, any app still using it will start failing, so create and deploy a new key either way.
Reported by commenters, not confirmed
OpenCode Console is the hosted gateway where you store your own provider keys, similar to how OpenRouter works. Some commenters report their OpenCode Go keys were revoked with no unauthorized usage on their side; OpenCode has not said whether Zen or Go were affected. One commenter claims local .env files read by agents could also be a leak path, citing secondhand posts[1]. None of this comes from OpenCode.
Unknown
- How the attacker got in, and how long they had access.
- Whether the keys were stored encrypted, and whether the encryption keys were also reachable.
- What the keys were used for. OpenCode ties the breach to a "large scale distillation attack" but has not said whether stolen keys were used to run it.
- Whether OpenCode Zen or Go accounts are in scope. No official post covers them.
The practical reading: if you got OpenCode's email, rotate every key you linked in Console now. If you linked keys in Console and are not sure the email reached you, rotate anyway. If you only ever used the local CLI with your own keys, OpenCode says those keys never reached it. Rotation costs ten minutes per key. A leaked key with no cap can cost far more.
Do not confuse this with CVE-2026-22812
An older, unrelated issue keeps showing up in search results for "OpenCode vulnerability". CVE-2026-22812 describes OpenCode starting an unauthenticated HTTP server that allows any local process to reach it; the NVD entry says versions before 1.0.216 are affected[2]. The CNA vector is network-reachable with user interaction required[2]. That bug is fixed by updating the client. The October 2026 incident is about keys stored on a hosted system, and updating your CLI does nothing for a key that is already stored there. If you want the wider picture of how coding-agent tooling gets attacked, our MCP server security audit covers the CVE classes that keep repeating.
Order of operations: create, deploy, delete, watch
Deleting first is the instinct, and it is the wrong order for anything running in production. A deleted key fails requests immediately. Do it in this sequence:
- Inventory. List every provider key you ever gave OpenCode, plus every key that sits in the same
.envor secret store. If a provider offers per-project keys, note which project each belongs to. - Create the new key in the provider dashboard. Give it a name with today's date so you can tell old from new. Prefer a key scoped to one project or workspace.
- Set a spend cap on the account or project before the new key goes live (provider table below).
- Deploy the new key to every place the old one lived: local shell, CI, hosting platform, containers. Restart long-running processes, because most read the environment once at startup.
- Delete the old key. Confirm one real request succeeds on the new key first.
- Watch usage for 48 hours. Compare request counts and cost per day against your normal baseline. Any spend you cannot explain is the signal.
- Do not paste the new key back into OpenCode Console until the team publishes what happened. Use the local CLI with an environment variable instead.
Anthropic's own guidance matches this: rotate by creating new keys and deactivating old ones, and if you suspect compromise, revoke at once[3]. For a key you suspect is leaked and unused in production, skip the careful part and delete immediately.
Provider checklist: revoke, usage, cap
I opened each provider's documentation on 18 October 2026. Where a page did not state a path or feature, the cell says so instead of guessing. Dashboards move; if a link 404s, search the provider console for "API keys".
| Provider | Revoke location | Usage and cost view | Hard spend cap documented? |
|---|---|---|---|
| Anthropic Console | API keys page, three-dot menu, "Delete API Key"[3] | Console usage logs; Usage and Cost API for programmatic checks[3] | Yes. Org "Spend limits" on the Billing page; requests return HTTP 400 at your limit. Workspace limits exist but not on the default workspace[4] |
| OpenAI platform | platform.openai.com/api-keys, trash icon[5] | Per-project Usage Dashboard (visibility depends on your org role)[6] | Project monthly budget. Default is soft; the help article says it can be enforced as hard but is inconsistent, so verify in the dashboard[6] |
| Google AI Studio (Gemini API) | aistudio.google.com/api-keys; delete flow not covered in the billing doc[7] | aistudio.google.com/usage, Dashboard then Usage[7] | Spend page, "Monthly spend cap", "Edit spend cap"; needs project editor, owner or admin[7] |
| OpenRouter | Keys settings page (exact path not confirmed in the docs I opened) | Activity data via API; dashboard view not confirmed[8] | Per-key credit limit, optional reset period[8] |
| Groq | Keys page in the GroqCloud console (not confirmed; the docs URL I tried was a 404) | Not confirmed | Yes. Settings, Billing, Limits blocks API access at the monthly cap with a 400 blocked_api_access; paid tier and org owner required[9] |
| DeepSeek | platform.deepseek.com/api_keys[10] | Not confirmed | Not confirmed |
| xAI | Keys page not covered in the billing doc | Usage explorer[11] | Prepaid credits under Billing, API spend management; auto top-up has a monthly maximum[11] |
Anthropic
Delete the key from the Console API keys page, then open Billing and check the Spend limits section. A limit you set blocks requests with a 400 once reached, while the tier ceiling returns a 429 and resets on the first of the next month[4]. Tier ceilings are $500 (Start), $1,000 (Build) and $200,000 (Scale)[4]. Set yours well under that. If you run Claude Code, put it in its own workspace; the Claude Code workspace is limit-checked separately and can answer with a 429 plus a retry-after header[4].
OpenAI
Keys are per project, and the full secret is only shown once at creation, so a lost key means a new key, not a lookup[5]. Create the replacement inside a project, restrict its permissions (All, Restricted or Read Only), and set the project monthly budget with alert thresholds[6]. Because the help article contradicts itself on soft versus hard enforcement, confirm by looking for the option that makes requests fail after the limit.
Google AI Studio, OpenRouter, Groq, DeepSeek, xAI
Google is the clearest of the five: a named Monthly spend cap on the Spend page[7]. On OpenRouter, set a credit limit on the individual key so a leak cannot drain the whole balance[8]. Groq's cap is organization-wide across all keys, which means one noisy key can exhaust the budget for all your apps[9]. xAI and DeepSeek lean on prepaid balance. Prepaid is itself a cap, as long as auto top-up is off or bounded. We could not find DeepSeek's usage or cap pages in its public docs, so check the dashboard directly and do not assume.
Find every copy of the old key
A key you rotated in the dashboard but left in a forgotten CI secret will break a deploy on a Friday. A key you deleted but left in a shell file does nothing, but a key left in a repo is the real danger. Search first.
The commands below cover the common spots. If you want this as a tool, the AI Provider Key Hygiene Kit packages a zero-dependency scanner for eleven providers' key formats (working tree and git history, redacted output), the per-provider rotation runbook, and a local LiteLLM proxy with per-key budgets so apps stop holding raw provider keys.
Local files
Run this from your home directory and your project roots. The prefixes are the ones commonly seen on each provider's keys (sk-ant-, sk-proj-, sk-or-, AIza, gsk_, xai-); not every provider documents its prefix, so treat a miss as "not proven absent", and also grep for the old key's last six characters if you have them.
grep -rIE "sk-ant-|sk-proj-|sk-or-|AIza[0-9A-Za-z_-]{30,}|gsk_|xai-|sk-[A-Za-z0-9]{32,}" \
~/.zshrc ~/.zprofile ~/.bashrc ~/.config ~/Projects \
--exclude-dir=node_modules --exclude-dir=.git -l 2>/dev/nullThe -l flag prints file names only, so the keys do not land in your terminal scrollback. Open each file and replace the value. Also check ~/.config/opencode and any auth.json the tool wrote, and your shell history with history | grep -E "sk-|gsk_" if you ever exported a key inline.
Remote copies
- GitHub Actions:
gh secret listin each repo, plusgh secret list --org YOUR_ORGandgh secret list --env productionfor environment secrets. Update withgh secret set NAME. - Git history:
git log -p -S"sk-ant-" --allfinds keys committed and later removed. A key in history must be rotated even if the file is clean now. - Hosting platforms: Vercel, Cloudflare, Fly, Railway and Docker env files each hold their own copy.
- IDE and extension settings: VS Code
settings.json, JetBrains plugin credential stores, and any MCP server config that passes a key throughenv. - Teammates and shared vaults: if a key came from a shared 1Password or Bitwarden item, update the item, not just your machine.
Watching usage for 48 hours
Compromise shows up as spend you cannot map to a deploy. Pick three numbers per provider before you rotate: daily request count, daily cost, and the model mix. Then compare. Two patterns deserve a closer look. A model you do not use appearing in usage, for example a large reasoning model on a key you only use for small summaries. And usage in the hours you were asleep with no scheduled job to explain it.
Keep the old key's last-used time if the dashboard shows one, and note it. If the old key was used after you last touched OpenCode, that is evidence of exposure and worth reporting to the provider's support. Ask them to review the account from 16 October onward (OpenCode says the breach happened the night before its 17 October post, and has not said when access began) and request a credit for any usage you did not make. OpenAI staff say credits drawn in the attack would be refunded, and Google staff point you to Google Cloud Billing support for charges you did not make (see above). No other provider has said so publicly, so expect the rest to decide case by case.
If you want hard guardrails on the agent side as well, a spend hook in your own tooling catches a runaway loop even when the provider cap is high. Our Claude Code spend limit guide compares provider caps in more depth, the Agent Run Cost Simulator estimates what a stuck loop costs per hour so you can pick a sane cap, and the Claude Code Spend Guard hook kit blocks runaway spend locally.
Should you stop using OpenCode?
That depends on how you used it. OpenCode says the exposure sits in the hosted Console, not in the open-source client. If you run the CLI with keys from your own environment and never stored keys in a workspace, the notice as quoted does not describe you, though you should still run the grep above because the commenter claim about .env files is unresolved. Our OpenCode developer guide covers the tool itself; nothing in this incident changes how the local client works, as far as has been disclosed.
The durable lesson is architectural. Any hosted gateway that stores your keys is a single place where many users' credentials sit together, which makes it an attractive target. Prefer keys that are scoped, capped and disposable, so that the next notice costs you a ten-minute rotation and not a bill.
Frequently asked questions
Is the OpenCode CLI affected by the breach?
No, per OpenCode. A co-founder wrote that the breach hit "the OpenCode Console" and "not OpenCode itself, those keys never come to us"[13]. Keys you give the local CLI stay on your machine. Rotate any key you linked in Console.
Do I need to rotate keys I never saved in OpenCode?
OpenCode's notice covers Console users who linked external providers. Keys that never touched OpenCode Console are not covered by it. Rotating on a schedule is still good practice; Anthropic suggests something like every 90 days[3].
How do I know if someone used my leaked key?
Look at your provider usage view for requests, models or hours you cannot explain, starting from at least 16 October. A spend cap will not tell you about misuse, but it limits the damage, so set one first.
Is CVE-2026-22812 part of this incident?
No evidence says so. It is an older flaw in an unauthenticated local server in OpenCode versions before 1.0.216[2]. Update your client, but do not expect that to fix the stored-key exposure.
Sources
- Hacker News: OpenCode Hacked, user credentials leaked (accessed 18 October 2026)
- NVD: CVE-2026-22812 (accessed 18 October 2026)
- Anthropic Support: API key best practices (accessed 18 October 2026)
- Anthropic docs: Rate limits and spend limits (accessed 18 October 2026)
- OpenAI Help: Where do I find my API key (accessed 18 October 2026)
- OpenAI Help: Managing projects in the API platform (accessed 18 October 2026)
- Google AI for Developers: Gemini API billing (accessed 18 October 2026)
- OpenRouter docs: API rate limits and key credit limits (accessed 18 October 2026)
- Groq docs: Spend limits (accessed 18 October 2026)
- DeepSeek API docs (accessed 18 October 2026)
- xAI docs: Billing (accessed 18 October 2026)
- OpenCode on X: security breach notice, 17 October 2026 (accessed 19 October 2026)
- OpenCode co-founder on X: "this is the OpenCode Console", 17 October 2026; follow-up 18 October at x.com/thdxr/status/2111790511409258796 (accessed 19 October 2026)
- The Hacker News: OpenCode Console breach report, 19 October 2026 (accessed 19 October 2026)
- OpenCode on X: follow-up on who was affected, 17 October 2026 (accessed 19 October 2026)
- Anthropic's Lydia Hallie on X: revoked affected Claude API keys, 17 October 2026 (accessed 21 October 2026)
- OpenAI's Tibo Sottiaux on X: affected OpenAI API customers restored and credits refunded, 19 October 2026 (accessed 21 October 2026)
- Google DeepMind's Evan Otero on X: exposed Gemini API keys blocked, 17 October 2026 (accessed 21 October 2026)
Written by
WOWHOW
The WOWHOW team brings 14+ years of production engineering experience. Every tool and product in the catalog is built, tested, and curated in-house.
Monday memo · free
One insight, every Monday. 7am IST.
1 field report, 3 links, 1 tool we actually use. No fluff, no spam.
Beyond the writing
Need production-ready templates?
Free browser tools with no signup, plus premium dev templates and starter kits.
Comments · 0
Beta: comments are stored locally on your device and not visible to other readers.
No comments yet. Be the first to share your thoughts.