Keys / OpenRouter
OPENROUTER_API_KEY
The OpenRouter API key your app calls models through OpenRouter with.
- Starts with
sk-or-v1-- Expires
- you choose, or never
- API
- create, list, update and delete, with a management key
Get it
Create one on openrouter.ai/settings/keys. The steps aren't recorded yet.
Set it
OPENROUTER_API_KEY=sk-or-v1-...
The OpenRouter TypeScript, Python and Go SDKs read it from this variable when you don't pass a key. The OpenAI SDKs don't; they fall back to OPENAI_API_KEY. Or keep it out of .env with keypin: keypin run -- npm run dev
Replace it
- Create a new key in the same workspace, with the same credit limit and an expiration.
- Deploy it everywhere that uses the old key. Both keys work in the meantime.
- Check that every app uses the new key, then disable or delete the old one.
keypin rotaterefuses a key with its own guardrail, or a BYOK provider key or observability destination limited to it, since the new key wouldn't get them.