Kimi K3: The Complete Developer Guide
Kimi K3: The Complete Developer Guide
Everything you need to run Moonshot AI's 2.8T open-weights model on the Together AI API: benchmarks, pricing, and copy-paste code.
Authors
Zain Hasan, Shobhit DixitTable of contents
What you'll learn
- What is Kimi K3, and what makes it different?
- What is under the hood: KDA, Attention Residuals, and the Stable LatentMoE architecture
- How do you use reasoning effort, streaming, tools, vision, and 1M context?
- How do you take it from a first API call to production?
- How does Kimi K3 compare to the frontier on coding and agentic benchmarks?
- How much does Kimi K3 cost on Together AI?
Kimi K3 is Moonshot AI's most capable model to date: a 2.8-trillion-parameter model and the world's first open-source model in the 3-trillion-parameter class. It is designed for frontier intelligence work like long-horizon coding, end-to-end knowledge work, and deep reasoning. It is also the first open-weights model competing at the GPT 5.6 Sol and Claude Fable 5 tier, and Together AI is working directly with the Moonshot team to serve it.
The largest open-weight model released
The Kimi team is deeply committed to scaling, and it shows: in nine of the twelve months from July 2025 to July 2026, Kimi models set the upper bound of open-model scale. At 2.8 trillion parameters, K3 is now the largest open-weight model ever released.
What is under the hood
Two architectural updates form K3's backbone, both designed to help information flow more easily through longer sequences and deeper into the network:
- Kimi Delta Attention (KDA): a hybrid linear attention mechanism that provides an efficient foundation for scaling attention across very long contexts. This is the first Kimi model to support a 1M context length.
- Attention Residuals (AttnRes): selectively retrieves representations across model depth rather than accumulating them uniformly.
On top of that, Moonshot pushed Mixture-of-Experts sparsity further with the Stable LatentMoE framework, efficiently activating 16 of 896 experts. At this level of sparsity, roughly 2% of experts activated per token, routing and optimization become first-order challenges, so several supporting techniques enable stable training at 2.8T scale:
- Quantile Balancing: derives expert allocation directly from router-score quantiles, eliminating heuristic updates and a sensitive balancing hyperparameter.
- Per-Head Muon: extends the Muon optimizer to optimize attention heads independently for more adaptive learning at scale.
- Sigmoid Tanh Unit (SiTU): improves activation control.
- Gated MLA: improves attention selectivity.
How to use Kimi K3 on Together AI
The API is OpenAI-compatible. The snippets below target Together AI and use the official Together Python SDK.
python3 -m pip install --upgrade 'together>=2.0.0'
import os
from together import Together
MODEL = "moonshotai/Kimi-K3"
client = Together(
api_key=os.environ["TOGETHER_API_KEY"],
)
completion = client.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": "Introduce Kimi K3 in one sentence."}],
max_tokens=130_000,
)
print(completion.choices[0].message.content)
Thinking effort
K3 can be configured with the top-level reasoning_effort field. Three levels are supported: low, high, and max, with max as the default. On Together, thinking can also be switched off via the standard reasoning={"enabled": False} toggle.
# Adjust depth: "low" | "high" | "max"
completion = client.chat.completions.create(
model=MODEL,
reasoning_effort="max",
messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
max_tokens=8192,
)
# Instant mode, no thinking tokens billed at all
fast = client.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": "What is the capital of France?"}],
reasoning={"enabled": False},
max_tokens=256,
)
Streaming
Streaming responses deliver separate reasoning_content (the thinking trace) and final-answer content deltas.
stream = client.chat.completions.create(
model=MODEL,
messages=[{"role": "user", "content": "Explain why the sky is blue."}],
max_tokens=4096,
stream=True,
)
in_answer = False
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
thinking = getattr(delta, "reasoning_content", None) or getattr(delta, "reasoning", None)
if thinking:
print(thinking, end="", flush=True)
if delta.content:
if not in_answer:
print("\n--- answer ---")
in_answer = True
print(delta.content, end="", flush=True)
Vision input
Multiple images can be provided as input. Moonshot has also released a visual reasoning benchmark, Perception Bench.
import base64
from pathlib import Path
# Option A: pass an image by URL
IMAGE_URL = "https://raw.githubusercontent.com/pytorch/pytorch/main/docs/source/_static/img/pytorch-logo-dark.png"
image_content = {"type": "image_url", "image_url": {"url": IMAGE_URL}}
# Option B: pass a local image as base64 (uncomment to use)
# image_data = base64.b64encode(Path("image.png").read_bytes()).decode()
# image_content = {"type": "image_url",
# "image_url": {"url": f"data:image/png;base64,{image_data}"}}
completion = client.chat.completions.create(
model=MODEL,
max_tokens=2048,
messages=[{
"role": "user",
"content": [
image_content,
{"type": "text", "text": "Describe this image."},
],
}],
)
Vision limits:
- No limit on the number of images, but the whole request body must stay under 100 MB.
- Recommended maxima: 4K (4096x2160) for images. Higher resolutions cost processing time and tokens without improving understanding.
- Token cost scales with resolution.
Structured output
Use response_format with json_schema and strict: true to constrain the final message.content.
import json
completion = client.chat.completions.create(
model=MODEL,
max_tokens=4096,
messages=[{"role": "user", "content": "Ada Lovelace was 36 years old."}],
response_format={
"type": "json_schema",
"json_schema": {
"name": "person",
"strict": True,
"schema": {
"type": "object",
"properties": {"name": {"type": "string"}, "age": {"type": "integer"}},
"required": ["name", "age"],
"additionalProperties": False,
},
},
},
)
person = json.loads(completion.choices[0].message.content)
# -> {'name': 'Ada Lovelace', 'age': 36}
Kimi K3 pricing
Kimi K3 is priced per token, with a cache-hit input tier that rewards stable prefixes:
| Tier | Price per 1M tokens |
|---|---|
| Input (cache hit) | $0.30 |
| Input (cache miss) | $3.00 |
| Output | $15.00 |
Context window: 1,048,576 tokens (1M). Thinking tokens are billed as output.
Kimi K3 benchmarks
Across the evaluation suite, Kimi K3 posts frontier-level numbers. It leads the field on several coding and agentic benchmarks while clearly outperforming the other open model tested, GLM-5.2.
Frequently asked questions
What is Kimi K3? Kimi K3 is Moonshot AI's flagship 2.8-trillion-parameter model and the first open-source model in the 3-trillion-parameter class, built for long-horizon coding, knowledge work, and reasoning.
Is Kimi K3 open source?
Yes. It is released as an open-weights model, and Together AI works directly with the Moonshot team to serve it.
What is Kimi K3's context window?
1M tokens (1,048,576), supported in full on Together AI with automatic context caching.