EmergencySponsorAbout

Leaked API key? Revoke it at the provider, then cap spending

Last reviewed: . Not legal or financial advice.

Recent case: on Oct 17, 2026 OpenCode said a security breach "related to a large scale distillation attack" impacted 1.4% of OpenCode Console users, a subset who had external providers (such as OpenAI, Anthropic and Google keys) linked. It said affected users were notified by email. If you saved provider keys in a third-party tool that reports a breach, treat those keys as exposed.

I think my API key leaked. What do I do first?

  1. Revoke the key at the provider. Do it in the provider's own dashboard (OpenAI, Anthropic, Google AI Studio or Cloud console, AWS IAM). Removing the key from the tool where you pasted it does not revoke it.
  2. Create a replacement and update every app and script that used the old key. OpenAI's docs describe this order: create the replacement, switch your apps over, then revoke the old key.
  3. Review usage and billing at the provider for requests you didn't make, going back to the date of the leak.
  4. Set a spend cap at the provider before you restart traffic. Check whether a real cap exists in the service table: for example OpenAI, Anthropic, Gemini, OpenRouter.
  5. Got charged for usage you didn't make? Follow the emergency steps and contact the provider's billing support. Refunds are at the provider's discretion.

Does a spending cap protect me from a leaked key?

It limits the damage. Anyone holding a copy of a key can run billable requests until the key is revoked, and a cap set at the provider (not in the third-party tool) is what stops spending once the limit is reached. Most caps lag by a few minutes. A budget or spend limit inside a third-party tool only sees requests that go through that tool.

Should every tool get its own API key?

Yes. Anthropic's docs recommend separate keys per environment so you can disable just one if it's compromised, and services like OpenRouter let you set a credit limit on each key.

What providers do on their side

Official sources