Kimi API Key — How to Get and Use Your API Key
Quick Answer
To get a Kimi API key, visit platform.moonshot.cn and create an account. After email verification, navigate to the API Keys section, click Generate New Key, and copy it immediately. The kimi api key is shown only once. Store it in your environment variables. Free accounts receive starter credits automatically.
What is a Kimi API Key
A kimi api key is a unique authentication token that identifies your account when making API requests to Moonshot AI's servers.
Every API call requires a valid kimi 2.5 api key or kimi k2.5 api key in the Authorization header.
The key format starts with sk- followed by a long alphanumeric string.
How to Get Your Kimi API Key
- Step 1: Sign up — Visit platform.moonshot.cn and create a new account
- Step 2: Verify email — Click the verification link in your inbox
- Step 3: Access API Keys — Navigate to Dashboard → API Keys
- Step 4: Generate key — Click "Generate New Key" and name it (e.g., "development")
- Step 5: Copy immediately — The kimi ai api key is displayed only once
- Step 6: Test — Verify with a simple API call (see below)
Using Your Kimi API Key
curl https://api.moonshot.cn/v1/models \
-H "Authorization: Bearer sk-your-kimi-api-key" If successful, this returns a list of available models. If you get a 401 error, double-check your key and ensure it hasn't been revoked.
# Linux/macOS
export KIMI_API_KEY="sk-your-kimi-api-key"
# Windows PowerShell
$env:KIMI_API_KEY="sk-your-kimi-api-key"
# .env file (for frameworks)
KIMI_API_KEY=sk-your-kimi-api-key Key Management Best Practices
- Never expose your kimi api keys in client-side code, GitHub repos, or public forums
- Use .env files — Add
.envto your.gitignore - Rotate regularly — Generate new keys monthly and revoke old ones
- Separate environments — Use different keys for dev/staging/production
- Monitor usage — Check your Moonshot dashboard for unexpected activity
Frequently Asked Questions About Kimi API
Is Kimi API key free?
Yes. Creating a Moonshot account and generating a Kimi API key is completely free. You also receive free tier credits to start making API calls without any payment. No credit card is required for initial key generation.
How to get Kimi API key for coding?
Follow the same process: sign up at platform.moonshot.cn, generate an API key, then use it with the OpenAI Python or JavaScript SDK. Set base_url to api.moonshot.cn/v1 and specify model 'kimi-k2-5' for coding tasks.
Can I regenerate my Kimi API key?
Yes. You can generate new API keys and revoke old ones at any time from your Moonshot dashboard. It's recommended to rotate keys regularly for security. Each account can have multiple active keys simultaneously.
How many API keys can I create?
Moonshot allows multiple API keys per account. Use separate keys for different environments (development, staging, production) or different applications to track usage independently.
My Kimi API key is not working — what do I do?
Check that you're using the correct base URL (api.moonshot.cn/v1), the key hasn't been revoked, and your account has available credits. Ensure the Authorization header format is 'Bearer your-key'. Contact Moonshot support if issues persist.
Summary
Getting a kimi api key is free and takes under 2 minutes. Once you have your key, head to our Code Integration guide for working examples in Python, JavaScript, and cURL. For authentication details, see the Authentication Reference.