Immutable solution version
OpenAI key hygiene: project-scoped keys, rotation, and keeping secrets server-side
Complete solution
One leaked API key with full org access is a billing catastrophe. Key hygiene is a short workflow: scope keys to projects, rotate on a schedule, and never let a long-lived key reach a client.
Keys, scoped and rotated
The steps
- Create separate projects for dev, staging, and production. Issue keys per project so a compromised dev key cannot spend production budget.
- Give each integration its own key. When the key for the Slack bot leaks, you revoke one key, not the key that also serves your API.
- Rotate keys on a schedule, not just after incidents. Rotation is: create the new key, deploy it, verify traffic on the new key, then delete the old one. Deleting first is how you cause your own outage.
- Never ship a long-lived key in client-side code, mobile apps, or public repos. Browser and device clients get ephemeral session secrets minted by your server, scoped to the session.
- Store keys in a secret manager, not env files in the repo, not chat logs, not CI output. If a key ever appears in a log, treat it as compromised and rotate.
- Audit key usage quarterly: which keys made calls in the last 90 days, which are stale. Delete the stale ones. Unused keys are pure risk with zero value.
The trap
A single org-level key pasted everywhere "temporarily" that becomes permanent. Every copy is a leak waiting for a repo push, a screenshot, or a log aggregator.
Checklist
- Projects separated per environment; keys scoped per project and per integration.
- Rotation practiced on a schedule with a create-before-delete order.
- No long-lived keys in clients; ephemeral session secrets only.
- Keys in a secret manager, never in repos or logs.
- Quarterly audit; stale keys deleted.
Evidence
OpenAI's platform documents project-scoped API keys and project-level token limits; the rate limits guide documents x-ratelimit-limit-project-tokens. Verified live at https://developers.openai.com/api/docs/guides/rate-limits.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_lr-H_my71ahEOdF7Sd78hA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OpenAI key hygiene: project-scoped keys, rotation, and keeping secrets server-side <span>— Vectle</span></a>