File tree Expand file tree Collapse file tree 4 files changed +27
-10
lines changed
packages/types/src/providers Expand file tree Collapse file tree 4 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " kilo-code " : patch
3+ ---
4+
5+ Add Kimi K2 model to Grok (thanks @mrubens )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export type GroqModelId =
1010 | "qwen-qwq-32b"
1111 | "qwen/qwen3-32b"
1212 | "deepseek-r1-distill-llama-70b"
13+ | "moonshotai/kimi-k2-instruct"
1314
1415export const groqDefaultModelId : GroqModelId = "llama-3.3-70b-versatile" // Defaulting to Llama3 70B Versatile
1516
@@ -87,4 +88,13 @@ export const groqModels = {
8788 outputPrice : 0.99 ,
8889 description : "DeepSeek R1 Distill Llama 70B model, 128K context." ,
8990 } ,
91+ "moonshotai/kimi-k2-instruct" : {
92+ maxTokens : 131072 ,
93+ contextWindow : 131072 ,
94+ supportsImages : false ,
95+ supportsPromptCache : false ,
96+ inputPrice : 1.0 ,
97+ outputPrice : 3.0 ,
98+ description : "Moonshot AI Kimi K2 Instruct 1T model, 128K context." ,
99+ } ,
90100} as const satisfies Record < string , ModelInfo >
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import { ClineAskResponse } from "../../shared/WebviewMessage"
4242import { defaultModeSlug } from "../../shared/modes"
4343import { DiffStrategy } from "../../shared/tools"
4444import { EXPERIMENT_IDS , experiments } from "../../shared/experiments"
45+ import { getModelMaxOutputTokens } from "../../shared/api"
4546
4647// services
4748import { UrlContentFetcher } from "../../services/browser/UrlContentFetcher"
@@ -1824,15 +1825,13 @@ export class Task extends EventEmitter<ClineEvents> {
18241825 const { contextTokens } = this . getTokenUsage ( )
18251826
18261827 if ( contextTokens ) {
1827- // Default max tokens value for thinking models when no specific
1828- // value is set.
1829- const DEFAULT_THINKING_MODEL_MAX_TOKENS = 16_384
1830-
18311828 const modelInfo = this . api . getModel ( ) . info
18321829
1833- const maxTokens = modelInfo . supportsReasoningBudget
1834- ? this . apiConfiguration . modelMaxTokens || DEFAULT_THINKING_MODEL_MAX_TOKENS
1835- : modelInfo . maxTokens
1830+ const maxTokens = getModelMaxOutputTokens ( {
1831+ modelId : this . api . getModel ( ) . id ,
1832+ model : modelInfo ,
1833+ settings : this . apiConfiguration ,
1834+ } )
18361835
18371836 const contextWindow = modelInfo . contextWindow
18381837
Original file line number Diff line number Diff line change @@ -182,9 +182,12 @@ export const getModelMaxOutputTokens = ({
182182 return ANTHROPIC_DEFAULT_MAX_TOKENS
183183 }
184184
185- // If maxTokens is 0 or undefined, fall back to 20% of context window
186- // This matches the sliding window logic
187- return model . maxTokens || Math . ceil ( model . contextWindow * 0.2 )
185+ // If maxTokens is 0 or undefined or the full context window, fall back to 20% of context window
186+ if ( model . maxTokens && model . maxTokens !== model . contextWindow ) {
187+ return model . maxTokens
188+ } else {
189+ return Math . ceil ( model . contextWindow * 0.2 )
190+ }
188191}
189192
190193// GetModelsOptions
You can’t perform that action at this time.
0 commit comments