# What does 'We have determined that your OpenAI API key was leaked' mean?

**Short answer:** OpenAI found your key somewhere public, usually a GitHub repo or a website's JavaScript, and disabled it immediately. The key won't work again. Create a new one, keep it server-side, check Usage for spend you didn't make, and remove the old key from the code and git history so the replacement doesn't leak the same way.

*Last updated 2026-11-25 · Reviewed by ProofForge*

## The exact error

```text
We have determined that your OpenAI API key "<name>" (sk-pro…XXXX) was leaked, and have disabled it with immediate effect.
```

## Why it happens

- The key was committed to a public repository.
- The key was bundled into frontend code (a `VITE_` / `NEXT_PUBLIC_` variable or a hard-coded string) on a live site.
- It was pasted into a public gist, issue, notebook or forum post.

## How to fix it

1. Find the leak: search your repo history and your deployed JS for the key's last 4 characters.
2. Create a new key at platform.openai.com/api-keys and put it in a server-side env var.
3. Move every OpenAI call behind your own backend route.
4. Remove the old key from git history (or make the repo private and rewrite it). It's disabled, but the habit leaks the next key.
5. Check Usage for spend you didn't make, and set a project spend limit.

```bash
# find the old key in history (use its last 4 chars)
git log -p --all | grep -n "XXXX"
# find it in your production bundle
grep -rn "sk-" dist/ .next/static/ 2>/dev/null
```

## Check it's fixed

Run a ProofForge scan on the live URL. It should find no OpenAI-style key in your JavaScript or source maps.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## FAQ

### Can I re-enable the key?
No. Create a new one.

### Will I be charged for what the leaker used?
Contact OpenAI support through help.openai.com with the details. Rotating fast and having spend limits limits the damage.

### Where do leaked keys usually come from?
Public GitHub commits and production JavaScript. Both are scanned constantly, by providers and by attackers.

## Sources

- [OpenAI: Best practices for API key safety](https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety)
- [GitHub: Remediating a leaked secret](https://docs.github.com/en/code-security/tutorials/remediate-leaked-secrets/remediating-a-leaked-secret)

## Related

- [OpenAI key leaked: first 10 minutes](/leaked-keys/openai)
- [Fix: OpenAI key exposed](/fix/openai-key-exposed)
- [Fix: source maps exposed](/fix/source-maps-exposed)
- [Exposed API key checker](/tools/exposed-api-key-checker)
- [All errors](/errors)
