How OpenAI, Anthropic and Google API keys are structured

If you want to find leaked keys — in your own build, your CI, or a scan — it helps to know what they actually look like. Provider keys follow fixed shapes.

The prefixes

Why naive detection fails

A rule like "sk- then 40+ alphanumerics" seems reasonable and is badly wrong. Minified JavaScript bundles (React Native's index.android.bundle) are full of identifiers like sk-lam…usic (87 letters, no hyphen) that match it. We found that every naive OpenAI hit in a real corpus was a false positive from exactly this.

The fix is to anchor on structure. Real OpenAI keys contain the marker T3BlbkFJ — the base64 encoding of "OpenAI" — present in legacy, project and service-account keys alike. Requiring it is the approach gitleaks and trufflehog use: it trades recall on very old keys for near-zero false positives, which is what you want when a false alarm wastes real effort.

Detecting without touching

Good detection reports the key type and never the value, and never makes a request to see if a key is "live" — that would be using someone else's credential. Our APK scanner works this way: types only, nothing stored. Read more: Your API key ships inside your app — and anyone can read it.

Stop shipping your API key inside your app.

Swap the base URL, keep the provider's native API, and let the proxy inject your key server-side.

Start free