API Key Setup8 min readUpdated: 2026-07-21

How to Get a Kimi K3 API Key (July 2026)

Kimi K3 is Moonshot AI's latest flagship — 2.8 trillion parameters, 1M context window, open-source weights releasing July 27. This guide walks through registration, key creation, your first API call, common error fixes, and a pricing comparison.

1) What is Kimi K3?

On July 16, 2026, Moonshot AI officially released Kimi K3 at the World Artificial Intelligence Conference (WAIC). With 2.8 trillion total parameters, it is currently the world's largest open-source AI model. K3 is built on KDA (Kimi Delta Attention), a hybrid linear attention architecture, natively supports vision understanding, and features a 1 million token context window.

In benchmark tests, Kimi K3 matches Claude Opus-class performance on coding, reasoning, and long-context tasks. Moonshot AI has committed to releasing the full model weights before July 27, 2026, allowing anyone to download, run locally, and fine-tune the model freely.

2) Register on Moonshot AI Open Platform

Visit platform.moonshot.cn and register with your mobile phone number or WeChat account. New users typically receive a starter credit of around CNY 15 to use for testing — enough to run several hundred thousand tokens.

Real-name verification (实名认证) is required to unlock full quota and billing access. This is standard for Chinese AI platforms. You can start with the signup credit before completing verification.

3) Create your API Key

After logging in, click "API Key Management" (API Key 管理) in the left sidebar. Click "New" (新建), give the key a descriptive name — for example your project name — then click Confirm.

The key is shown in full only once, immediately after creation. Copy it right away and store it securely in a password manager or secrets vault.

  • Go to platform.moonshot.cn/console/api-keys
  • Click "New" (新建) → enter a key name → click Confirm
  • Copy the key immediately — it will not be shown again

4) Your first Kimi K3 API call

Kimi K3's API is compatible with the OpenAI chat completions format. The base URL is https://api.moonshot.cn/v1 and the model ID is kimi-k3. If you already use the OpenAI SDK, you only need to change the base URL and API key.

Store MOONSHOT_API_KEY as a server-side environment variable and always call the API from your backend. Never expose the key in frontend JavaScript, mobile apps, or public source repositories.

python
from openai import OpenAI
import os

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

response = client.chat.completions.create(
    model="kimi-k3",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Summarize the key features of Kimi K3."}
    ]
)

print(response.choices[0].message.content)

Python — using the OpenAI SDK with Moonshot AI's base URL

javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.MOONSHOT_API_KEY,
  baseURL: "https://api.moonshot.cn/v1",
});

const response = await client.chat.completions.create({
  model: "kimi-k3",
  messages: [
    { role: "system", content: "You are a helpful assistant." },
    { role: "user", content: "What is Kimi K3's context window size?" }
  ]
});

console.log(response.choices[0].message.content);

JavaScript / Node.js — same OpenAI-compatible pattern

bash
curl https://api.moonshot.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MOONSHOT_API_KEY" \
  -d '{
    "model": "kimi-k3",
    "messages": [
      {"role": "user", "content": "Hello, Kimi K3!"}
    ]
  }'

cURL — quick smoke test to verify your key works

5) Common errors and how to fix them

Most errors when calling the Kimi API fall into three categories: authentication failures (401), rate limit exceeded (429), and context length issues (400). Here is how to diagnose and fix each.

A 401 error almost always means the key was not passed correctly. Check that your Authorization header is exactly Bearer <space> <key>, and that MOONSHOT_API_KEY contains no extra whitespace from copy-paste.

  • 401 Unauthorized → check MOONSHOT_API_KEY is set and free of leading/trailing spaces
  • 401 Unauthorized → verify Authorization: Bearer <space> <key> header format
  • 429 Too Many Requests → add exponential backoff; check your quota limits at platform.moonshot.cn/console/limits
  • 400 Bad Request (context too long) → Kimi K3 supports up to 1M tokens; split your input if it exceeds max_tokens
  • 400 Bad Request (invalid model) → model ID must be exactly kimi-k3 (lowercase, hyphen)

6) Pricing — K3 vs K2.5 vs Claude Sonnet 5

Kimi K3 is priced at $3 per million input tokens (cache miss), $0.30 per million input tokens (cache hit), and $15 per million output tokens. The full 1M token context window has no per-length surcharge — every request is billed at the same flat rate regardless of context size.

This pricing matches Claude Sonnet 5 and is significantly higher than Kimi K2.5 ($0.60/$2.50 per million tokens). Moonshot AI has intentionally positioned K3 as a frontier model, not a budget option. For cost-sensitive workloads that do not need K3's full capability, K2.5 remains available.

  • Kimi K3: $3 input (cold) / $0.30 input (cached) / $15 output — per million tokens
  • Kimi K2.5: $0.60 input / $2.50 output — per million tokens
  • Claude Sonnet 5: $3 input / $15 output — per million tokens
  • K3 unique advantage: 1M context window at flat rate, no length surcharge

FAQ

When will Kimi K3 open-source weights be available?

Moonshot AI announced that complete model weights will be released before July 27, 2026. Until then, K3 is accessible via the official API. The technical report will also be published alongside the weights.

Is Kimi K3 compatible with the OpenAI SDK?

Yes. Moonshot AI's API follows the OpenAI chat completions format. Change the base URL to https://api.moonshot.cn/v1, set MOONSHOT_API_KEY, and use model ID kimi-k3. Most existing OpenAI SDK code works without changes.

Does K3 charge extra for using the full 1M context window?

No. Kimi K3 uses a flat per-token rate regardless of context length. There is no surcharge for using the full 1M token window, which is unusual among frontier models.

Can I use K3 without real-name verification?

New users can start testing with the signup credit (around CNY 15) before completing real-name verification. Full quota access and the ability to top up credits require completing verification.

Related Providers

Sources