Views
No views yet

| Architecture | Mixture-of-Experts (MoE) |
| Total Parameters | 1T |
| Activated Parameters | 32B |
| Number of Layers (Dense layer included) | 61 |
| Number of Dense Layers | 1 |
| Attention Hidden Dimension | 7168 |
| MoE Hidden Dimension (per Expert) | 2048 |
| Number of Attention Heads | 64 |
| Number of Experts | 384 |
| Selected Experts per Token | 8 |
| Number of Shared Experts | 1 |
| Vocabulary Size | 160K |
| Context Length | 256K |
| Attention Mechanism | MLA |
| Activation Function | SwiGLU |
| Benchmark | Metric | K2-Instruct-0905 | K2-Instruct-0711 | Qwen3-Coder-480B-A35B-Instruct | GLM-4.5 | DeepSeek-V3.1 | Claude-Sonnet-4 | Claude-Opus-4 |
|---|---|---|---|---|---|---|---|---|
| SWE-Bench verified | ACC | 69.2 ± 0.63 | 65.8 | 69.6* | 64.2* | 66.0* | 72.7* | 72.5* |
| SWE-Bench Multilingual | ACC | 55.9 ± 0.72 | 47.3 | 54.7* | 52.7 | 54.5* | 53.3* | - |
| Multi-SWE-Bench | ACC | 33.5 ± 0.28 | 31.3 | 32.7 | 31.7 | 29.0 | 35.7 | - |
| Terminal-Bench | ACC | 44.5 ± 2.03 | 37.5 | 37.5* | 39.9* | 31.3* | 36.4* | 43.2* |
| SWE-Dev | ACC | 66.6 ± 0.72 | 61.9 | 64.7 | 63.2 | 53.3 | 67.1 | - |
[!Note] You can access Kimi K2's API on https://platform.moonshot.ai , we provide OpenAI/Anthropic-compatible API for you.The Anthropic-compatible API maps temperature byreal_temperature = request_temperature * 0.6for better compatible with existing applications.
1def simple_chat(client: OpenAI, model_name: str):
2 messages = [
3 {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
4 {"role": "user", "content": [{"type": "text", "text": "Please give a brief self-introduction."}]},
5 ]
6 response = client.chat.completions.create(
7 model=model_name,
8 messages=messages,
9 stream=False,
10 temperature=0.6,
11 max_tokens=256
12 )
13 print(response.choices[0].message.content)[!NOTE] The recommended temperature for Kimi-K2-Instruct-0905 istemperature = 0.6. If no special instructions are required, the system prompt above is a good default.
1# Your tool implementation
2def get_weather(city: str) -> dict:
3 return {"weather": "Sunny"}
4# Tool schema definition
5tools = [{
6 "type": "function",
7 "function": {
8 "name": "get_weather",
9 "description": "Retrieve current weather information. Call this when the user asks about the weather.",
10 "parameters": {
11 "type": "object",
12 "required": ["city"],
13 "properties": {
14 "city": {
15 "type": "string",
16 "description": "Name of the city"
17 }
18 }
19 }
20 }
21}]
22# Map tool names to their implementations
23tool_map = {
24 "get_weather": get_weather
25}
26def tool_call_with_client(client: OpenAI, model_name: str):
27 messages = [
28 {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
29 {"role": "user", "content": "What's the weather like in Beijing today? Use the tool to check."}
30 ]
31 finish_reason = None
32 while finish_reason is None or finish_reason == "tool_calls":
33 completion = client.chat.completions.create(
34 model=model_name,
35 messages=messages,
36 temperature=0.6,
37 tools=tools, # tool list defined above
38 tool_choice="auto"
39 )
40 choice = completion.choices[0]
41 finish_reason = choice.finish_reason
42 if finish_reason == "tool_calls":
43 messages.append(choice.message)
44 for tool_call in choice.message.tool_calls:
45 tool_call_name = tool_call.function.name
46 tool_call_arguments = json.loads(tool_call.function.arguments)
47 tool_function = tool_map[tool_call_name]
48 tool_result = tool_function(**tool_call_arguments)
49 print("tool_result:", tool_result)
50 messages.append({
51 "role": "tool",
52 "tool_call_id": tool_call.id,
53 "name": tool_call_name,
54 "content": json.dumps(tool_result)
55 })
56 print("-" * 100)
57 print(choice.message.content)tool_call_with_client function implements the pipeline from user query to tool execution.
This pipeline requires the inference engine to support Kimi-K2’s native tool-parsing logic.
For more information, see the Tool Calling Guide.