From 9ad362ff7b82b1c7e84fd7131db27440256b675c Mon Sep 17 00:00:00 2001 From: daniel-lxs Date: Thu, 6 Nov 2025 11:35:41 -0500 Subject: [PATCH 1/2] feat: add kimi-k2-thinking model to moonshot provider - Add kimi-k2-thinking model with 262k context window and 1.0 default temperature - Add defaultTemperature property to ModelInfo schema - Update TemperatureControl to use model's default temperature when enabled - Pass defaultTemperature from model info to TemperatureControl in ApiOptions --- packages/types/src/model.ts | 1 + packages/types/src/providers/moonshot.ts | 13 +++++++++++++ webview-ui/src/components/settings/ApiOptions.tsx | 1 + .../src/components/settings/TemperatureControl.tsx | 6 ++++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/types/src/model.ts b/packages/types/src/model.ts index 993ac4e8b3..748acb2858 100644 --- a/packages/types/src/model.ts +++ b/packages/types/src/model.ts @@ -65,6 +65,7 @@ export const modelInfoSchema = z.object({ supportsReasoningBinary: z.boolean().optional(), // Capability flag to indicate whether the model supports temperature parameter supportsTemperature: z.boolean().optional(), + defaultTemperature: z.number().optional(), requiredReasoningBudget: z.boolean().optional(), supportsReasoningEffort: z.boolean().optional(), requiredReasoningEffort: z.boolean().optional(), diff --git a/packages/types/src/providers/moonshot.ts b/packages/types/src/providers/moonshot.ts index 218e0708ce..c645afe1db 100644 --- a/packages/types/src/providers/moonshot.ts +++ b/packages/types/src/providers/moonshot.ts @@ -39,6 +39,19 @@ export const moonshotModels = { cacheReadsPrice: 0.6, // $0.60 per million tokens (cache hit) description: `Kimi K2 Turbo is a high-speed version of the state-of-the-art Kimi K2 mixture-of-experts (MoE) language model, with the same 32 billion activated parameters and 1 trillion total parameters, optimized for output speeds of up to 60 tokens per second, peaking at 100 tokens per second.`, }, + "kimi-k2-thinking": { + maxTokens: 16_000, // Recommended ≥ 16,000 + contextWindow: 262_144, // 262,144 tokens + supportsImages: false, // Text-only (no image/vision support) + supportsPromptCache: true, + inputPrice: 0.6, // $0.60 per million tokens (cache miss) + outputPrice: 2.5, // $2.50 per million tokens + cacheWritesPrice: 0, // $0 per million tokens (cache miss) + cacheReadsPrice: 0.15, // $0.15 per million tokens (cache hit) + supportsTemperature: true, // Default temperature: 1.0 + defaultTemperature: 1.0, + description: `The kimi-k2-thinking model is a general-purpose agentic reasoning model developed by Moonshot AI. Thanks to its strength in deep reasoning and multi-turn tool use, it can solve even the hardest problems.`, + }, } as const satisfies Record export const MOONSHOT_DEFAULT_TEMPERATURE = 0.6 diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index e2e7ba5615..45dbd4b46d 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -807,6 +807,7 @@ const ApiOptions = ({ value={apiConfiguration.modelTemperature} onChange={handleInputChange("modelTemperature", noTransform)} maxValue={2} + defaultValue={selectedModelInfo?.defaultTemperature} /> )} void maxValue?: number // Some providers like OpenAI use 0-2 range. + defaultValue?: number // Default temperature from model configuration } -export const TemperatureControl = ({ value, onChange, maxValue = 1 }: TemperatureControlProps) => { +export const TemperatureControl = ({ value, onChange, maxValue = 1, defaultValue }: TemperatureControlProps) => { const { t } = useAppTranslation() const [isCustomTemperature, setIsCustomTemperature] = useState(value !== undefined) const [inputValue, setInputValue] = useState(value) @@ -37,7 +38,8 @@ export const TemperatureControl = ({ value, onChange, maxValue = 1 }: Temperatur if (!isChecked) { setInputValue(null) // Unset the temperature, note that undefined is unserializable. } else { - setInputValue(value ?? 0) // Use the value from apiConfiguration, if set. + // Use the value from apiConfiguration, or fallback to model's defaultTemperature, or finally to 0 + setInputValue(value ?? defaultValue ?? 0) } }}> From 1e5c106cd6c47dc349df7a185fc8d78cad5734d7 Mon Sep 17 00:00:00 2001 From: daniel-lxs Date: Thu, 6 Nov 2025 12:01:50 -0500 Subject: [PATCH 2/2] feat: add preserveReasoning property to kimi-k2-thinking model --- packages/types/src/providers/moonshot.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/types/src/providers/moonshot.ts b/packages/types/src/providers/moonshot.ts index c645afe1db..7ddafab76b 100644 --- a/packages/types/src/providers/moonshot.ts +++ b/packages/types/src/providers/moonshot.ts @@ -49,6 +49,7 @@ export const moonshotModels = { cacheWritesPrice: 0, // $0 per million tokens (cache miss) cacheReadsPrice: 0.15, // $0.15 per million tokens (cache hit) supportsTemperature: true, // Default temperature: 1.0 + preserveReasoning: true, defaultTemperature: 1.0, description: `The kimi-k2-thinking model is a general-purpose agentic reasoning model developed by Moonshot AI. Thanks to its strength in deep reasoning and multi-turn tool use, it can solve even the hardest problems.`, },