7 minutes

Create your first API key

Create an API key in the target workspace, cap what it can spend, and store the secret safely.

Your apps and tools authenticate to OpenRouter with an API key. Because every key belongs to a specific workspace, and inherits that workspace’s routing, presets, and guardrails, start by switching to the workspace you want the key to live in.

  1. Open the target workspace (such as Default or your project’s workspace).
  2. Go to API keys in the workspace sidebar and choose Create.
  3. Enter a descriptive Name, like support-bot-staging, so you can spot its traffic in Activity and Logs.
  4. Choose an Owner. Keep Me for personal development. Admins can also assign a key to a Teammate or make it a Workspace key, which stays active even if an individual leaves the team, making it a better fit for production services.
  5. Set an Expiration if the key is temporary. Keys with no expiration stay active until you delete them.
  6. Under Key limit, set a Credit limit and an optional reset schedule (daily, weekly, or monthly at midnight UTC). You can also choose whether Bring Your Own Key (BYOK) spend counts toward this cap.
  7. Click Create, then copy the key right away into your password manager or secrets manager. OpenRouter only shows the full secret once.
Anyone with your key can spend your credits

Keys start with sk-or-. Anyone who has the key can spend your credits up to its limit, so keep it out of source control, tickets, and chat messages. If you lose a key or it leaks, delete it on the API keys page, create a new one, and check Activity for spend you don’t recognize.

Check your understanding

You’re creating a key for a nightly test job that should never cost more than $5 a day. Which settings matter most?

Takeaway

Create each key in the workspace it belongs to, give it a clear name and a credit limit, and save the secret immediately. If you lose or expose a key, delete it and create a new one.

Try it live

Optional

Create a key with a $1 daily limit named after what you plan to build. You’ll use it in the next lesson.