OpenCode disclosed a breach exposing stored OpenAI, Anthropic, and Google API keys for 1.4% of Console users. Here's how to rotate your keys safely.
Vamsi Tallapudi
Manager, Architect Technology at Cognizant
OpenCode disclosed a security breach on October 17, 2026, and told users to assume their stored API keys for OpenAI, Anthropic, and Google were exposed. If you ever linked a provider key inside OpenCode Console, the fix is simple and non-negotiable: go rotate that key in the provider's own dashboard today, not inside OpenCode, and check your usage logs for charges you didn't make.
OpenCode posted on X that it had "a security breach last night related to a large scale distillation attack that impacted 1.4% of OpenCode Console users." The company said it notified affected users by email that morning and that if you didn't get an email, you weren't part of the 1.4%.
The entry point, according to OpenCode, was a legacy system inside Console that was already in the process of being decommissioned. That system stored third-party provider keys that users had saved so OpenCode could call OpenAI, Anthropic, and Google models on their behalf. Attackers got into that legacy piece, and from there had access to whatever keys were sitting in it.
OpenCode has not said exactly how the attackers got in, how long they had access, or how many accounts 1.4% actually represents. That's a real gap. "We're working with the providers" is not the same as "here's the root cause," and as of this writing OpenCode hasn't published the second part.
Mostly no, and this is the part a lot of the breaking-news headlines blurred. OpenCode the open-source coding agent, the CLI tool with 70,000-plus GitHub stars that people run locally, is not what got hacked. The breach hit OpenCode Console, a separate hosted service that works a bit like OpenRouter: you log in, paste in your OpenAI or Anthropic key, and Console manages routing and billing for you.
If you only ever ran the OpenCode CLI with keys in your own .env file or shell environment, and never touched Console, you weren't exposed by this specific incident. If you used Console's "add your provider key" flow at any point, even once, assume you were in scope and rotate anyway. Better safe than $400 poorer.
Bad enough that people noticed before OpenCode said anything. Developer Max Weinbach posted that his OpenAI account had logged around 35 million tokens across nearly 9,000 requests in a single day, enough to drain his prepaid balance into the negative. Other users reported roughly $400 in unauthorized Anthropic charges, and at least one person said their Google bill jumped by about €200.
Security researcher Soups Ranjan, who posted a widely shared breakdown of the incident, said the exposed keys were "apparently being stored in cleartext." OpenCode itself hasn't confirmed that detail publicly, so treat it as a credible claim from someone in the space rather than a confirmed fact, but it lines up with how fast and how large the token usage spikes were. Cleartext storage plus a compromised legacy system is about the worst combination you can have for a key vault.
A distillation attack is when someone uses access to a strong model to generate a large volume of input/output pairs, then trains a cheaper model to imitate the expensive one. It's a legitimate research technique when you own the access. It's theft when you're running it on someone else's paid API key.
That's the framing OpenCode chose, and it explains the token volume: 35 million tokens in a day isn't a human developer coding, it's a script hammering an endpoint to harvest outputs at scale. Whoever did this wasn't trying to read your code. They wanted cheap, high-volume access to frontier models, and your stored key was the ticket.
Do these in order, and do them even if you're not sure you were affected:
.env files, and any committed config for the old key. A key you rotated at the provider but left sitting in a repo is still a live problem for that repo.Yes, and that's worth knowing before you decide how much trust to extend here. In January 2026, researchers disclosed CVE-2026-22812: versions of OpenCode before 1.0.216 started an unauthenticated local HTTP server on port 4096 that let any website or local process execute shell commands on your machine with zero authentication, no click required. OpenCode added CORS restrictions in 1.0.216 and disabled the server by default in 1.1.10, but it's still unauthenticated if you turn it back on.
Separately, OpenCode spent most of the first quarter of 2026 in a legal fight with Anthropic over OAuth spoofing. OpenCode had been sending headers that made Anthropic's servers think requests were coming from the official Claude Code client, so users could burn their Claude Pro or Max subscription quota inside OpenCode instead of paying for API access. Anthropic blocked it server-side in January, tightened its terms in February, and OpenCode pulled the integration by March after what its own commit log called "anthropic legal requests."
None of that caused this breach directly. But it's the same pattern twice: a fast-moving open-source tool shipping convenience features (an always-on local server, a way to reuse someone else's subscription, a hosted key vault) ahead of the security review those features deserve. If you've been treating OpenCode Console like a password manager for your AI keys, this is the year to stop.
A few habits that would have made this breach a non-event for you personally:
If you're choosing between AI coding tools and security practices matter to you, it's worth comparing how each one handles keys before you commit, the same way you'd check how Claude Code's pricing and usage limits work before relying on it daily. And if OpenCode Console was your reason for routing spend through a middleman instead of paying providers directly, now's a fair time to revisit whether that tradeoff still makes sense given what it just cost some users.
For a broader view of where OpenCode sits next to the rest of the field, our roundup of the top AI coding tools is a decent starting point if you're shopping for an alternative.
New AI tools, automation workflows, and course drops — straight to your inbox. Join 2,400+ builders.
GPT-6 Pro in ChatGPT now splits tasks across multiple agents running at once. Here's who gets it, what it actually does, and how it compares to Claude Code subagents.
DeepSeek V4.1 Flash 1017 brings big Terminal-Bench gains at the same price. Here's how its benchmarks, pricing, and open weights stack up against Claude Opus 5.5.
Claude writes 90% of Claude Code's own codebase. Here's the 7-layer review process Anthropic built so merged PRs doubled while reverts fell 40%.
Comments