OpenCode Breach: API Keys Exposed for 1.4% of Console Users

OpenCode disclosed a breach through a legacy system it was already decommissioning, exposing OpenAI, Anthropic, and Google keys for 1.4% of Console users.

The short version: On October 17, 2026, OpenCode disclosed that attackers had reached a legacy system it was already decommissioning and exposed third-party API keys — including OpenAI, Anthropic, and Google credentials — stored by roughly 1.4% of its paid Console users. OpenCode is calling it a large-scale distillation attack. Affected developers started reporting unauthorized charges, some in the hundreds of dollars and at least one as high as $1,700, before OpenCode had even gone public. The proximate cause was a forgotten legacy system; the underlying cause is that a coding-agent console was holding live, usable provider keys in the first place.

What OpenCode disclosed

OpenCode is an open-source coding agent built by Anomaly, the team formerly known as SST. The company says 16 million developers use the agent each month, and its GitHub repository has about 215,000 stars — more than OpenAI's Codex CLI or Google's Gemini CLI. OpenCode runs in a terminal, code editor, or desktop app and connects to models from more than 75 providers, with users supplying their own private API keys to give the agent access. Console, OpenCode's hosted product, stores those keys on OpenCode's own servers so the service can call providers on a user's behalf.

That storage is what got exposed. In an email to affected users, OpenCode said someone had gained "unauthorized access to a legacy system that we were in the process of decommissioning." Third-party provider keys stored in users' workspaces, including those for OpenAI and Anthropic, may have been exposed. OpenCode has tied the intrusion to what it describes as a large-scale distillation attack, which involves collecting an AI model's responses to train another model — in effect, using stolen access to a frontier model as a cheap way to harvest training data for a competing one.

On scope, the company has been specific about exactly one number. OpenCode disclosed a security breach affecting 1.4% of its Console users, and it emailed all of them, saying anyone who did not receive an email was not affected, and that the affected group was users who had external providers linked. Beyond that, detail is thin: OpenCode's public statement does not explain how attackers gained access, how long they remained inside, or how many keys were involved, and it does not name an attacker or provide technical evidence showing how the breach supported the reported distillation activity.

1.4%
of OpenCode Console users with external providers linked were affected
16M
developers OpenCode says use the agent every month
$1,700
in fraudulent usage one affected developer reported overnight

The timeline, as far as it's public

1 · Intrusion

OpenCode's own account points to unauthorized access reaching a Console-adjacent legacy system that was mid-decommission, not a currently maintained production path.

2 · Users notice first

Some users spotted unexplained charges before OpenCode said anything publicly; Colin Parsons reported his OpenAI key was charged $281 and his Anthropic key $168.

3 · Public disclosure

OpenCode confirmed the incident on X on October 17:

"We had a security breach last night related to a large scale distillation attack."

4 · Notification and remediation

OpenCode emailed every affected account the same morning. Preston Zeller put his losses at $1,700, while another user reported over $700 in OpenAI usage before cutting off access. Anthropic said it had revoked the Claude API keys it believed were affected, and OpenCode said it was working with all three providers to remediate.

The "we meant to get to it" failure mode

OpenCode's own explanation is the most honest part of the disclosure, and also the most familiar. The entry point wasn't a novel attack technique — it was a system the company already knew was a liability. It was mid-decommission: scheduled for retirement, presumably deprioritized against other work, still reachable, and still holding keys.

This is one of the most common patterns in breach postmortems. The vulnerable component isn't a surprise; it's a known item that didn't get retired before an attacker found it. Decommissioning takes time, and in that window, old systems often fall out of active monitoring even though they still carry live credentials. The lesson isn't "patch faster." It's that any system holding raw provider keys is a standing liability for as long as it exists — including during its own shutdown.

Why this is structurally the same mistake as a .env file

It's tempting to treat this as an access-control failure specific to OpenCode and move on. But the deeper issue is architectural, and it applies well beyond this one incident: Console stored real, usable OpenAI, Anthropic, and Google API keys so a hosted agent could call those providers for a user. Functionally, that's indistinguishable from a developer pasting the same keys into a .env file on a server. In both cases:

  • The raw credential exists in a retrievable form, in a system that is one access-control mistake away from exposure.
  • Any process, script, or legacy endpoint with read access to that storage can exfiltrate a key that works everywhere, with no built-in limit on spend, scope, or duration.
  • Revocation is manual and reactive — it happens only after someone notices the damage, whether that's a developer spotting a leaked .env in a public repo or a Console user watching an unexpected AI bill.

Swapping "config file" for "coding-agent console" doesn't change the trust model. A key sitting in workspace storage so an agent can use it later is the same shape of risk as a key sitting in plaintext on disk. The interface is nicer; the blast radius is identical.

What a gateway model changes

The alternative isn't "store the key more carefully." It's not handing the raw key to the agent, the console, or the process in the first place. In a gateway architecture, the application or agent authenticates to the gateway, and the gateway injects the actual OpenAI, Anthropic, or Google credential at the network egress point, per request. The agent never holds the live key, so it can't leak what it never had. If the gateway's own storage is compromised, the operator rotates one upstream secret centrally instead of asking thousands of end users to revoke credentials across three separate provider dashboards.

That architecture would not have stopped someone from reaching OpenCode's legacy system, and it wouldn't have prevented a breach from existing. What it changes is the payload: an attacker reaching that system finds short-lived, scoped routing tokens instead of live OpenAI, Anthropic, and Google keys that work immediately, from anywhere, for as long as a distillation campaign needs them to run. This is the premise behind KnoxCall's AI gateway design — the credential lives at the egress wire, not inside the agent, the CI runner, or the console workspace calling it.

Key takeaway: "In the process of decommissioning" is not a mitigating detail — it's the whole story. Every system holding a live provider key is a liability until the key is gone from it, not until the system is finally switched off.

What to do if you used OpenCode Console

If you linked OpenAI, Anthropic, or Google credentials in OpenCode Console, treat every one of those keys as compromised, whether or not you received a notification email, since OpenCode has acknowledged it doesn't yet know the full extent of the access. Concretely:

  1. Revoke and reissue the keys directly in each provider's dashboard, not just inside OpenCode. The company's own notice asks recipients to revoke and replace those keys through each provider's dashboard, update applications that use them, and review recent usage for unexpected activity.
  2. Set hard spend caps on provider accounts going forward; a distillation attack is defined by volume, and a cap limits the financial damage of the next leak, wherever it originates.
  3. If you're building anything that needs to hold or route provider keys on behalf of other users — a coding agent, an internal tool, a SaaS integration — treat this incident as the reference case for why that credential shouldn't live in your own storage at all.

For teams rethinking how secrets sprawl across dev tools, CI, and agents, our security overview and gateway comparison cover what egress-time credential injection looks like in practice, and pricing covers what it costs to stop handing out raw keys at all.

What's still unknown

OpenCode identified a large-scale distillation attack but has not disclosed full technical details, and the company has said the incident remains ongoing so it cannot share more at this point. Whether the attacker was specifically hunting for distillation fodder, or simply found a trove of valuable keys and distillation was the most profitable use of them, isn't established. Neither the duration of the attacker's access nor the total number of exposed keys has been made public. If that changes, it will matter — but as of this writing, the 1.4% figure and the legacy-system explanation are the two facts OpenCode has put its name to.

Frequently asked questions

What happened in the OpenCode breach?

OpenCode disclosed on October 17, 2026 that an attacker reached a legacy system it was in the process of decommissioning, exposing third-party AI provider API keys, including OpenAI, Anthropic, and Google credentials, stored by Console users. OpenCode said about 1.4% of its Console users with external providers linked were affected and notified them by email.

What is a distillation attack?

A distillation attack is when someone uses stolen or unauthorized access to an AI model to harvest large volumes of its outputs, then uses that data to train a separate, often cheaper, model that mimics the original's behavior. OpenCode linked the stolen keys in this incident to that kind of large-scale harvesting.

Should I revoke my API keys if I used OpenCode Console?

Yes. If you linked OpenAI, Anthropic, or Google keys in OpenCode Console, revoke and reissue them directly in each provider's dashboard rather than just rotating them inside OpenCode, and review recent usage for unauthorized activity, even if you did not receive a notification email.

How many OpenCode users were affected by the breach?

OpenCode said the breach affected roughly 1.4% of its Console users, specifically the subset who had linked external AI providers. The company has not disclosed the exact number of accounts or keys involved.

Did OpenCode's open-source coding agent itself get hacked?

No. The breach involved OpenCode's hosted Console product, which stores users' provider API keys on OpenCode's servers, not the open-source CLI agent that developers run locally. The entry point was a legacy system tied to that hosted service.

How could a gateway have changed the outcome of this breach?

A gateway that injects provider credentials at the network egress point, rather than storing raw keys in a console or agent workspace, would not have prevented the legacy system from being breached, but it would mean attackers found short-lived routing tokens instead of live OpenAI, Anthropic, and Google keys ready to use.

Sources

  1. OpenCode Security Breach Exposes Third-Party API Keys of its Console Users
  2. OpenCode confirms breach as users report AI charges they never authorised
  3. OpenCode Security Breach Exposes API Keys of 1.4% of Console Users
  4. OpenCode Told 1.4% of Console Users to Revoke Their OpenAI and Anthropic Keys
  5. OpenCode breach drains users' AI keys as platforms holding customer credentials come under attack

Stop storing live provider keys in tools that don't need them

If a legacy system, console, or CI runner never holds the raw OpenAI, Anthropic, or Google key, a breach there exposes routing tokens instead of a bill you have to fight with three providers.

Start Free →

Or get new posts by email. Double opt-in, unsubscribe anytime.