How to Get an LLM API Key: OpenAI, Claude, Gemini, DeepSeek, Qwen, Kimi, GLM and More
TL;DR: Every LLM API key follows the same path — open the vendor console, create a key, set up billing and check region rules, then send a first request; this page compares 10 vendors from their official docs.
Every LLM API starts with the same chore: find the console, create a key, work out billing and region rules, and make a first call. This page compares ten providers side by side, using only what their official documentation says (checked 2026-10-20), and links to a step-by-step guide for each.
Count tokens before you spend →All guides
Comparison table
“Not stated” means the official pages we checked do not say — not that the answer is no. Region notes repeat the vendors’ own wording; they are not legal advice.
Where to get the key, and how to call it
| Provider | Console / key page | Base URL | Env var | Sample model |
|---|---|---|---|---|
| OpenAI | platform.openai.com/api-keys | https://api.openai.com/v1 | OPENAI_API_KEY | gpt-6-astra |
| Anthropic | platform.claude.com/settings/keys | https://api.anthropic.com (native) | ANTHROPIC_API_KEY | Not given on the pages we checked |
| Google Gemini | aistudio.google.com/apikey | generativelanguage.googleapis.com (native) | GEMINI_API_KEY or GOOGLE_API_KEY | gemini-3.8-flash |
| DeepSeek | platform.deepseek.com/api_keys | https://api.deepseek.com | DEEPSEEK_API_KEY | deepseek-flash |
| Bailian (Beijing) | bailian.console.aliyun.com | https://dashscope.aliyuncs.com/compatible-mode/v1 | DASHSCOPE_API_KEY | qwen-plus |
| Bailian (Singapore) | modelstudio.console.alibabacloud.com | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 | DASHSCOPE_API_KEY | qwen-plus |
| Xiaomi MiMo | platform.xiaomimimo.com | https://api.xiaomimimo.com/v1 | MIMO_API_KEY | mimo-v2.6-pro |
| Moonshot Kimi | platform.kimi.com/console/api-keys | https://api.moonshot.cn/v1 | MOONSHOT_API_KEY | kimi-k3 |
| Zhipu (bigmodel.cn) | bigmodel.cn/usercenter/proj-mgmt/apikeys | https://open.bigmodel.cn/api/paas/v4 | Not prescribed | glm-5.3 |
| Z.ai | z.ai/manage-apikey/apikey-list | https://api.z.ai/api/paas/v4/ | Not prescribed | glm-5.3 |
| Volcengine Ark | Ark console → API Key 管理 | https://ark.cn-beijing.volces.com/api/v3 | ARK_API_KEY | doubao-seed-1-6-251015 |
| OpenRouter | openrouter.ai/settings/credits | https://openrouter.ai/api/v1 | OPENROUTER_API_KEY | ~openai/gpt-sol-latest |
Sign-up rules and free quota
| Provider | Mainland-China signup note (official wording) | Free quota (verified) |
|---|---|---|
| OpenAI | Mainland China, HK, Macau not on the supported-countries list | Free usage tier ($100/month cap) in allowed geographies; credit amount not stated |
| Anthropic | Mainland China, HK, Macau not on the supported-regions list | Not stated in the docs we checked |
| Google Gemini | Mainland China, HK, Macau not on the available-regions list; 18+ | Free Tier on some models; $300 GCP credit not usable |
| DeepSeek | No regional restriction mentioned in the docs | Granted balance is used first; amount not stated |
| Bailian (Beijing) | Free quota needs no real-name; pay-as-you-go needs real-name + top-up | Usually 1M tokens per model, 90 days (Beijing models) |
| Bailian (Singapore) | Complete account information first (since 2026-09-15) | Usually 1M tokens per model, 90 days (Singapore, International scope) |
| Xiaomi MiMo | Xiaomi account (mobile sign-up); real-name before top-up | “Welcome Bonus” page exists; amount not verified |
| Moonshot Kimi | Personal verification before top-up | ¥15 voucher after verification (not for Kimi K3) |
| Zhipu (bigmodel.cn) | API calls don’t currently require real-name | Not stated in the docs we checked |
| Z.ai | Not stated in the docs we checked | Not stated in the docs we checked |
| Volcengine Ark | Real-name + enable the model after the free quota | New-user free inference quota per model (online inference only) |
| OpenRouter | No regional restriction mentioned; accepts AliPay | Small free allowance + :free models |
Step-by-step guides
- OpenAI — API Dashboard, usage tiers, Responses API
- Anthropic Claude — Claude Console, one-time key display, required headers
- Google Gemini — AI Studio, auth keys, Free Tier vs prepaid billing
- DeepSeek — open platform, balance rules, per-account concurrency
- Alibaba Cloud Model Studio (Bailian) — Beijing vs Singapore sites, free quota, real-name rules
- Xiaomi MiMo — Xiaomi account, domestic vs overseas, Token Plan keys
- Moonshot Kimi — verification, ¥15 voucher, top-up tiers
- Zhipu GLM / Z.ai — bigmodel.cn and z.ai, plan vs standard keys
- Volcengine Ark (Doubao) — API Key 管理, enabling models, free inference quota
- OpenRouter — credits, AliPay, free models
Region gotchas
- OpenAI, Anthropic and Google Gemini do not list mainland China, Hong Kong or Macau as supported. OpenAI explicitly warns that access from outside its list may get an account blocked or suspended. Gemini also requires users to be 18+, and in Colab it goes by the runtime’s region.
- Keys are often tied to a region or site. Alibaba Bailian keys, domains and models cannot be mixed between Beijing and Singapore. Xiaomi MiMo’s domestic and overseas accounts have separate keys and base URLs. Zhipu runs bigmodel.cn and z.ai as separate platforms.
- Real-name verification is common on Chinese platforms, but timing differs: Bailian (China site) only needs it after the free quota; MiMo and Kimi need it before you top up; Volcengine needs it after the free quota (and models must be enabled); Zhipu does not currently require it for API calls.
- “Free” has fine print. Google’s $300 Cloud credit cannot pay for the Gemini API (accounts opened after 2 March 2026); Kimi’s ¥15 voucher does not cover Kimi K3; Volcengine’s free quota does not cover batch inference; Bailian Singapore rolls into pay-as-you-go by default when the quota runs out.
Key safety basics
- Use environment variables. Every provider here documents one (Zhipu recommends one without naming it). SDKs such as OpenAI’s and Anthropic’s read theirs automatically.
- Never commit keys. Keep them in a
.envfile that is listed in.gitignore, or in a secrets manager (Anthropic’s recommendation). Google says plainly: don’t commit keys to Git. - Keep keys out of browsers and mobile apps. OpenAI and Google say not to expose keys in client-side code; Alibaba Bailian offers short-lived temporary keys (up to 1,800 seconds) for that case.
- Restrict what a key can do. Gemini keys should be restricted to the Gemini API; Bailian keys can be limited to IPs and models; Volcengine keys to Model IDs, endpoints and IPs.
- Rotate, and replace leaks immediately. Create the new key first, switch your app over, then revoke or disable the old one (Google’s documented order). OpenAI says revocation takes effect within seconds. Keys that are shown only once (Anthropic, newer Bailian keys) cannot be recovered — just make a new one.
- More keys do not mean more quota. DeepSeek, Kimi and OpenRouter count limits per account or user, not per key.
# .env (add ".env" to .gitignore before your first commit)
OPENAI_API_KEY=...
DEEPSEEK_API_KEY=...
# shell: load it for this session only
export DEEPSEEK_API_KEY="paste-your-key-here"
# check nothing secret is staged before you commit
git diff --cached | grep -nE 'sk-|API_KEY=' && echo "STOP: a key is staged"
Before you top up
Once a key works, the next question is what it will cost. Paste a real prompt into the token counter to see per-request cost across models, then use the LLM cost calculator for a monthly estimate with caching and off-peak options. Our API price comparison explains the price tables.
FAQ
Which providers can I sign up for from mainland China?
OpenAI, Anthropic and Gemini do not list mainland China as supported. The Chinese platforms here (Bailian, MiMo, Kimi, Zhipu, Volcengine) document mainland sign-up with real-name rules; DeepSeek’s and OpenRouter’s docs do not mention regional restrictions.
Which ones offer free usage?
Verified on official pages: Gemini’s Free Tier, Bailian’s new-user quota (usually 1M tokens per model for 90 days), Volcengine’s free inference quota, Kimi’s ¥15 voucher after verification, OpenRouter’s small allowance and :free models, and OpenAI’s Free usage tier. Others either don’t state an amount or we could not verify it.
Can one key work across providers?
Only through an aggregator such as OpenRouter, which puts many providers behind one key and one OpenAI-compatible base URL. Otherwise each provider issues its own keys.
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.
- OpenAI — Supported countries and territories
https://developers.openai.com/api/docs/supported-countries - OpenAI — Developer quickstart
https://platform.openai.com/docs/quickstart - Claude Docs — Get an API key
https://platform.claude.com/docs/en/get-api-key - Claude Docs — Supported regions
https://platform.claude.com/docs/en/api/supported-regions - Google AI for Developers — Using Gemini API keys
https://ai.google.dev/gemini-api/docs/api-key - Google AI for Developers — Available regions
https://ai.google.dev/gemini-api/docs/available-regions - Google AI for Developers — Billing
https://ai.google.dev/gemini-api/docs/billing - DeepSeek API Docs — Your first API call
https://api-docs.deepseek.com/ - 阿里云百炼 — 获取 API Key
https://help.aliyun.com/zh/model-studio/get-api-key - 阿里云百炼 — 新人免费额度
https://help.aliyun.com/zh/model-studio/new-free-quota - Alibaba Cloud Model Studio — Obtain an API key
https://www.alibabacloud.com/help/en/model-studio/get-api-key - Xiaomi MiMo — First API call
https://mimo.mi.com/docs/en-US/quick-start/summary/first-api-call - Xiaomi MiMo — Account FAQ
https://mimo.mi.com/docs/en-US/quick-start/faq/account - Kimi 开放平台 — 快速开始
https://platform.kimi.com/docs/get-api-key - Kimi 开放平台 — 账号与财务
https://platform.kimi.com/docs/guide/account-and-payments - 智谱 BigModel — 快速开始
https://docs.bigmodel.cn/cn/guide/start/quick-start - Z.ai — Quick Start
https://docs.z.ai/guides/overview/quick-start - 火山方舟 — 获取 API Key 并配置
https://www.volcengine.com/docs/82379/1541594 - 火山方舟 — 免费推理额度
https://www.volcengine.com/docs/82379/1399514 - OpenRouter — Quickstart
https://openrouter.ai/docs/quickstart - OpenRouter — FAQ
https://openrouter.ai/docs/faq