How to Get an OpenRouter API Key: Credits, Payment (incl. AliPay), Free Models
TL;DR: OpenRouter gives one OpenAI-compatible API and one key for many vendors’ models: sign up, buy USD credits (Alipay is among the payment options), then create the key.
OpenRouter puts many providers’ models behind one OpenAI-compatible API and one key. You pay in US-dollar credits, so the order is simple: create an account, add credits, then create a key.
Estimate your monthly API cost →All guides
Create the key
- Sign up or sign in at
https://openrouter.ai/sign-in. - Add credits on the Credits page:
https://openrouter.ai/settings/credits. - Create an API key in your account and store it as
OPENROUTER_API_KEY(FAQ).
The pages we checked describe the order (account → credits → keys) but not the exact menu name, the key prefix or whether the key is shown only once — copy it as soon as it appears.
Credits, payment and free use
- Credits are in US dollars. Payment: major credit cards, AliPay, and USDC crypto. A fee is charged when you buy credits (the rate did not render on the page when we checked), while inference is billed at the providers’ prices without markup.
- Unused credits can be refunded if you ask within 24 hours (crypto payments are not refundable). OpenRouter reserves the right to expire credits after one year.
- “All new users receive a small free allowance.” There are many
:freemodels with low daily limits, and theopenrouter/freerouter picks a free model automatically. The exact thresholds did not render when we checked (Limits). - The docs we checked do not mention regional restrictions.
Before you top up, paste a typical prompt into the token counter and estimate a month of traffic with the LLM cost calculator.
Base URL and authentication
- Base URL:
https://openrouter.ai/api/v1— with the OpenAI SDK you only swapbase_urland the key. - Header:
Authorization: Bearer <OPENROUTER_API_KEY>; optionalHTTP-RefererandX-OpenRouter-Titleidentify your app for the rankings. - The quick start uses the alias
~openai/gpt-sol-latest(a “latest” alias) (Quickstart).
Hello world
export OPENROUTER_API_KEY="paste-your-key-here" # never commit this
curl https://openrouter.ai/api/v1/chat/completions \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "HTTP-Referer: https://your-site.example" \
-H "X-OpenRouter-Title: Your App Name" \
-d '{
"model": "~openai/gpt-sol-latest",
"messages": [{"role": "user", "content": "Say hello in one sentence."}]
}'
# HTTP-Referer and X-OpenRouter-Title are optional (used for app rankings).
# Check your key's limits and usage:
curl https://openrouter.ai/api/v1/key -H "Authorization: Bearer $OPENROUTER_API_KEY"
Limits and common errors
- 402 — not enough credits.
- 403 — a budget limit was reached.
- 429 — rate limited.
- Creating more accounts or keys does not raise your limits. Check a key’s status with
GET https://openrouter.ai/api/v1/key. - Safety. Put the key in an environment variable, keep it out of Git and out of any code that runs in a browser or mobile app, and replace it if it is ever exposed. The API keys overview has the full checklist.
FAQ
Can I pay for OpenRouter with Alipay?
Yes — the FAQ lists AliPay alongside major credit cards and USDC.
Is there a free option?
New users get a small free allowance, and :free models (or the openrouter/free router) can be used with low daily limits.
Do credits expire?
OpenRouter reserves the right to expire unused credits after one year; unused credits can be refunded within 24 hours of purchase (not for crypto).
Sources
Vendor features and prices were checked against these official pages on 2026-10-20. Products change; if something here no longer matches, the official page is right.
- OpenRouter — Quickstart
https://openrouter.ai/docs/quickstart - OpenRouter — FAQ
https://openrouter.ai/docs/faq - OpenRouter — API limits
https://openrouter.ai/docs/api_reference/limits