git log -p | grep "sk-". If that command returns anything, your key is in your Git history. This 20-minute checklist can save you from a surprise bill.
A leaked API key is an open credit card — someone can burn your balance in hours. And the most common leak isn't a hack: it's the developer.
The 4 most common mistakes:
- Key in frontend code — anyone can open DevTools and copy it. Calls to AI providers must come from the backend, period.
-
Key committed to Git —
git log -p | grep "sk-". Use.gitignore, secret scanners (gitleaks/trufflehog), and rotate the key now. - Key in unprotected env vars — env vars are the minimum, not security. Use a secret manager and least-privilege keys.
- No spending limit — set a cost ceiling on the provider/gateway so a leak has limited damage.
Quick checklist:
- No keys in frontend code
-
.envin.gitignore - Keys rotated if ever exposed
- Spending limit configured
- Access audited
Key security is 20 minutes of work that prevents a nasty surprise bill.
Want to try these models in your project? **ModelKiwi* gives you access to GPT, Claude and Gemini with PIX payment (no international credit card needed) and free credits to start: https://www.modelkiwi.com. WhatsApp: +5521999500402 — and join our channel: https://t.me/ModelkiwiOfficial.*
Top comments (0)