Keys / OpenAI

OPENAI_API_KEY

The key your app calls the OpenAI API with.

Expires
you choose, or never
API
create service-account keys, list and delete, with an admin key

Get it

Recorded 2026-11-16 on platform.openai.com/api-keys

  1. Open API keys and click Create new secret key.
  2. Type a name for the key.
  3. Open the Expiration menu.
  4. Choose when the key expires, such as 30 days.
  5. Click Create secret key, then copy the key.

Set it

OPENAI_API_KEY=...

The Python, Node.js, Go and Ruby SDKs read it when you don't pass a key, and the Java SDK reads it in fromEnv(). Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Create a replacement key. Choose Service account under Owned by, since keypin rotate refuses a key owned by a user.
  2. Update every app that uses the old key.
  3. Check that the new key works, then revoke the old one.
Sources, checked 2026-11-16