← Back to blog

OpenCode Hacked: How to Check If Your API Keys Leaked and What to Rotate

2026-10-18 · 7 min read
OpenCodeAPI keyssecurityClaudeai-tools

Short answer first: OpenCode disclosed on October 17, 2026 that a breach hit OpenCode Console — the optional paid web service, not the OpenCode coding agent that most people run locally. OpenCode says it affected 1.4% of Console users, specifically people who had linked an external AI provider (OpenAI, Anthropic, Google and others) and saved that provider's API key in a Console workspace. If you never stored a provider key in Console, you are not in the affected group. If you did, treat that key as exposed: revoke it at the provider, check your recent usage, and put a spend limit on the replacement.

What happened

OpenCode posted the following on its official X account on October 17:

"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. If you did not get an email you were not impacted, it was a subset of users who had external providers linked. The incident is ongoing so we cannot share more details at this point but we are working with Anthropic, OpenAI, and Google to remediate."

Affected users got an email with the subject line "Action Required: Potential provider key breach." In it, OpenCode said it had identified "unauthorized access to a legacy system that we were in the process of decommissioning," and that third-party provider keys "(eg OpenAI, Anthropic) saved in your workspace may have been exposed." It asked users to revoke and replace those keys, update any applications using them, and review recent usage for unexpected activity.

The key detail is the word Console. OpenCode Console is a web service, similar in spirit to OpenRouter, that sells pay-as-you-go access to models and lets a team connect its own provider accounts by storing an API key on OpenCode's servers. The open-source OpenCode agent — the CLI, editor extension or desktop app you run yourself — is a separate product. OpenCode co-founder Dax Raad said keys used with the local app "never come to us"; only keys saved in Console were in scope for this incident.

Are you affected?

Run these checks in order:

  • Did you get the email? OpenCode's stated position is that anyone who did not receive its October 17 notice was not impacted. Search your inbox and spam folder for "Potential provider key breach."
  • Did you ever save a provider key in Console? Open in the Console, open a workspace, and check the Providers page. Team admins should check on behalf of members — a member can connect a provider without ever seeing the stored key, but it still lives in the workspace.
  • Not sure? Rotation is cheap. If you might have linked a key, rotate it anyway; the whole procedure takes a few minutes and costs nothing.

The local-only setup is the one case that is clearly out of scope: OpenCode run against local models, or with provider keys kept only in your own config or environment variables and never uploaded to Console. Nothing published so far says those keys were exposed.

What to do — a five-minute checklist

  1. Revoke at the provider, not in Console. Deleting a key from OpenCode does not stop someone who already copied it. Open the API keys page at OpenAI, Anthropic, Google (AI Studio or Cloud credentials) and any other provider you linked, revoke the old key and create a new one. Go to the provider's dashboard directly — not through a link in a breach email, since "verify your key" messages are a standard phishing follow-up.
  2. Review usage and billing since October 16. Look for spikes, unfamiliar models, or activity at unusual hours. Users on X and Reddit reported overnight charges on their OpenAI, Anthropic and Google accounts, including one report of $281 on an OpenAI key and $168 on an Anthropic key; those individual numbers are self-reported and not independently verified. If you see charges you did not make, contact the provider's support with the dates.
  3. Set a spend limit and usage alerts on every new key. A cap does not stop a theft, but it caps the damage. One user reported that Google's automatic suspension is what stopped their losses from growing.
  4. Update everything that used the old key. That includes CI jobs, scripts and any other coding agent or app that shared it. A rotated key that still sits in a committed .env file is not fixed.
  5. Reset your OpenCode account password and regenerate any Console API keys. As a precaution, also revoke any OAuth or app grants you gave to OpenCode (for example Google account permissions or GitHub authorized apps).
  6. If you were drained and never got the email, OpenCode has asked affected users to reach out. Reported guidance is to contact Dax at [email protected] with usage evidence only — never send an API key.

The catch: Console budgets won't catch a stolen key

This is the part that trips people up. Console only sees requests that run through Console. Its usage reports and workspace budgets reflect that traffic. A leaked key used directly against OpenAI or Anthropic never touches Console, so it will not show up in your OpenCode dashboard and will not hit your Console budget. The bill lands with the provider.

That means your audit has to happen at the provider's dashboard, not inside OpenCode. Anthropic's usage page, OpenAI's usage and billing pages, Google Cloud billing, and any OpenRouter activity are where the anomalies would appear.

What the providers have done

Anthropic and Google staff said on X that they are working with OpenCode on the incident. Anthropic's Lydia Hallie said the company "revoked Claude API keys we believe were affected" and advised anyone who saved a key in OpenCode to create a new one. Google's Evan Otero said Google "blocked exposed API keys" and asked users to create a fresh key in AI Studio, delete the old one and review usage. Practical consequence: if a Claude or Gemini key that used to work suddenly returns a 401, it may simply have been revoked by the provider — make a new one.

What we still don't know

OpenCode has not published how many people were affected (it has not released a Console user count, so 1.4% cannot be turned into a number), how the attackers got in, how long they had access, how the keys were stored, or the total dollar value of unauthorized usage. OpenCode has linked the incident to "a large scale distillation attack" but has not explained the connection. Treat any specific figure you see beyond the official statement as unconfirmed until OpenCode publishes a fuller post-mortem.

If you would rather not manage API keys at all

The uncomfortable lesson here is not "OpenCode is uniquely unsafe." It is that any service you hand a raw API key to can leak it, and a raw key is a bearer secret — whoever holds it can spend your money with no login and no second factor. Storing provider keys is a standing liability, whether the threat is a breach, a misconfigured .env, or a key pasted into the wrong window.

If you use Claude, GPT or Gemini mainly to chat, write and analyze — not to run an autonomous coding agent — you do not need to hold an API key at all. On aiwith you get Claude (Fable 5.1 and Opus 5.5), GPT-6, Gemini 3.1, DeepSeek and Kimi in the browser under one subscription, with no provider key to store, rotate or leak when the next incident lands.

More on this topic