One accidental git push is all it takes to leak your API keys. For AI applications that interface with OpenAI, Anthropic, or other providers, a leaked key can mean thousands of dollars in unauthorized usage within hours.

The Golden Rules

Never hardcode API keys in client code — they're visible to anyone who inspects your bundle

Use environment variables — but know their limitations

Proxy through Server Actions — keep keys server-side only