Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions cmd/odek/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ func run(args []string) error {
NoProjectFile: resolved.NoAgents,
Thinking: resolved.Thinking,
ThinkingBudget: f.ThinkingBudget,
Temperature: 0, // deterministic by default; override with --temperature
Temperature: f.Temp, // 0 = deterministic default; negative = omit from request
Tools: tools,
ToolFilter: odek.ToolFilterConfig{Enabled: resolved.Tools.Enabled, Disabled: resolved.Tools.Disabled},
SandboxCleanup: sandboxCleanup,
Expand Down Expand Up @@ -2404,7 +2404,7 @@ func continueCmd(args []string) error {
UntrustedWrapper: func(source, content string) string { return wrapUntrusted(context.Background(), source, content) },
NoProjectFile: resolved.NoAgents,
Thinking: resolved.Thinking,
Temperature: 0, // deterministic by default; override with --temperature
Temperature: 0, // deterministic by default; continue takes no CLI flags
Tools: tools,
ToolFilter: odek.ToolFilterConfig{Enabled: resolved.Tools.Enabled, Disabled: resolved.Tools.Disabled},
SandboxCleanup: sandboxCleanup,
Expand Down
6 changes: 4 additions & 2 deletions internal/llm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ func (c *Client) sendsThinkingObject() bool {
// temperature parameter. OpenAI reasoning models (o1/o3/o4 families and the
// gpt-5 series) only accept the default temperature (1); sending any other
// value — including odek's deterministic default 0 — returns a 400
// "unsupported_value" error. Matching is model-name-based and
// "unsupported_value" error. Kimi Code models (kimi-for-coding*, k3*) behave
// the same way: the endpoint answers 400 "invalid temperature: only 1 is
// allowed for this model". Matching is model-name-based and
// provider-agnostic, since OpenAI-compatible proxies serving these model
// IDs enforce the same constraint.
func modelForbidsTemperature(model string) bool {
m := strings.ToLower(model)
for _, prefix := range []string{"o1", "o3", "o4", "gpt-5"} {
for _, prefix := range []string{"o1", "o3", "o4", "gpt-5", "kimi-for-coding", "k3"} {
if strings.HasPrefix(m, prefix) {
return true
}
Expand Down
15 changes: 11 additions & 4 deletions internal/llm/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,11 @@ func TestClient_IsAnthropic(t *testing.T) {
}
}

// OpenAI reasoning models (o1/o3/o4, gpt-5 family) reject any explicit
// temperature other than the default (1) with a 400. The client must omit
// the field for those models while still sending odek's deterministic
// default (0) to models that accept it.
// OpenAI reasoning models (o1/o3/o4, gpt-5 family) and Kimi Code models
// (kimi-for-coding*, k3*) reject any explicit temperature other than the
// default (1) with a 400. The client must omit the field for those models
// while still sending odek's deterministic default (0) to models that
// accept it.
func TestCall_OmitsTemperatureForReasoningModels(t *testing.T) {
cases := []struct {
model string
Expand All @@ -1053,9 +1054,15 @@ func TestCall_OmitsTemperatureForReasoningModels(t *testing.T) {
{"o1-preview", false},
{"o4-mini", false},
{"GPT-5-MINI", false}, // case-insensitive
{"kimi-for-coding", false},
{"kimi-for-coding-highspeed", false},
{"k3", false},
{"k3-256k", false},
{"Kimi-For-Coding", false}, // case-insensitive
{"gpt-4o-mini", true},
{"deepseek-chat", true},
{"claude-sonnet-4-5", true},
{"kimi-latest", true}, // Moonshot platform models accept temperature
}

for _, tc := range cases {
Expand Down
Loading