Create your first API key
Generate a ToRouter API key from the portal and use it with any OpenAI-, Anthropic- or Gemini-compatible SDK.
An API key authenticates every request you send to ToRouter. Keys are scoped to your account and inherit limits from the group you have subscribed to.
Open the API Keys page
Go to portal.torouter.ai → API Keys in the sidebar. You must be signed in with a verified email.
Click "Create key"
Give the key a name you'll recognise (e.g. cursor-laptop, prod-backend). Optional fields:
- Quota — USD spend cap for this key (
0= unlimited within group quota) - Expires in days — auto-disable after N days (
0= no expiry) - Rate limits — requests per 5 hours / 1 day / 7 days
- IP whitelist / blacklist — CIDR rules (see IP restrictions)
- Model whitelist — comma-separated model IDs (see Model whitelist)
All limits can be edited later. Leave them empty to inherit your group's defaults.
Copy the key
The full key is shown once. It looks like sk-***. Paste it into your password manager or .env file immediately.
ToRouter never displays the key plaintext again — only the first/last few characters. If you lose it, rotate it.
Make a request
curl https://portal.torouter.ai/v1/chat/completions \
-H "Authorization: Bearer sk-***" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5","messages":[{"role":"user","content":"hi"}]}'A 200 response means the key works. Errors? See Troubleshooting.