# Kimi API key: how to get one, add $1 and make your first call

> Create the key in the Kimi API Platform console, recharge at least $1 so it works, then call kimi-k3.1-pro at api.moonshot.ai. Steps, tiers and error fixes from Moonshot's docs.

URL: https://claudegpt.si/news/kimi-api-key-how-to-get  
Published: 2026-11-27T14:56:41.941Z  
Author: ClaudeGPT Si Newsroom  
Section: Guides  
Topics: Moonshot AI, Kimi, Kimi K3.1 Pro, API keys, How to  
Publisher: ClaudeGPT Si

## Key takeaways

- Create a Kimi API key under API Keys in the console at platform.kimi.ai; new keys start with sk-ms- and can be set to expire.
- The key works only after a recharge of at least $1, and total recharges set the rate limit tier, from 3 requests a minute at $1 to 300 at $3,000.
- Call the API at https://api.moonshot.ai/v1 in OpenAI format or https://api.moonshot.ai/anthropic in Anthropic format, with the model kimi-k3.1-pro.

To get a Kimi API key, sign in to the [Kimi API Platform](https://platform.kimi.ai/), open [API Keys](https://platform.kimi.ai/console/api-keys) in the console and create a key. Before the key does anything, you have to add at least $1 to the account: Moonshot AI's [rate limits page](https://platform.kimi.ai/docs/pricing/limits.md) says a minimum recharge of $1 is required to start using the API.

This guide is for developers who want to call Kimi K3.1 Pro or Kimi K3 from their own code or tools. At the end you will have a key, a funded account and a working request. Every step comes from Moonshot's [quickstart](https://platform.kimi.ai/docs/get-your-api-key.md) and platform docs, read on November 27, 2026. The old address, platform.moonshot.ai, now redirects to platform.kimi.ai, so guides that mention either one point to the same console. The button labels below are the ones the docs and their screenshots show.

## What you need first

- An account on the Kimi API Platform. The docs say you create the key "after signing up", and the platform is pay as you go with no subscription.
- At least $1 to put on the account. Prices exclude taxes, which Moonshot calculates at checkout based on where you are.
- Python 3.9 or later, or Node.js 18 or later, with OpenAI SDK 1.0.0 or later. Or just `curl`.

One thing to get straight before you start. The Kimi API Platform is a separate product from the Kimi app membership and from Kimi Code. Moonshot's [product comparison](https://platform.kimi.ai/docs/guide/product-plans.md) says the Kimi Code API "is independent from the API service on this platform, and the two are not interchangeable". A Kimi Code subscription does not give you a platform API key, and a platform key does not draw on a Kimi Code subscription.

## How to get a Kimi API key

1. Go to [platform.kimi.ai](https://platform.kimi.ai/) and sign in.
2. Open the console. In the left navigation, **API Keys** sits under **Organization**. The direct link is [platform.kimi.ai/console/api-keys](https://platform.kimi.ai/console/api-keys).
3. Create a key. New keys are version 2 keys and start with `sk-ms-`.
4. While you create it, choose when it expires: 3 hours, 1 day, 7 days, 30 days, a custom date, or never. You can't change this later, and an expired key can't be brought back.
5. Copy the key and keep it somewhere safe. Moonshot's docs say not to share it or hard-code it in your application.
6. Store it in an environment variable. Moonshot's own examples read it from `MOONSHOT_API_KEY`:

```bash
export MOONSHOT_API_KEY="YOUR_KIMI_API_KEY"
```

Each key belongs to a project, and each project belongs to an organization. Your account starts with a project named "default". According to the [organization guide](https://platform.kimi.ai/docs/guide/org-best-practice.md), a standard organization can have 20 projects and 50 API keys; an enterprise-verified one gets 50 and 100. All projects share one balance and one set of rate limits, but usage is tracked per project, so a separate key per app or per environment makes the bill easier to read.

## How to add funds so the key works

Open **Recharge** under **Billing** in the console and add at least $1. Three rules from the docs matter here:

- The minimum to start is $1. Moonshot's [K3.1 Pro guide](https://platform.kimi.ai/docs/guide/kimi-k3-1-pro-quickstart.md) says the flagship model "is unlocked after a successful top-up (minimum $1)".
- When your total recharges reach $5, you get a $5 voucher. Vouchers don't count toward your total recharge.
- When your available balance is $0 or less, inference calls fail with `exceeded_current_quota_error`.

How much you have put in over time also sets your rate limits. These are the tiers on the rate limits page as of November 27, 2026:

| Tier | Total recharged | Concurrency | Requests per minute | Tokens per minute | Tokens per day |
| --- | --- | --- | --- | --- | --- |
| Tier0 | $1 | 1 | 3 | 500,000 | 1,500,000 |
| Tier1 | $10 | 15 | 100 | 2,000,000 | Unlimited |
| Tier2 | $20 | 40 | 100 | 3,000,000 | Unlimited |
| Tier3 | $100 | 50 | 200 | 3,000,000 | Unlimited |
| Tier4 | $1,000 | 60 | 200 | 4,000,000 | Unlimited |
| Tier5 | $3,000 | 100 | 300 | 5,000,000 | Unlimited |

Tier0 allows 3 requests a minute and one at a time. That is enough to test a key, not to run a coding agent. If you plan to point Claude Code or another agent at Kimi, Tier1 at $10 is the realistic starting point.

## How to make your first call with the key

The API speaks three formats. Use the base URL that matches your tool:

| Format | Base URL | Works with |
| --- | --- | --- |
| Chat Completions (OpenAI) | `https://api.moonshot.ai/v1` | OpenAI SDK, most tools that accept a custom OpenAI endpoint |
| Responses (OpenAI) | `https://api.moonshot.ai/v1` | Codex and other Responses API clients |
| Messages (Anthropic) | `https://api.moonshot.ai/anthropic` | Anthropic SDK, Claude Code |

Install the SDK:

```bash
pip install --upgrade 'openai>=1.0'   # Python
npm install openai@latest             # Node.js
```

Then send a request. This is the quickstart's Python example with a shorter system prompt:

```python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["MOONSHOT_API_KEY"],
    base_url="https://api.moonshot.ai/v1",
)

completion = client.chat.completions.create(
    model="kimi-k3.1-pro",
    messages=[
        {"role": "system", "content": "You are Kimi, an AI assistant provided by Moonshot AI."},
        {"role": "user", "content": "Hi, my name is Li Lei. What is 1+1?"},
    ],
)

print(completion.choices[0].message.content)
```

The same call with `curl`:

```bash
curl https://api.moonshot.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -d '{
        "model": "kimi-k3.1-pro",
        "messages": [
          {"role": "user", "content": "Hi, my name is Li Lei. What is 1+1?"}
        ]
      }'
```

K3.1 Pro always thinks before it answers. The `reasoning_effort` field takes `low`, `high` or `max`, and the default is `max`, which uses the most output tokens. Set it to `low` while you test.

To check that the key works without spending tokens, ask for your balance. The [balance endpoint](https://platform.kimi.ai/docs/api/balance.md) returns your available, voucher and cash balances in US dollars:

```bash
curl https://api.moonshot.ai/v1/users/me/balance \
  -H "Authorization: Bearer $MOONSHOT_API_KEY"
```

## What a Kimi API call costs

The [pricing page](https://platform.kimi.ai/docs/pricing/chat.md) lists these rates per million tokens as of November 27, 2026. All three models have a 1,048,576-token context window and no price tiers by prompt length.

| Model | Input | Output | Cached input |
| --- | --- | --- | --- |
| `kimi-k3.1-pro` | $2.00 | $10.00 | $0.20 |
| `kimi-k3.1-pro-highspeed` | $4.00 | $20.00 | $0.20 |
| `kimi-k3` | $3.00 | $15.00 | $0.30 |

The Batch API bills `kimi-k3.1-pro` and `kimi-k3` at 60% of these prices. For cache-write prices and how they compare with OpenRouter, see the [Kimi K3.1 Pro pricing](https://claudegpt.si/news/kimi-k3-1-pro-pricing) page.

If you are new to the platform, skip the K2 models. Moonshot says they closed to newly registered users on October 31, 2026, and will be retired by the end of December 2026.

## How to use the key in Claude Code

Moonshot's [Claude Code guide](https://platform.kimi.ai/docs/guide/claude-code-kimi.md) uses the Anthropic-format endpoint. Put these in the `env` block of `~/.claude/settings.json` and restart Claude Code:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
    "ANTHROPIC_MODEL": "kimi-k3[1m]"
  }
}
```

The full example in the guide also sets the Opus, Sonnet, Haiku, Fable and subagent model variables to the same model. The guide warns that this file holds your key in plain text, so keep it out of git, and remove old `ANTHROPIC_*` exports from `~/.zshrc` or `~/.bashrc` that would conflict.

## Common errors with a new Kimi API key

These come from Moonshot's [error code page](https://platform.kimi.ai/docs/api/errors.md).

- **401, `invalid_authentication_error` or `incorrect_api_key_error`.** The key is missing, mistyped, disabled, deleted or expired. Check the header reads `Authorization: Bearer <key>`. Keys from platform.kimi.ai don't work on Moonshot's other regional Kimi platforms, and mixing them returns 401.
- **403, "Your IP is not allowed to access this organization".** A v2 key can carry an IP allowlist. Add your server's public IPv4 address to the access policy or remove the restriction.
- **404, `resource_not_found_error`.** The model name is wrong, or your account tier can't use that model. If you haven't topped up, K3.1 Pro stays locked.
- **429, `exceeded_current_quota_error`.** Your balance is empty. Recharge and try again.
- **429, `rate_limit_reached_error`.** You hit your tier's concurrency, requests, tokens per minute or tokens per day limit. Slow down or recharge into a higher tier.
- **429, `engine_overloaded_error`.** Moonshot's servers are busy. The docs say topping up won't fix it; wait and retry with backoff.

Changes to a v2 key, such as disabling it or editing its IP list, can take up to about 60 seconds to reach the API. If a key you just enabled still fails, wait a minute before you debug.

## Where to go next

Set a daily or monthly budget on the project under **Project Settings**, so a looping script can't drain the balance. Moonshot also sends an email when the balance drops below an alert threshold, $5 by default, which you can change in the console. If you're comparing providers, the guide to [getting an OpenAI API key](https://claudegpt.si/news/openai-api-key-how-to-get) follows the same steps for OpenAI.

## Frequently asked questions

### Is the Kimi API key free?

Creating the key costs nothing, but the API is pay as you go and needs a recharge of at least $1 before you can use it. When your total recharges reach $5, Moonshot adds a $5 voucher.

### What is the Kimi API base URL?

Use https://api.moonshot.ai/v1 for the OpenAI-compatible Chat Completions and Responses APIs, and https://api.moonshot.ai/anthropic for the Anthropic-compatible Messages API.

### Can I use a Kimi API key in Claude Code?

Yes. Moonshot's guide sets ANTHROPIC_BASE_URL to https://api.moonshot.ai/anthropic, ANTHROPIC_AUTH_TOKEN to your key and ANTHROPIC_MODEL to kimi-k3[1m] in ~/.claude/settings.json.

### Does a Kimi Code subscription include an API key?

No. Moonshot says the Kimi Code API is independent from the Kimi API Platform and the two are not interchangeable, so platform keys are billed separately, pay as you go.

## Sources

- [Quickstart](https://platform.kimi.ai/docs/get-your-api-key), Moonshot AI
- [Recharge and Rate Limiting](https://platform.kimi.ai/docs/pricing/limits), Moonshot AI
- [Model Inference Pricing](https://platform.kimi.ai/docs/pricing/chat), Moonshot AI
- [Manage Your Organization in the Console](https://platform.kimi.ai/docs/guide/org-best-practice), Moonshot AI
- [Common Error Codes](https://platform.kimi.ai/docs/api/errors), Moonshot AI
- [Check Balance](https://platform.kimi.ai/docs/api/balance), Moonshot AI
- [Kimi K3.1 Pro quickstart](https://platform.kimi.ai/docs/guide/kimi-k3-1-pro-quickstart), Moonshot AI
- [Use Kimi K3.1 Pro in Claude Code](https://platform.kimi.ai/docs/guide/claude-code-kimi), Moonshot AI
- [Use Kimi K3.1 Pro in Codex](https://platform.kimi.ai/docs/guide/codex-kimi), Moonshot AI
- [Compare with Other Kimi Products](https://platform.kimi.ai/docs/guide/product-plans), Moonshot AI
