When your app was a side project, one .env file with an OpenAI key was fine. The moment a second engineer joins, that setup turns into a small disaster: keys leak into git, a junior's experiment blows the budget, and no one knows who spent what.
Here's the system we ended up with after burning two budgets and rotating three keys.
1. Never share one key across the team
The instinct is to put the production key in 1Password and call it a day. The problem:
You can't revoke one person's access without killing everyone's
You can't attribute spend
When that key leaks (and it will), you rotate it for the whole team
Give each developer their own key. Scope it down.
2. Separate environments from users
Two axes to think about:
Axis Values
Environment dev / staging / prod
Owner each engineer + CI bots
That's a matrix of keys, not one key. A CI key should never have production write access. An intern's dev key should never work in staging.
3.β¦