Skip to content

Commit 9ad362f

Browse files
committed
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
1 parent 7320d79 commit 9ad362f

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

packages/types/src/model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const modelInfoSchema = z.object({
6565
supportsReasoningBinary: z.boolean().optional(),
6666
// Capability flag to indicate whether the model supports temperature parameter
6767
supportsTemperature: z.boolean().optional(),
68+
defaultTemperature: z.number().optional(),
6869
requiredReasoningBudget: z.boolean().optional(),
6970
supportsReasoningEffort: z.boolean().optional(),
7071
requiredReasoningEffort: z.boolean().optional(),

packages/types/src/providers/moonshot.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export const moonshotModels = {
3939
cacheReadsPrice: 0.6, // $0.60 per million tokens (cache hit)
4040
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.`,
4141
},
42+
"kimi-k2-thinking": {
43+
maxTokens: 16_000, // Recommended ≥ 16,000
44+
contextWindow: 262_144, // 262,144 tokens
45+
supportsImages: false, // Text-only (no image/vision support)
46+
supportsPromptCache: true,
47+
inputPrice: 0.6, // $0.60 per million tokens (cache miss)
48+
outputPrice: 2.5, // $2.50 per million tokens
49+
cacheWritesPrice: 0, // $0 per million tokens (cache miss)
50+
cacheReadsPrice: 0.15, // $0.15 per million tokens (cache hit)
51+
supportsTemperature: true, // Default temperature: 1.0
52+
defaultTemperature: 1.0,
53+
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.`,
54+
},
4255
} as const satisfies Record<string, ModelInfo>
4356

4457
export const MOONSHOT_DEFAULT_TEMPERATURE = 0.6

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ const ApiOptions = ({
807807
value={apiConfiguration.modelTemperature}
808808
onChange={handleInputChange("modelTemperature", noTransform)}
809809
maxValue={2}
810+
defaultValue={selectedModelInfo?.defaultTemperature}
810811
/>
811812
)}
812813
<RateLimitSecondsControl

webview-ui/src/components/settings/TemperatureControl.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ interface TemperatureControlProps {
99
value: number | undefined | null
1010
onChange: (value: number | undefined | null) => void
1111
maxValue?: number // Some providers like OpenAI use 0-2 range.
12+
defaultValue?: number // Default temperature from model configuration
1213
}
1314

14-
export const TemperatureControl = ({ value, onChange, maxValue = 1 }: TemperatureControlProps) => {
15+
export const TemperatureControl = ({ value, onChange, maxValue = 1, defaultValue }: TemperatureControlProps) => {
1516
const { t } = useAppTranslation()
1617
const [isCustomTemperature, setIsCustomTemperature] = useState(value !== undefined)
1718
const [inputValue, setInputValue] = useState(value)
@@ -37,7 +38,8 @@ export const TemperatureControl = ({ value, onChange, maxValue = 1 }: Temperatur
3738
if (!isChecked) {
3839
setInputValue(null) // Unset the temperature, note that undefined is unserializable.
3940
} else {
40-
setInputValue(value ?? 0) // Use the value from apiConfiguration, if set.
41+
// Use the value from apiConfiguration, or fallback to model's defaultTemperature, or finally to 0
42+
setInputValue(value ?? defaultValue ?? 0)
4143
}
4244
}}>
4345
<label className="block font-medium mb-1">{t("settings:temperature.useCustom")}</label>

0 commit comments

Comments
 (0)