Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

add kimi k3 model support (#467)

ktd66cc7b312f4
diff --git a/packages/ai/CHANGELOG.md b/packages/ai/CHANGELOG.md
index 61a7a47272..db27f93a0a 100644
--- a/packages/ai/CHANGELOG.md
+++ b/packages/ai/CHANGELOG.md
@@ -2,6 +2,8 @@
## [Unreleased]
+- Added Kimi K3 to the Prime Inference and OpenRouter model catalogs with multimodal input and mandatory max reasoning.
+
## [0.3.1] - 2026-07-15
- Added provider service-tier forwarding to shared stream options.
diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts
index a133fed36f..f1b7c5252c 100644
--- a/packages/ai/scripts/generate-models.ts
+++ b/packages/ai/scripts/generate-models.ts
@@ -88,6 +88,16 @@ const DEEPSEEK_V4_THINKING_LEVEL_MAP = {
xhigh: "max",
} as const;
+const KIMI_K3_THINKING_LEVEL_MAP = {
+ off: null,
+ minimal: null,
+ low: null,
+ medium: null,
+ high: null,
+ xhigh: null,
+ max: "max",
+} as const;
+
const DEEPSEEK_V4_COMPAT: OpenAICompletionsCompat = {
requiresReasoningContentOnAssistantMessages: true,
thinkingFormat: "deepseek",
@@ -149,6 +159,7 @@ const PRIME_INFERENCE_MODEL_METADATA: Record<string, PrimeInferenceModelMetadata
"qwen/qwen3-30b-a3b-instruct-2507": { contextWindow: 262144 },
// OpenRouter has no max_completion_tokens for the rest of these.
"moonshotai/kimi-k2.5": { maxTokens: 65535 },
+ "moonshotai/kimi-k3": { maxTokens: 1048576 },
"openai/gpt-4.1": { maxTokens: 32768 },
"openai/gpt-5-nano": { maxTokens: 128000 },
"openai/gpt-oss-20b": { maxTokens: 131072 },
@@ -175,6 +186,7 @@ const PRIME_INFERENCE_FEATURED_MODELS = new Set([
"deepseek/deepseek-v4-pro",
"minimax/minimax-m3",
"moonshotai/kimi-k2.7-code",
+ "moonshotai/kimi-k3",
"nvidia/nemotron-3-nano-30b-a3b",
"nvidia/nemotron-3-super-120b-a12b",
"openai/gpt-5.3-codex",
@@ -311,6 +323,9 @@ function applyThinkingLevelMetadata(model: Model<any>): void {
if (model.api === "openai-completions" && model.id.includes("deepseek-v4")) {
mergeThinkingLevelMap(model, DEEPSEEK_V4_THINKING_LEVEL_MAP);
}
+ if (model.id === "k3" || model.id.endsWith("/kimi-k3") || model.id === "kimi-k3") {
+ mergeThinkingLevelMap(model, KIMI_K3_THINKING_LEVEL_MAP);
+ }
if (isGoogleThinkingApi(model) && isGemini3ProModel(model.id)) {
mergeThinkingLevelMap(model, { off: null, minimal: null, low: "LOW", medium: null, high: "HIGH" });
}
@@ -1573,6 +1588,9 @@ async function generateModels() {
candidate.cost.cacheRead = 0.07;
candidate.maxTokens = 4096;
}
+ if (candidate.provider === "openrouter" && candidate.id === "moonshotai/kimi-k3") {
+ candidate.maxTokens = 1048576;
+ }
if (candidate.provider === "openrouter" && candidate.id === "z-ai/glm-5") {
candidate.cost.input = 0.6;
candidate.cost.output = 1.9;
diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.ts
index 6686fd59a1..6735eebb0a 100644
--- a/packages/ai/src/models.generated.ts
+++ b/packages/ai/src/models.generated.ts
@@ -6381,14 +6381,15 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 32768,
} satisfies Model<"anthropic-messages">,
- "kimi-for-coding": {
- id: "kimi-for-coding",
- name: "Kimi For Coding",
+ "k3": {
+ id: "k3",
+ name: "Kimi K3",
api: "anthropic-messages",
provider: "kimi-coding",
baseUrl: "https://api.kimi.com/coding",
headers: {"User-Agent":"KimiCLI/1.5"},
reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
input: ["text", "image"],
cost: {
input: 0,
@@ -6396,8 +6397,8 @@ export const MODELS = {
cacheRead: 0,
cacheWrite: 0,
},
- contextWindow: 262144,
- maxTokens: 32768,
+ contextWindow: 1048576,
+ maxTokens: 131072,
} satisfies Model<"anthropic-messages">,
"kimi-for-coding-highspeed": {
id: "kimi-for-coding-highspeed",
@@ -6417,24 +6418,6 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 32768,
} satisfies Model<"anthropic-messages">,
- "kimi-k2-thinking": {
- id: "kimi-k2-thinking",
- name: "Kimi K2 Thinking",
- api: "anthropic-messages",
- provider: "kimi-coding",
- baseUrl: "https://api.kimi.com/coding",
- headers: {"User-Agent":"KimiCLI/1.5"},
- reasoning: true,
- input: ["text"],
- cost: {
- input: 0,
- output: 0,
- cacheRead: 0,
- cacheWrite: 0,
- },
- contextWindow: 262144,
- maxTokens: 32768,
- } satisfies Model<"anthropic-messages">,
},
"minimax": {
"MiniMax-M2.7": {
@@ -7183,6 +7166,25 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 262144,
} satisfies Model<"openai-completions">,
+ "kimi-k3": {
+ id: "kimi-k3",
+ name: "Kimi K3",
+ api: "openai-completions",
+ provider: "moonshotai",
+ baseUrl: "https://api.moonshot.ai/v1",
+ compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","supportsStrictMode":false},
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 131072,
+ } satisfies Model<"openai-completions">,
},
"moonshotai-cn": {
"kimi-k2-0711-preview": {
@@ -7347,6 +7349,25 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 262144,
} satisfies Model<"openai-completions">,
+ "kimi-k3": {
+ id: "kimi-k3",
+ name: "Kimi K3",
+ api: "openai-completions",
+ provider: "moonshotai-cn",
+ baseUrl: "https://api.moonshot.cn/v1",
+ compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":false,"maxTokensField":"max_tokens","supportsStrictMode":false},
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 131072,
+ } satisfies Model<"openai-completions">,
},
"openai": {
"gpt-4": {
@@ -9377,9 +9398,9 @@ export const MODELS = {
thinkingLevelMap: {"minimal":null,"low":null,"medium":null,"high":"high","xhigh":"max"},
input: ["text"],
cost: {
- input: 0.14,
- output: 0.28,
- cacheRead: 0.0028,
+ input: 0.435,
+ output: 0.87,
+ cacheRead: 0.003625,
cacheWrite: 0,
},
contextWindow: 1000000,
@@ -9396,9 +9417,9 @@ export const MODELS = {
thinkingLevelMap: {"minimal":null,"low":null,"medium":null,"high":"high","xhigh":"max"},
input: ["text"],
cost: {
- input: 1.74,
- output: 3.48,
- cacheRead: 0.0145,
+ input: 0.435,
+ output: 0.87,
+ cacheRead: 0.003625,
cacheWrite: 0,
},
contextWindow: 1000000,
@@ -9438,6 +9459,23 @@ export const MODELS = {
contextWindow: 1000000,
maxTokens: 131072,
} satisfies Model<"openai-completions">,
+ "grok-4.5": {
+ id: "grok-4.5",
+ name: "Grok 4.5",
+ api: "openai-completions",
+ provider: "opencode-go",
+ baseUrl: "https://opencode.ai/zen/go/v1",
+ reasoning: true,
+ input: ["text", "image"],
+ cost: {
+ input: 2,
+ output: 6,
+ cacheRead: 0.5,
+ cacheWrite: 0,
+ },
+ contextWindow: 500000,
+ maxTokens: 500000,
+ } satisfies Model<"openai-completions">,
"kimi-k2.6": {
id: "kimi-k2.6",
name: "Kimi K2.6",
@@ -9472,6 +9510,24 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 262144,
} satisfies Model<"openai-completions">,
+ "kimi-k3": {
+ id: "kimi-k3",
+ name: "Kimi K3",
+ api: "openai-completions",
+ provider: "opencode-go",
+ baseUrl: "https://opencode.ai/zen/go/v1",
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 131072,
+ } satisfies Model<"openai-completions">,
"mimo-v2.5": {
id: "mimo-v2.5",
name: "MiMo V2.5",
@@ -9498,9 +9554,9 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
- input: 1.74,
- output: 3.48,
- cacheRead: 0.0145,
+ input: 0.435,
+ output: 0.87,
+ cacheRead: 0.003625,
cacheWrite: 0,
},
contextWindow: 1048576,
@@ -10329,7 +10385,7 @@ export const MODELS = {
cost: {
input: 0.098,
output: 0.196,
- cacheRead: 0.02,
+ cacheRead: 0.0196,
cacheWrite: 0,
},
contextWindow: 1048576,
@@ -10584,13 +10640,13 @@ export const MODELS = {
reasoning: false,
input: ["text", "image"],
cost: {
- input: 0.08,
- output: 0.44999999999999996,
- cacheRead: 0.04,
+ input: 0.09999999999999999,
+ output: 0.3,
+ cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 131072,
- maxTokens: 131072,
+ maxTokens: 4096,
} satisfies Model<"openai-completions">,
"google/gemma-4-26b-a4b-it": {
id: "google/gemma-4-26b-a4b-it",
@@ -10898,6 +10954,23 @@ export const MODELS = {
contextWindow: 10000000,
maxTokens: 16384,
} satisfies Model<"openai-completions">,
+ "meta/muse-spark-1.1": {
+ id: "meta/muse-spark-1.1",
+ name: "Meta: Muse Spark 1.1",
+ api: "openai-completions",
+ provider: "openrouter",
+ baseUrl: "https://openrouter.ai/api/v1",
+ reasoning: true,
+ input: ["text", "image"],
+ cost: {
+ input: 1.25,
+ output: 4.25,
+ cacheRead: 0.15,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 4096,
+ } satisfies Model<"openai-completions">,
"minimax/minimax-m1": {
id: "minimax/minimax-m1",
name: "MiniMax: MiniMax M1",
@@ -10975,9 +11048,9 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
- input: 0.3,
- output: 1.2,
- cacheRead: 0.06,
+ input: 0.25,
+ output: 1,
+ cacheRead: 0.049999999999999996,
cacheWrite: 0,
},
contextWindow: 204800,
@@ -11196,8 +11269,8 @@ export const MODELS = {
reasoning: false,
input: ["text"],
cost: {
- input: 0.02,
- output: 0.04,
+ input: 0.019000000000000003,
+ output: 0.03,
cacheRead: 0,
cacheWrite: 0,
},
@@ -11366,13 +11439,13 @@ export const MODELS = {
reasoning: true,
input: ["text", "image"],
cost: {
- input: 0.66,
- output: 3.41,
- cacheRead: 0.144,
+ input: 0.95,
+ output: 4,
+ cacheRead: 0.16,
cacheWrite: 0,
},
contextWindow: 262144,
- maxTokens: 262144,
+ maxTokens: 4096,
} satisfies Model<"openai-completions">,
"moonshotai/kimi-k2.7-code": {
id: "moonshotai/kimi-k2.7-code",
@@ -11383,14 +11456,32 @@ export const MODELS = {
reasoning: true,
input: ["text", "image"],
cost: {
- input: 0.719,
- output: 3.49,
- cacheRead: 0.149,
+ input: 0.75,
+ output: 3.5,
+ cacheRead: 0.16,
cacheWrite: 0,
},
contextWindow: 262144,
maxTokens: 262144,
} satisfies Model<"openai-completions">,
+ "moonshotai/kimi-k3": {
+ id: "moonshotai/kimi-k3",
+ name: "MoonshotAI: Kimi K3",
+ api: "openai-completions",
+ provider: "openrouter",
+ baseUrl: "https://openrouter.ai/api/v1",
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 1048576,
+ } satisfies Model<"openai-completions">,
"nex-agi/nex-n2-mini": {
id: "nex-agi/nex-n2-mini",
name: "Nex AGI: Nex-N2-Mini",
@@ -11425,23 +11516,6 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 262144,
} satisfies Model<"openai-completions">,
- "nvidia/llama-3.3-nemotron-super-49b-v1.5": {
- id: "nvidia/llama-3.3-nemotron-super-49b-v1.5",
- name: "NVIDIA: Llama 3.3 Nemotron Super 49B V1.5",
- api: "openai-completions",
- provider: "openrouter",
- baseUrl: "https://openrouter.ai/api/v1",
- reasoning: true,
- input: ["text"],
- cost: {
- input: 0.39999999999999997,
- output: 0.39999999999999997,
- cacheRead: 0,
- cacheWrite: 0,
- },
- contextWindow: 131072,
- maxTokens: 16384,
- } satisfies Model<"openai-completions">,
"nvidia/nemotron-3-nano-30b-a3b": {
id: "nvidia/nemotron-3-nano-30b-a3b",
name: "NVIDIA: Nemotron 3 Nano 30B A3B",
@@ -12812,13 +12886,13 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
- input: 0.09999999999999999,
+ input: 0.12,
output: 0.24,
cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 131702,
- maxTokens: 40960,
+ maxTokens: 16384,
} satisfies Model<"openai-completions">,
"qwen/qwen3-235b-a22b": {
id: "qwen/qwen3-235b-a22b",
@@ -13016,7 +13090,7 @@ export const MODELS = {
reasoning: false,
input: ["text"],
cost: {
- input: 0.12,
+ input: 0.11,
output: 0.7999999999999999,
cacheRead: 0.07,
cacheWrite: 0,
@@ -13322,9 +13396,9 @@ export const MODELS = {
reasoning: true,
input: ["text", "image"],
cost: {
- input: 0.44999999999999996,
- output: 3,
- cacheRead: 0.22499999999999998,
+ input: 0.39,
+ output: 2.34,
+ cacheRead: 0,
cacheWrite: 0,
},
contextWindow: 262144,
@@ -13985,9 +14059,9 @@ export const MODELS = {
reasoning: true,
input: ["text"],
cost: {
- input: 0.8428,
- output: 2.6488,
- cacheRead: 0.15652,
+ input: 0.9281999999999999,
+ output: 2.9172000000000002,
+ cacheRead: 0.17238,
cacheWrite: 0,
},
contextWindow: 1048576,
@@ -14121,13 +14195,13 @@ export const MODELS = {
reasoning: true,
input: ["text", "image"],
cost: {
- input: 0.66,
- output: 3.41,
- cacheRead: 0.15,
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
cacheWrite: 0,
},
- contextWindow: 262144,
- maxTokens: 262144,
+ contextWindow: 1048576,
+ maxTokens: 4096,
} satisfies Model<"openai-completions">,
"~openai/gpt-latest": {
id: "~openai/gpt-latest",
@@ -14685,7 +14759,7 @@ export const MODELS = {
cacheWrite: 0,
},
contextWindow: 131072,
- maxTokens: 131072,
+ maxTokens: 8192,
} satisfies Model<"openai-completions">,
"meta-llama/Llama-3.2-1B-Instruct": {
id: "meta-llama/Llama-3.2-1B-Instruct",
@@ -14974,7 +15048,7 @@ export const MODELS = {
cacheWrite: 0,
},
contextWindow: 262144,
- maxTokens: 262144,
+ maxTokens: 8192,
} satisfies Model<"openai-completions">,
"moonshotai/kimi-k2.7-code": {
id: "moonshotai/kimi-k2.7-code",
@@ -14995,6 +15069,26 @@ export const MODELS = {
maxTokens: 262144,
featured: true,
} satisfies Model<"openai-completions">,
+ "moonshotai/kimi-k3": {
+ id: "moonshotai/kimi-k3",
+ name: "Kimi K3",
+ api: "openai-completions",
+ provider: "prime-inference",
+ baseUrl: "https://api.pinference.ai/api/v1",
+ compat: {"supportsStore":false,"supportsDeveloperRole":false,"supportsReasoningEffort":true,"maxTokensField":"max_tokens","supportsStrictMode":false},
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0,
+ cacheWrite: 0,
+ },
+ contextWindow: 1048576,
+ maxTokens: 1048576,
+ featured: true,
+ } satisfies Model<"openai-completions">,
"nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B": {
id: "nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B",
name: "NVIDIA Nemotron 3 Ultra 550B A55B",
@@ -17391,40 +17485,6 @@ export const MODELS = {
contextWindow: 128000,
maxTokens: 8192,
} satisfies Model<"anthropic-messages">,
- "meta/llama-3.2-11b": {
- id: "meta/llama-3.2-11b",
- name: "Llama 3.2 11B Vision Instruct",
- api: "anthropic-messages",
- provider: "vercel-ai-gateway",
- baseUrl: "https://ai-gateway.vercel.sh",
- reasoning: false,
- input: ["text", "image"],
- cost: {
- input: 0.16,
- output: 0.16,
- cacheRead: 0,
- cacheWrite: 0,
- },
- contextWindow: 128000,
- maxTokens: 8192,
- } satisfies Model<"anthropic-messages">,
- "meta/llama-3.2-90b": {
- id: "meta/llama-3.2-90b",
- name: "Llama 3.2 90B Vision Instruct",
- api: "anthropic-messages",
- provider: "vercel-ai-gateway",
- baseUrl: "https://ai-gateway.vercel.sh",
- reasoning: false,
- input: ["text", "image"],
- cost: {
- input: 0.72,
- output: 0.72,
- cacheRead: 0,
- cacheWrite: 0,
- },
- contextWindow: 128000,
- maxTokens: 8192,
- } satisfies Model<"anthropic-messages">,
"meta/llama-3.3-70b": {
id: "meta/llama-3.3-70b",
name: "Llama 3.3 70B Instruct",
@@ -17969,6 +18029,24 @@ export const MODELS = {
contextWindow: 262144,
maxTokens: 32768,
} satisfies Model<"anthropic-messages">,
+ "moonshotai/kimi-k3": {
+ id: "moonshotai/kimi-k3",
+ name: "Kimi K3",
+ api: "anthropic-messages",
+ provider: "vercel-ai-gateway",
+ baseUrl: "https://ai-gateway.vercel.sh",
+ reasoning: true,
+ thinkingLevelMap: {"off":null,"minimal":null,"low":null,"medium":null,"high":null,"xhigh":null,"max":"max"},
+ input: ["text", "image"],
+ cost: {
+ input: 3,
+ output: 15,
+ cacheRead: 0.3,
+ cacheWrite: 0,
+ },
+ contextWindow: 1000000,
+ maxTokens: 131072,
+ } satisfies Model<"anthropic-messages">,
"nvidia/nemotron-3-nano-30b-a3b": {
id: "nvidia/nemotron-3-nano-30b-a3b",
name: "Nemotron 3 Nano 30B A3B",
diff --git a/packages/ai/test/prime-inference-models.test.ts b/packages/ai/test/prime-inference-models.test.ts
index 331fe43252..413e6a57c1 100644
--- a/packages/ai/test/prime-inference-models.test.ts
+++ b/packages/ai/test/prime-inference-models.test.ts
@@ -59,10 +59,35 @@ describe("Prime Inference models", () => {
it("marks flagship models as featured so pickers can pin them above the long tail", () => {
expect(getModel("prime-inference", "openai/gpt-5.5").featured).toBe(true);
expect(getModel("prime-inference", "z-ai/glm-5.2").featured).toBe(true);
+ expect(getModel("prime-inference", "moonshotai/kimi-k3").featured).toBe(true);
expect(getModel("prime-inference", "google/gemini-2.5-pro").featured).toBeUndefined();
expect(getModel("prime-inference", "openai/gpt-4o").featured).toBeUndefined();
});
+ it("registers Kimi K3 on Prime Inference and OpenRouter", () => {
+ for (const provider of ["prime-inference", "openrouter"] as const) {
+ const model = getModel(provider, "moonshotai/kimi-k3");
+
+ expect(model.api).toBe("openai-completions");
+ expect(model.reasoning).toBe(true);
+ expect(model.thinkingLevelMap).toEqual({
+ off: null,
+ minimal: null,
+ low: null,
+ medium: null,
+ high: null,
+ xhigh: null,
+ max: "max",
+ });
+ expect(getSupportedThinkingLevels(model)).toEqual(["max"]);
+ expect(model.input).toEqual(["text", "image"]);
+ expect(model.contextWindow).toBe(1048576);
+ expect(model.maxTokens).toBe(1048576);
+ expect(model.cost.input).toBe(3);
+ expect(model.cost.output).toBe(15);
+ }
+ });
+
it("borrows OpenRouter metadata for non-curated catalog models", () => {
const gemini = getModel("prime-inference", "google/gemini-2.5-pro");
expect(gemini.contextWindow).toBe(1048576);