Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/types/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
13 changes: 13 additions & 0 deletions packages/types/src/providers/moonshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, ModelInfo>

export const MOONSHOT_DEFAULT_TEMPERATURE = 0.6
1 change: 1 addition & 0 deletions webview-ui/src/components/settings/ApiOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ const ApiOptions = ({
value={apiConfiguration.modelTemperature}
onChange={handleInputChange("modelTemperature", noTransform)}
maxValue={2}
defaultValue={selectedModelInfo?.defaultTemperature}
/>
)}
<RateLimitSecondsControl
Expand Down
6 changes: 4 additions & 2 deletions webview-ui/src/components/settings/TemperatureControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ interface TemperatureControlProps {
value: number | undefined | null
onChange: (value: number | undefined | null) => 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)
Expand All @@ -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)
}
}}>
<label className="block font-medium mb-1">{t("settings:temperature.useCustom")}</label>
Expand Down