Stolen OpenAI or Anthropic API key? What to do in the first hour

Last updated 19 Oct 2026

Short answer: Revoke the key at the provider straight away, so new requests using it are rejected. Then check usage to see what was spent and whether any other key was involved, turn on a hard monthly spend limit so a future leak has a ceiling, and report the misuse to OpenAI or Anthropic. After that, replace the key with a new, dedicated key for each app or tool, so one leak can't drain everything.

How do I stop a stolen API key right now?

How do I find out what was spent?

How do I put a ceiling on future damage?

Who do I report it to?

How do I stop it happening again?

Where does a spending-cap proxy fit?

Provider limits are monthly. For tighter limits per run or per day, you can send requests through a proxy that checks a budget before forwarding each one. That's what CostLatch does (disclosure: CostLatch is my product, and this is its site):

FAQ

Does revoking a key stop charges immediately?

Revoking (OpenAI) or deleting or disabling (Anthropic) is how both providers say to stop a compromised key, and new requests using it should then be rejected. Usage made before that can still appear on your usage page and be billed afterwards, so check again later.

Is a spend limit enough on its own?

It's the most important backstop, but it's monthly. OpenAI says enforcement isn't instantaneous, so spend can slightly exceed it [O1]. Pair it with one key per app, expiring keys and keeping keys out of client code.

Will OpenAI or Anthropic refund unauthorized usage?

The pages cited here don't promise a refund. Contact the provider's support with your evidence (key name or ID, time window and unrecognised usage, but never the key itself) and ask.

Can a proxy like CostLatch stop a stolen key?

Only for traffic that goes through it. A stolen provider key used directly bypasses any proxy. A proxy adds per-run and daily caps for your own apps and agents on top of the provider's limit.

Do I need a separate key for each tool?

It's good practice, and Anthropic recommends separate keys for different purposes [A4]. If one tool or app leaks a key, you revoke just that key and the rest keep working.

†CostLatch checks your budget before forwarding each request. Spend can still slightly exceed a cap, for example from requests already in progress or running at the same time, or where our cost estimate differs from the provider's final charge. Keep your provider's own limits on too. See our Terms (cl 3.3).

CostLatch is not affiliated with or endorsed by OpenAI or Anthropic. OpenAI and Anthropic are trademarks of their respective owners.

General information, not security or legal advice. Provider steps were checked against the linked pages on 19 Oct 2026 and can change.