Leaked API key? Revoke it at the provider, then cap spending
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?
- 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.
- 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.
- Review usage and billing at the provider for requests you didn't make, going back to the date of the leak.
- 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.
- 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
- Google Gemini API: the docs say that starting May 28, 2026, new keys created in Google AI Studio are authorization keys with "fast-acting leaked key enforcement", and the Gemini API rejects requests from unrestricted standard keys.
- Anthropic: its support article says Anthropic partners with GitHub's secret scanning program, so Claude API keys found in public GitHub repositories are reported to Anthropic.
- OpenAI: the docs recommend setting an expiration date on project API keys and rotating them regularly; admins can restrict which kinds of keys can be created.
- OpenRouter: the docs recommend a credit limit on every key, because a key with no limit "lets a leaked key or a runaway agent spend your entire balance, including any auto top-ups".