You can swap Claude Code's default backend for Moonshot AI's Kimi K3 with a single terminal command or three environment variables — no rebuild, no new tool, no workflow change. The fastest route is ollama launch claude --model kimi-k3:cloud, but it is not free: it requires an Ollama Pro or Max subscription and consumes extra usage credits on top of that. Three real paths exist — Ollama Cloud, the Moonshot API directly, and Kimi Code — and the right one depends on whether you already pay for Ollama, how much you value flat-rate versus per-token billing, and whether you need the model locally or are fine with cloud inference. This guide walks through all three with exact commands, verified pricing, and a decision verdict.
Last verified: 2026-07-31 · Fastest setup: Ollama Cloud (one command) · Cheapest for light use: Moonshot API direct · Not truly free on any route.
Why use Kimi K3 with Claude Code?
Claude Code is Anthropic's agentic coding tool — it reads your codebase, edits files, and runs commands — but it speaks the Anthropic Messages API, so it will happily talk to any endpoint that speaks the same protocol. That means you keep the same tool, commands, and habits you already built, but point the model at whatever brain fits the job. Kimi K3 is Moonshot AI's 2.8-trillion-parameter Mixture-of-Experts model with a 1-million-token context window and native text, image, and video input (Ollama, July 2026).
The architecture is what makes K3 worth swapping to for long coding sessions: only 16 of 896 experts activate per token (~104B of the 2.81T total parameters), which keeps per-token compute down while giving you the full model's capacity when you need it (Datalearner, July 2026). The result is a model that can hold a mid-size codebase in one context window and sustain long engineering sessions with minimal human oversight.
What does the ollama launch claude command actually do?
The ollama launch claude command sets up and runs Claude Code with Ollama as the backend — it wires the environment variables for you, pulls the model if needed, and launches the agent. You don't edit any config files yourself (Ollama docs).
For Kimi K3 specifically, you append the model flag:
ollama launch claude --model kimi-k3:cloud
The :cloud suffix tells Ollama to run K3 on Ollama's hosted infrastructure rather than trying to load a 2.81-trillion-parameter model onto your laptop. That distinction matters: Kimi K3 through Ollama right now is a cloud model, not a local one. Ollama also lets you run smaller models fully locally if your hardware can handle it, but the big K3 brain runs on their servers (Ollama model page).
If you want to skip the launcher and wire it manually, the same connection needs three environment variables:
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model kimi-k3:cloud
How much does it cost to run Kimi K3 through Ollama?
Kimi K3 on Ollama is not free on any plan — and that is the single most misunderstood part of this integration. The Ollama model page states plainly: "Currently Kimi K3 requires a Pro or Max subscription, and consumes extra usage credits" (Ollama, July 2026).
Here is what each Ollama plan costs and what you get for cloud inference:
| Plan | Price | Concurrent cloud models | Cloud usage | Kimi K3 access? |
|---|---|---|---|---|
| Free | $0 | 1 | Light | No — K3 needs Pro or Max |
| Pro | $20/mo (or $200/yr) | 3 | 50× the Free tier | Yes, but consumes extra credits |
| Max | $100/mo | 10 | 5× the Pro tier | Yes, but consumes extra credits (new Max sign-ups temporarily paused as of July 2026) |
Source: Ollama pricing page.
Usage on Ollama is measured by GPU time, not by a fixed token count — a slower model at the same level costs the same GPU time as a faster one. Pro and Max users can also buy "extra usage" balance after exhausting their plan balance; exact per-unit pricing is not publicly listed (Ollama TPS, June 2026).
One important catch surfaced by readers on X: as of late July 2026, Ollama is not including K3 inside any subscription plan's included allowance — not even the highest Max tier. It is positioned as a pay-as-you-go model on top of the subscription. New Max subscriptions were also temporarily paused while Ollama adds capacity, though existing Max subscribers keep their plan, limits, and pricing (Ollama pricing FAQ; Ollama on X, July 27 2026).
What are all the ways to run Kimi K3 in Claude Code?
There are three practical routes. They differ on setup friction, cost structure, and where the inference happens.
Route 1: Ollama Cloud (one command, subscription-gated)
Best for: developers already on an Ollama Pro or Max plan who want zero config.
# Install Ollama (macOS example)
brew install ollama
ollama signin
# Launch Claude Code with Kimi K3
ollama launch claude --model kimi-k3:cloud
- Setup: one command after signing in.
- Cost: $20/mo (Pro) or $100/mo (Max) subscription + extra usage credits consumed on top.
- Context: full 1M-token window available.
- Modality: text and image input.
- Blocker: if you don't have a Pro or Max subscription, the command fails. Check your subscription status first (note.com, July 2026).
Route 2: Moonshot API direct (per-token, no subscription)
Best for: developers who want to pay only for what they use and already have a Moonshot API key, or who need the widest model access without a separate Ollama subscription.
The Kimi API platform documents the Claude Code integration directly — you set the base URL to Moonshot's Anthropic-compatible endpoint and paste your Moonshot API key:
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="${YOUR_MOONSHOT_API_KEY}"
export ANTHROPIC_MODEL="kimi-k3[1m]"
export ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k3[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k3[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="kimi-k3[1m]"
claude
The [1m] suffix explicitly tells Claude Code to use the 1-million-token context window (Kimi API Platform docs).
If you don't need the full 1M context, the shorter form works everywhere else (API requests, other tools): just use kimi-k3 without the bracketed suffix. The Kimi Code docs note you can also set CLAUDE_CODE_EFFORT_LEVEL="max" to map Claude Code's effort dial onto K3's reasoning effort levels (Kimi Code docs).
- Setup: three environment variables and a Moonshot API key.
- Cost: per-token. $3 per 1M input tokens, $0.30 per 1M cached input tokens, $15 per 1M output tokens — flat across the full context window, no tiering by context length (Ollama model page, July 2026; Tosea.ai, July 2026).
- Context: 1M tokens.
- Modality: text, image, and video input.
- No subscription required; you pay for tokens consumed.
Route 3: Kimi Code (Moonshot's own coding CLI)
Best for: developers who want a first-party Moonshot experience and don't need Claude Code's specific plugin ecosystem.
Kimi Code is Moonshot's own agentic coding CLI and VS Code extension. It ships with the same K3 model wired in out of the box — no environment variables, no third-party launcher. The trade-off is it is a different tool from Claude Code, so you leave behind Claude Code's plugin ecosystem, /loop scheduled-task syntax, and Telegram bot bridge (Kimi Code docs).
- Setup: install Kimi Code, sign in.
- Cost: per Moonshot API rates (same per-token pricing as Route 2).
- Context: up to 1M tokens depending on plan tier.
- Best if: you want zero configuration and you're already in the Kimi ecosystem.
Comparison at a glance
| Route 1: Ollama Cloud | Route 2: Moonshot API | Route 3: Kimi Code | |
|---|---|---|---|
| Setup | One command | Three env vars | Install + sign in |
| Billing | Subscription + extra credits | Per-token | Per-token |
| Min monthly cost | $20 (Pro) | $0 + usage | $0 + usage |
| Context window | 1M | 1M (kimi-k3[1m]) |
Up to 1M (plan-tier dependent) |
| Keeps Claude Code tool? | Yes | Yes | No (different CLI) |
| Requires subscription? | Yes (Pro or Max) | No | No |
Can you run Kimi K3 fully locally on your own machine?
Not realistically. Kimi K3 at 2.81 trillion parameters requires a dedicated multi-GPU server, not a laptop or a single consumer GPU. All 896 experts must be loaded into VRAM across many accelerators with high-bandwidth interconnect, so local hosting means a cluster, not a personal machine (Layer3 Labs, July 2026).
This is a key distinction: open weights do not equal free local inference. Moonshot did release the full K3 weights on July 27, 2026 under the Kimi K3 License (Moonshot on X, July 27 2026), and you can download them from Hugging Face — but serving the model still takes enterprise-class hardware. Our guide on how to run a 744B parameter LLM locally with Colibri covers what realistic local inference looks like for a model of that scale, and K3 is nearly four times larger.
For production serving, high-throughput engines like vLLM and SGLang are the right tools for a model this size. Ollama is better suited as a client or for prototyping with smaller models — you can point an Ollama-compatible client at a K3 endpoint you serve elsewhere, keeping the same client code you would use for a local model (NVIDIA Dynamo docs; Layer3 Labs).
Which Kimi K3 route should you pick?
Pick by billing preference and whether you already pay for Ollama.
- You already have an Ollama Pro or Max subscription and you want the fastest possible setup → Route 1 (Ollama Cloud). One command, no environment variables, done. Just remember the extra-usage-credits wrinkle when you budget.
- You want to pay only for tokens you actually use, or you already have a Moonshot API key → Route 2 (Moonshot API direct). The per-token pricing is transparent ($3 / $15 per 1M) and there's no subscription floor.
- You want a first-party Moonshot experience and don't need Claude Code's specific plugins → Route 3 (Kimi Code). Zero configuration, native K3, at the cost of switching tools.
The pattern this all points to is a bigger shift in how AI coding tools work. For a deeper look at building agent harnesses that survive this kind of model churn — so you can swap K3 for K2.7 or any future model without rewriting your stack — see our guide on building a model-agnostic AI agent OS that survives model churn.
What does Kimi K3's architecture actually mean for coding work?
Three architectural facts decide whether K3 fits your workflow.
MoE sparsity keeps the active model small. K3 activates 16 of 896 experts per token — about 104B parameters of the 2.81T total (Datalearner). That is the whole point of MoE: you get the capacity of a huge model with the per-token compute of a much smaller one. For coding work, that means a long session over a large codebase doesn't necessarily cost more per token than a smaller dense model would — the router just lights up the experts each token needs.
Kimi Delta Attention makes long context cheap. K3 is built on Kimi Delta Attention (KDA) and Attention Residuals (AttnRes). KDA is a hybrid linear attention mechanism that interleaves linear-attention layers with periodic full-attention layers in a 3:1 ratio, which Moonshot reports yields up to 6.3× faster decoding in million-token contexts compared with conventional attention (AgentOne, July 2026; kimi-k3.dev). That matters for coding because the biggest cost in a long agent session is reprocessing the growing context — if the architecture makes that cheaper, your dollar goes further at 1M tokens than it would on a model with a traditional attention block.
Native multimodality means fewer pipeline pieces. K3 understands text, images, and video within the same model — you can hand it a screenshot of a UI or a whiteboard plan and it responds to what's in the image (Ollama). For a coding agent, that removes the need for a separate vision model when you want the agent to look at a design mock, a chart, or a photo of a printed spec.
How do you verify the integration is working?
After launching Claude Code via any route, run /status inside the session. The Kimi Code docs note: if the returned Base URL points at your configured endpoint (for Route 2, https://api.moonshot.ai/anthropic or https://api.kimi.com/coding/), the configuration succeeded (Kimi Code docs). For Ollama, the base URL should be http://localhost:11434.
You can also use --yes to skip selectors and run a non-interactive check:
ollama launch claude --model kimi-k3:cloud --yes -- -p "how does this repository work?"
The --yes flag pulls the model when needed, requires --model, and passes arguments after -- directly to Claude Code (Ollama docs).
For Ollama's tool-calling reliability with smaller models and what to watch for in agentic workflows, our guide on Ollama Gemma 4 tool calling reliability walks through the same integration pattern with a lighter model. And for a full Ollama coding-agent setup using a model you can actually run locally, see how to run a local coding agent with Gemma 4 and Ollama.
What this means for you
If you run a small team or solo operation and you're deciding whether to adopt K3 in Claude Code, the honest verdict is this:
- The one-command Ollama route is the best demo experience — it sells the idea that you can swap models behind an existing tool. But it is a subscription-plus-extra-credits path, not a free lunch. Budget for it.
- The Moonshot API direct route is the best value for most builders. Per-token pricing at $3 / $15 per 1M is transparent and you only pay for what you use. If you're evaluating K3 on your own codebase before committing to a subscription, this is the route to start with.
- Self-hosting is for teams with a real GPU cluster and a reason to own the inference path (data residency, compliance, sustained heavy use). Everyone else should use a hosted endpoint.
The deeper shift here is that coding agents are becoming model-agnostic. Ollama's launch command now bridges Claude Code, OpenCode, Hermes Agent, OpenClaw, and Codex to a growing library of cloud and local models (Ollama GitHub). The tool you learn today is increasingly separable from the model you run inside it — which means the investment worth making is in your workflow and your agent harness, not in any single model. If you're curating which models to wire in, our explainer on the Kimi K3 open-weight frontier model breaks down what K3's 2.8T MoE architecture actually changes about the compute math.
FAQ
Q: Do I need an Ollama subscription to run Kimi K3 in Claude Code? A: Yes, if you go through the Ollama route. Kimi K3 requires an Ollama Pro ($20/mo) or Max ($100/mo) subscription and consumes extra usage credits on top of your plan. You can also run K3 in Claude Code through the Moonshot API directly (per-token, no subscription) or through Kimi Code.
Q: Is Kimi K3 free to run locally? A: No. The weights are open and downloadable from Hugging Face (released July 27, 2026), but a 2.81-trillion-parameter MoE model needs a dedicated multi-GPU server to serve. Open weights mean you can run it on hardware you own; they don't mean that hardware is a laptop. For most teams, a hosted endpoint is the practical path.
Q: What is the difference between kimi-k3 and kimi-k3[1m]?
A: kimi-k3 is the standard model identifier used for API calls and most tools. The [1m] form (with quotes) explicitly tells Claude Code to use the full 1-million-token context window. If you don't need 1M tokens in Claude Code, plain kimi-k3 is fine.
Q: How much does Kimi K3 cost per token? A: $3 per 1M input tokens, $0.30 per 1M cached input tokens, and $15 per 1M output tokens, flat across the full 1-million-token context window with no tiering by context length. These figures come from the Ollama model page and third-party trackers; Moonshot confirms per-token billing but has not published the exact figures on its own pricing page, so treat the numbers as reported and verify before budgeting.
Q: Can I use Kimi K3 with Claude Code's plugins and /loop scheduled tasks?
A: Yes, on the Ollama and Moonshot API routes — you keep Claude Code as the tool, so its plugin ecosystem (including Telegram and the /loop scheduling syntax) works as normal. On the Kimi Code route you're in a different CLI, so Claude Code's specific plugins don't carry over.
Q: Does Kimi K3 support tool calling inside Claude Code? A: Yes. K3 supports tool calling, and Ollama tests cloud models trained for tool calling with real agent workflows before they go live. The Ollama docs note you should set the context length to 64k or higher for larger repositories when working through Claude Code.

Discussion
0 comments