Is the Kimi K2 API Free? How to Use It at $0

Quick answer: Moonshot's own Kimi K2 API (api.moonshot.ai) is prepaid pay-as-you-go, not free — no permanent no-card tier. But Kimi K2 is an open-weights model, so you can run it at $0 two real ways: Cloudflare Workers AI's free daily allocation and the kimi.com chat app. OpenRouter's :free Kimi variant was retired — all nine Kimi models there are now paid. Self-hosting is free in licensing terms; the GPU hardware is not.

Kimi K2 is a family of open-weights LLMs from Moonshot AI, released with downloadable weights under a Modified MIT license — which is why third parties can host it for free. The line moves fast (K2, K2.5, K2.6, K2.7 Code), so treat every price and rate limit below as a snapshot and confirm the live number before budgeting.

Everything here is grounded in Moonshot's docs at platform.kimi.ai, the technical report on arXiv (2507.20534), and the MoonshotAI/Kimi-K2 repo.

What Is Kimi K2?

Kimi K2 is the developer-facing model line behind Moonshot's Kimi assistant. Three things make it stand out:

  • Mixture-of-Experts at frontier scale. The original K2 is an MoE model with roughly 1 trillion total parameters but only ~32 billion active per token — giant-model knowledge at closer to 32B-dense inference cost.
  • Built for agents. Trained specifically for tool calling, multi-step reasoning, and long autonomous coding sessions, not just chat benchmarks.
  • Genuinely open weights. Checkpoints ship on Hugging Face under a Modified MIT license — inspect, run offline, deploy commercially. That openness is why free hosted endpoints exist.

Benchmarks

From Moonshot's technical report, the original Kimi K2 under a non-thinking evaluation:

BenchmarkKimi K2 (original)What it measures
SWE-bench Verified65.8% (single-attempt, bash/editor tools)Real GitHub bug-fix tasks — agentic coding
Tau2-bench66.1Tool-use in multi-turn agent settings
ACEBench (en)76.5Function/tool calling accuracy

Later flagships K2.5 and K2.6 report substantially higher SWE-bench scores (Moonshot cites K2.6 around the low-80s percent), and K2.7 Code is a coding-specialized variant. Since newest-release numbers are still settling, anchor on the peer-published 65.8% and treat newer scores as "meaningfully better, verify against the current model card." The takeaway: K2 is a frontier-class open model that's especially strong at coding and tool use.

The 3 Ways to Use Kimi K2 for Free

Way 1 — OpenRouter (the :free variant is gone)

OpenRouter still lists nine Kimi models — kimi-k2, kimi-k2-0905, kimi-k2-thinking, kimi-k2.5, kimi-k2.6, kimi-k2.7-code, kimi-k3, kimi-k3:batch and kimi-latest — but as of verified 2026-09-01 not one of them has a :free suffix. The subsidized moonshotai/kimi-k2:free endpoint that most tutorials still reference has been retired. Kimi on OpenRouter is now pay-as-you-go; for $0 inference there, pick from the current free list or use the openrouter/free router.

from openai import OpenAI
import os

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

resp = client.chat.completions.create(
    model="moonshotai/kimi-k2",   # paid; the :free variant was retired
    messages=[
        {"role": "system", "content": "You are a concise coding assistant."},
        {"role": "user", "content": "Write a Python function that flattens a nested list."},
    ],
)
print(resp.choices[0].message.content)

Because it's OpenAI-compatible, the same code talks to any other OpenRouter model — swap the model string for Gemini, DeepSeek, or Llama.

Way 2 — Cloudflare Workers AI (free daily inference)

Cloudflare Workers AI includes a free daily allocation (measured in "Neurons") on every account, no card to start. Grab the exact model slug from the models catalog (IDs look like @cf/moonshotai/... and change with versions), then call the REST API — or use the AI binding inside a Worker, which handles auth for you:

curl https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/ai/run/@cf/moonshotai/kimi-k2 
  -H "Authorization: Bearer $CF_API_TOKEN" 
  -H "Content-Type: application/json" 
  -d '{"messages": [{"role": "user", "content": "Explain the difference between a process and a thread."}]}'

The allocation resets daily — ideal for low-traffic apps, side projects, and edge functions.

Way 3 — kimi.com (free chat, no API)

If you don't need programmatic access, kimi.com serves the current flagship (K2.6-class) with a large context window, file uploads, and web browsing, no credit card. The fastest way to sanity-check quality before wiring up an API — but it's a chat product, not an endpoint.

Bonus — self-host the open weights

Weights are public on Hugging Face, so you can run K2 with vLLM, SGLang, or llama.cpp. The license is free; the hardware is the catch — a 1T-parameter MoE needs serious multi-GPU memory. For most people, Ways 1 and 2 are the realistic free-API paths.

Kimi K2 API Pricing (When You Outgrow Free)

The official Moonshot API is inexpensive by frontier standards — pay-as-you-go on a prepaid balance, USD per 1M tokens. As of mid-2026 the shape looks like this; confirm live numbers at platform.kimi.ai/docs/pricing:

ModelContextInput / 1MOutput / 1MBest for
kimi-k2.6~256K~$0.95~$4.00Flagship general + agentic work
kimi-k2.5~256K~$0.60~$3.00Cheaper capable general model
kimi-k2.7-codelargesee docssee docsAgentic coding specialist
moonshot-v1-*8K–128Ksee docssee docsLegacy general models
  • Automatic context caching. Repeated prompt prefixes are billed at a steep discount on cache hits — roughly $0.10–$0.16 per 1M input depending on model, versus the full cache-miss rate. A large saving for agents that resend a big system prompt every turn.
  • New-account activation. Moonshot typically asks for a small minimum (about $1) to activate API access, with occasional voucher promos around a ~$5 cumulative-recharge threshold. There's no ongoing free token grant — for strictly $0, use Cloudflare Workers AI or kimi.com.

Your First Kimi K2 API Call (OpenAI-Compatible)

The base URL is https://api.moonshot.ai/v1 and the request/response shapes match the OpenAI Chat Completions API — if your code already calls OpenAI, you change two lines. Get a key at platform.kimi.ai (top up the activation minimum, open API Keys). The key is shown once; store it in .env, never commit it.

from openai import OpenAI
import os

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

response = client.chat.completions.create(
    model="kimi-k2.6",
    messages=[
        {"role": "system", "content": "You are a concise technical assistant."},
        {"role": "user", "content": "Write a Python function that returns the nth Fibonacci number iteratively."},
    ],
)

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

The same client works for streaming (stream=True) and JSON-mode (response_format={"type": "json_object"}), exactly as with OpenAI. Model IDs and prices change per release — call GET /v1/models before hardcoding a name.

Kimi K2 in Claude Code, Cline & Aider (Anthropic-Compatible)

This is K2's killer developer feature. Moonshot exposes an Anthropic-compatible endpoint at https://api.moonshot.ai/anthropic, so you can point Claude Code (and any Anthropic-API tool) at Kimi K2 with two environment variables and run a top-tier open coding agent instead of paying frontier prices:

# Point Claude Code at Kimi K2
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="$MOONSHOT_API_KEY"
export ANTHROPIC_MODEL="kimi-k2.6"

# now just run claude as normal
claude

Or persist the same three keys under "env" in ~/.claude/settings.json. For tools that speak the OpenAI shape — Cline, Aider, Continue.dev, OpenWebUI — use https://api.moonshot.ai/v1 with a Kimi model ID instead. Pair either with automatic context caching and a full day of agentic coding costs a fraction of a frontier model.

Connect Kimi K2 to OpenClaw (Free AI Agent)

OpenClaw is an open-source agent platform that works with any OpenAI-compatible endpoint, so Kimi K2 drops in as a one-step provider. Install, onboard, and choose Custom OpenAI-compatible when prompted:

npm install -g openclaw@latest
openclaw onboard

Enter the base URL (the free OpenRouter route for a truly $0 agent, or the official endpoint for the full flagship + caching), paste your key, and pick a Kimi model. K2's large context lets the agent hold a real codebase in working memory, and its agentic training makes it strong at the multi-step tool loops OpenClaw is built around.

Kimi K2 vs Other Free AI APIs

FeatureKimi K2 (Moonshot)DeepSeekGLM (Z.ai)Google Gemini
Free API pathCloudflare Workers AI onlyLow-cost paid (promos)3 free Flash modelsTrue free tier, no card
Card to start (free path)No (via Cloudflare)YesNoNo
Open weightsYes (Modified MIT)Yes (MIT)PartlyNo
Flagship context~256K128K~200K1M
Agentic/coding strengthVery highHighHigh (coding Flash)High
OpenAI-compatibleYesYesYesYes (compat endpoint)
Anthropic-compatible (Claude Code)YesVia proxyYesNo

The honest read: for "free" with zero asterisks and a 1M context, Gemini's no-card tier is simpler. For free models on a first-party key, GLM's Flash tier is purpose-built. You choose Kimi K2 when you specifically want the strongest open agentic-coding model — the one that drops cleanly into Claude Code — reached free through Cloudflare Workers AI, or paid through OpenRouter or Moonshot direct. For strong reasoning at the lowest token price, see DeepSeek; to route between all of them behind one key, OpenRouter.

Frequently Asked Questions

Is the Kimi K2 API free?

Moonshot's first-party API (api.moonshot.ai) is prepaid pay-as-you-go, not free. But Kimi K2 is open-weights, so you can still reach it for $0 through Cloudflare Workers AI's free daily allocation, or use it free (as a chat app) at kimi.com. OpenRouter's moonshotai/kimi-k2:free variant is no longer available — all nine Kimi models there are paid.

Do I need a credit card to use Kimi K2?

Not for the free routes. Cloudflare Workers AI and kimi.com both start without a payment method. The official Moonshot platform does require a small prepaid top-up (about $1) to activate API access.

Can I run Kimi K2 inside Claude Code?

Yes — one of its most popular uses. Set ANTHROPIC_BASE_URL to https://api.moonshot.ai/anthropic, ANTHROPIC_AUTH_TOKEN to your Moonshot key, and ANTHROPIC_MODEL to a Kimi model, then run Claude Code normally. It keeps Claude Code's interface while running Kimi K2's coding-tuned weights underneath.

Are Kimi K2's weights really open?

Yes. Moonshot publishes the checkpoints on Hugging Face under a Modified MIT license, so you can inspect, fine-tune, self-host, and deploy commercially — the same openness that lets third parties offer free hosted endpoints.

Related Reads