Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(models): correct four vendor request shapes that contradict the docs (#3489)

lyingbug9aa63c866ff4
diff --git a/internal/models/api/openaicompletions/golden_test.go b/internal/models/api/openaicompletions/golden_test.go
index 33898a63a..21cea7394 100644
--- a/internal/models/api/openaicompletions/golden_test.go
+++ b/internal/models/api/openaicompletions/golden_test.go
@@ -167,6 +167,36 @@ func TestGolden(t *testing.T) {
stream: false,
want: map[string]any{"enable_thinking": false, "thinking_budget": nil},
},
+ {
+ name: "dashscope qwen3.8: effort and budget are mutually exclusive, budget yields",
+ mutate: func(c *Config) {
+ c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking
+ c.Settings.ThinkingBudgetField = "thinking_budget"
+ c.Settings.ThinkingBudgetExcludesEffort = true
+ c.Settings.SupportsReasoningEffort = true
+ c.ThinkingLevels = api.ThinkingLevelMap{api.ReasoningMax: api.StringPtr("xhigh")}
+ },
+ opts: &api.Options{
+ Thinking: ptrBool(true), ReasoningEffort: api.ReasoningMax, ThinkingBudgetTokens: 4096,
+ },
+ stream: true,
+ want: map[string]any{
+ "enable_thinking": true, "reasoning_effort": "xhigh", "thinking_budget": nil,
+ },
+ },
+ {
+ name: "dashscope qwen3.8: budget still rides along when no effort is graded",
+ mutate: func(c *Config) {
+ c.Settings.ThinkingFormat = catalog.ThinkingFormatEnableThinking
+ c.Settings.ThinkingBudgetField = "thinking_budget"
+ c.Settings.ThinkingBudgetExcludesEffort = true
+ },
+ opts: &api.Options{Thinking: ptrBool(true), ThinkingBudgetTokens: 4096},
+ stream: true,
+ want: map[string]any{
+ "enable_thinking": true, "reasoning_effort": nil, "thinking_budget": float64(4096),
+ },
+ },
{
name: "dashscope hybrid streaming: enable_thinking true with budget",
mutate: func(c *Config) {
diff --git a/internal/models/api/openaicompletions/request.go b/internal/models/api/openaicompletions/request.go
index 67ddf8836..69f2b2a2b 100644
--- a/internal/models/api/openaicompletions/request.go
+++ b/internal/models/api/openaicompletions/request.go
@@ -342,8 +342,18 @@ func (c *Client) applyThinking(body map[string]any, opts *api.Options, stream bo
effort = levels.Value(level)
}
effortField := orDefault(s.ReasoningEffortField, "reasoning_effort")
- if enabled && opts != nil && opts.ThinkingBudgetTokens > 0 && s.ThinkingBudgetField != "" {
- body[s.ThinkingBudgetField] = opts.ThinkingBudgetTokens
+ budget := 0
+ if enabled && opts != nil && s.ThinkingBudgetField != "" {
+ budget = opts.ThinkingBudgetTokens
+ }
+ if effort != "" && s.ThinkingBudgetExcludesEffort {
+ // The two fields are mutually exclusive on this vendor and sending
+ // both is an error; the graded level wins because it is what the
+ // caller picked.
+ budget = 0
+ }
+ if budget > 0 {
+ body[s.ThinkingBudgetField] = budget
}
switch s.ThinkingFormat {
diff --git a/internal/models/catalog/compat.go b/internal/models/catalog/compat.go
index fd8359ed0..0fb7b69b0 100644
--- a/internal/models/catalog/compat.go
+++ b/internal/models/catalog/compat.go
@@ -36,31 +36,32 @@ const (
// Chat Completions settings. JSON keys are the documented names used in
// models.json and config/models.json.
type OpenAICompletionsCompat struct {
- MaxTokensField *string `json:"max_tokens_field,omitempty"`
- ThinkingFormat *ThinkingFormat `json:"thinking_format,omitempty"`
- ThinkingEnabledValue *string `json:"thinking_enabled_value,omitempty"`
- ThinkingAlwaysSend *bool `json:"thinking_always_send,omitempty"`
- ThinkingDisableOnNonStream *bool `json:"thinking_disable_on_non_stream,omitempty"`
- ThinkingBudgetField *string `json:"thinking_budget_field,omitempty"`
- ReasoningEffortField *string `json:"reasoning_effort_field,omitempty"`
- SupportsReasoningEffort *bool `json:"supports_reasoning_effort,omitempty"`
- SupportsDeveloperRole *bool `json:"supports_developer_role,omitempty"`
- SupportsStore *bool `json:"supports_store,omitempty"`
- SupportsUsageInStreaming *bool `json:"supports_usage_in_streaming,omitempty"`
- SupportsTemperature *bool `json:"supports_temperature,omitempty"`
- FixedTemperature *float64 `json:"fixed_temperature,omitempty"`
- SupportsSeed *bool `json:"supports_seed,omitempty"`
- ToolChoiceModes []string `json:"tool_choice_modes,omitempty"`
- SupportsParallelToolCalls *bool `json:"supports_parallel_tool_calls,omitempty"`
- SupportsResponseFormat *bool `json:"supports_response_format,omitempty"`
- SupportsMultiContent *bool `json:"supports_multi_content,omitempty"`
- ReplayReasoningContent *bool `json:"replay_reasoning_content,omitempty"`
- PromptCacheKey *bool `json:"prompt_cache_key,omitempty"`
- CacheControlFormat *string `json:"cache_control_format,omitempty"`
- PromptCacheAccounting *bool `json:"prompt_cache_accounting,omitempty"`
- ToolCallExtraFields []string `json:"tool_call_extra_fields,omitempty"`
- ExtraBody map[string]any `json:"extra_body,omitempty"`
- ReasoningFields []string `json:"reasoning_fields,omitempty"`
+ MaxTokensField *string `json:"max_tokens_field,omitempty"`
+ ThinkingFormat *ThinkingFormat `json:"thinking_format,omitempty"`
+ ThinkingEnabledValue *string `json:"thinking_enabled_value,omitempty"`
+ ThinkingAlwaysSend *bool `json:"thinking_always_send,omitempty"`
+ ThinkingDisableOnNonStream *bool `json:"thinking_disable_on_non_stream,omitempty"`
+ ThinkingBudgetField *string `json:"thinking_budget_field,omitempty"`
+ ThinkingBudgetExcludesEffort *bool `json:"thinking_budget_excludes_effort,omitempty"`
+ ReasoningEffortField *string `json:"reasoning_effort_field,omitempty"`
+ SupportsReasoningEffort *bool `json:"supports_reasoning_effort,omitempty"`
+ SupportsDeveloperRole *bool `json:"supports_developer_role,omitempty"`
+ SupportsStore *bool `json:"supports_store,omitempty"`
+ SupportsUsageInStreaming *bool `json:"supports_usage_in_streaming,omitempty"`
+ SupportsTemperature *bool `json:"supports_temperature,omitempty"`
+ FixedTemperature *float64 `json:"fixed_temperature,omitempty"`
+ SupportsSeed *bool `json:"supports_seed,omitempty"`
+ ToolChoiceModes []string `json:"tool_choice_modes,omitempty"`
+ SupportsParallelToolCalls *bool `json:"supports_parallel_tool_calls,omitempty"`
+ SupportsResponseFormat *bool `json:"supports_response_format,omitempty"`
+ SupportsMultiContent *bool `json:"supports_multi_content,omitempty"`
+ ReplayReasoningContent *bool `json:"replay_reasoning_content,omitempty"`
+ PromptCacheKey *bool `json:"prompt_cache_key,omitempty"`
+ CacheControlFormat *string `json:"cache_control_format,omitempty"`
+ PromptCacheAccounting *bool `json:"prompt_cache_accounting,omitempty"`
+ ToolCallExtraFields []string `json:"tool_call_extra_fields,omitempty"`
+ ExtraBody map[string]any `json:"extra_body,omitempty"`
+ ReasoningFields []string `json:"reasoning_fields,omitempty"`
}
// OpenAICompletionsSettings is the resolved (fully defaulted) form.
@@ -79,6 +80,12 @@ type OpenAICompletionsSettings struct {
ThinkingDisableOnNonStream bool
// ThinkingBudgetField carries Options.ThinkingBudgetTokens ("thinking_budget").
ThinkingBudgetField string
+ // ThinkingBudgetExcludesEffort marks a vendor that rejects a request
+ // carrying both the budget and the effort (DashScope's qwen3.8-max
+ // series: "不支持 reasoning_effort 与 thinking_budget 同时设置,同时设置
+ // 会报错"). The graded level is what the caller actually picked, so the
+ // budget is the field that yields.
+ ThinkingBudgetExcludesEffort bool
// ReasoningEffortField is "reasoning_effort" unless a vendor renames it.
ReasoningEffortField string
SupportsReasoningEffort bool
diff --git a/internal/models/vendors/aliyun/models.json b/internal/models/vendors/aliyun/models.json
index 506413ca2..0e8d085b0 100644
--- a/internal/models/vendors/aliyun/models.json
+++ b/internal/models/vendors/aliyun/models.json
@@ -6,7 +6,7 @@
{"name": "Qwen3.5 family (hybrid thinking)", "match": "qwen3.5*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"name": "Qwen3.6 family (hybrid thinking)", "match": "qwen3.6*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"name": "Qwen3.7 family (hybrid thinking)", "match": "qwen3.7*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
- {"name": "Qwen3.8 family (hybrid thinking)", "match": "qwen3.8*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
+ {"name": "Qwen3.8 family (hybrid thinking)", "match": "qwen3.8*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
{"name": "qwen-plus family (hybrid thinking)", "match": "qwen-plus*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"name": "qwen-max family (hybrid thinking)", "match": "qwen-max*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"name": "qwen-turbo family (hybrid thinking)", "match": "qwen-turbo*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
@@ -16,8 +16,8 @@
{"name": "Kimi K2 family on DashScope (hybrid thinking)", "match": "kimi-k2*", "reasoning": true, "input": ["text", "image"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"name": "GLM-5 family on DashScope (hybrid thinking)", "match": "glm-5*", "reasoning": true, "input": ["text"], "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
- {"id": "qwen3.8-max", "name": "Qwen3.8 Max", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.77744, "output": 5.33231, "cache_read": 0.22218, "cache_write": 2.22179}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
- {"id": "qwen3.8-flash", "name": "Qwen3.8 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.11875, "output": 0.40073, "cache_read": 0.01187, "cache_write": 0.14844}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
+ {"id": "qwen3.8-max", "name": "Qwen3.8 Max", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.77744, "output": 5.33231, "cache_read": 0.22218, "cache_write": 2.22179}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
+ {"id": "qwen3.8-flash", "name": "Qwen3.8 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.11875, "output": 0.40073, "cache_read": 0.01187, "cache_write": 0.14844}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true, "supports_reasoning_effort": true, "thinking_budget_excludes_effort": true}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "medium", "high": "medium", "xhigh": "xhigh", "max": "xhigh"}},
{"id": "qwen3.7-max", "name": "Qwen3.7 Max", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 2.5, "output": 7.5, "cache_read": 0.5, "cache_write": 3.125}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"id": "qwen3.7-plus", "name": "Qwen3.7 Plus", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 64000, "cost": {"input": 0.5, "output": 3, "cache_read": 0.05, "cache_write": 0.625}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
{"id": "qwen3.7-flash", "name": "Qwen3.7 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.02962, "output": 0.1185, "cache_read": 0.002962, "cache_write": 0.03703}, "compat": {"thinking_always_send": true, "thinking_disable_on_non_stream": true}},
diff --git a/internal/models/vendors/aliyun/vendor.go b/internal/models/vendors/aliyun/vendor.go
index cc9734764..c23360f4d 100644
--- a/internal/models/vendors/aliyun/vendor.go
+++ b/internal/models/vendors/aliyun/vendor.go
@@ -36,8 +36,10 @@
// qwen3.7-max-2026-05-17, qwen3-next-80b-a3b-thinking. Those carry
// "off": null;
// - `reasoning_effort` IS accepted in the compatible mode, but only on some
-// families: qwen3.8 takes low | medium | xhigh (default xhigh, and it may
-// not be combined with `thinking_budget`), DeepSeek-V4 takes high | max
+// families: qwen3.8 takes low | medium | xhigh (default xhigh; "不支持
+// reasoning_effort 与 thinking_budget 同时设置,同时设置会报错", which
+// those entries carry as thinking_budget_excludes_effort so the budget
+// yields to the level), DeepSeek-V4 takes high | max
// (plus low on the dated -0813 / -0731 snapshots), glm-5.3 takes
// low | high | max. It is therefore off at the vendor level and enabled
// per entry;
diff --git a/internal/models/vendors/deepseek/vendor.go b/internal/models/vendors/deepseek/vendor.go
index 792e30f28..0f1756370 100644
--- a/internal/models/vendors/deepseek/vendor.go
+++ b/internal/models/vendors/deepseek/vendor.go
@@ -16,8 +16,11 @@
// effect in thinking mode, where values below 0.95 are treated as 0.95;
// presence_penalty / frequency_penalty are "no longer supported" and are
// silently dropped by the vendor;
-// - tool_choice accepts none / auto / required / a named function, i.e. the
-// plain OpenAI set, so no restriction is configured here;
+// - tool_choice lists none / auto / required / a named function, but the
+// reference adds that "required and named tool choices are not supported
+// in thinking mode; the API returns a 400 error". Thinking is the
+// documented default, and the compat model cannot make the restriction
+// conditional on it, so only none / auto are ever sent;
// - assistant turns must replay `reasoning_content` when the request
// carries `tools`; without `tools` the vendor ignores it;
// - usage reports `prompt_cache_hit_tokens` / `prompt_cache_miss_tokens`
@@ -91,6 +94,9 @@ func init() {
SupportsReasoningEffort: catalog.Ptr(true),
PromptCacheAccounting: catalog.Ptr(true),
SupportsStore: catalog.Ptr(false),
+ // `required` and named functions 400 while thinking is on,
+ // which is the default on every current model.
+ ToolChoiceModes: []string{"none", "auto"},
},
},
// DeepSeek grades effort as low / high / max (plus `none`, which the
diff --git a/internal/models/vendors/nvidia/models.json b/internal/models/vendors/nvidia/models.json
index 9d0a0f745..23d11d528 100644
--- a/internal/models/vendors/nvidia/models.json
+++ b/internal/models/vendors/nvidia/models.json
@@ -5,10 +5,10 @@
{"id": "nvidia/nemotron-3-ultra-550b-a55b", "name": "Nemotron 3 Ultra 550B-A55B", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 65536, "cost": {"input": 0.5, "output": 2.5, "cache_read": 0.15}},
{"id": "nvidia/nemotron-3-super-120b-a12b", "name": "Nemotron 3 Super 120B-A12B", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 262144, "cost": {"input": 0.2, "output": 0.8}},
{"id": "nvidia/nemotron-3.5-lightning-30b-a3b", "name": "Nemotron 3.5 Lightning 30B-A3B", "reasoning": true, "input": ["text"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0, "output": 0}},
- {"id": "z-ai/glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},
+ {"id": "z-ai/glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"thinking_format": "openai", "supports_reasoning_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},
{"id": "deepseek-ai/deepseek-v4-pro-0813", "name": "DeepSeek V4 Pro", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 0.435, "output": 0.87, "cache_read": 0.003625}},
{"id": "deepseek-ai/deepseek-v4-flash-0731", "name": "DeepSeek V4 Flash", "reasoning": true, "input": ["text"], "context_window": 1048576, "max_output_tokens": 393216, "cost": {"input": 0.14, "output": 0.28, "cache_read": 0.0028}},
- {"id": "moonshotai/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"max_tokens_field": "max_completion_tokens"}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},
+ {"id": "moonshotai/kimi-k3", "name": "Kimi K3", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1048576, "max_output_tokens": 131072, "cost": {"input": 0, "output": 0}, "compat": {"max_tokens_field": "max_completion_tokens", "thinking_format": "openai", "supports_reasoning_effort": true}, "thinking_levels": {"off": null, "minimal": "low", "medium": "high", "xhigh": "max", "max": "max"}},
{"id": "moonshotai/kimi-k2.6", "name": "Kimi K2.6", "reasoning": true, "input": ["text", "image", "video"], "context_window": 262144, "max_output_tokens": 262144, "cost": {"input": 0, "output": 0}},
{"id": "google/gemma-4-31b-it", "name": "Gemma 4 31B IT", "reasoning": true, "input": ["text", "image", "video"], "context_window": 256000, "max_output_tokens": 16384, "cost": {"input": 0, "output": 0}, "compat": {"max_tokens_field": "max_completion_tokens", "thinking_format": "none"}},
{"id": "nvidia/nv-embed-v1", "name": "NV-Embed v1", "type": "Embedding", "dimension": 4096, "context_window": 32768},
diff --git a/internal/models/vendors/nvidia/vendor.go b/internal/models/vendors/nvidia/vendor.go
index 425fcfd0e..06d1ff595 100644
--- a/internal/models/vendors/nvidia/vendor.go
+++ b/internal/models/vendors/nvidia/vendor.go
@@ -21,7 +21,10 @@
// defaulting to max, MiniMax M3 takes `thinking_mode`, and Gemma 4
// switches thinking with a `<|think|>` token in the system prompt rather
// than any parameter — which is why the gemma entry sets thinking_format
-// "none" instead of pretending a switch exists;
+// "none" instead of pretending a switch exists. The entries that grade
+// with a top-level `reasoning_effort` carry thinking_format "openai";
+// without it the vendor default would emit a chat-template switch and
+// drop the level, leaving the picker's rungs inert;
// - most hosted endpoints are metered at zero cost; the Nemotron and
// DeepSeek endpoints are priced.
//
@@ -39,7 +42,11 @@
// current llama-nemotron-rerank-vl-1b-v2;
// - DeepSeek on NIM wants `reasoning_effort` nested inside
// chat_template_kwargs, which this compat model cannot express: it emits
-// either a chat-template switch or a top-level effort, never both.
+// either a chat-template switch or a top-level effort, never both;
+// - the kimi-k3 card states "Thinking is always enabled" and advertises
+// "configurable low, high, or max reasoning effort", but none of its
+// samples show the parameter. The entry assumes the top-level
+// `reasoning_effort` its first-party API documents.
package nvidia
import (
diff --git a/internal/models/vendors/vendors_test.go b/internal/models/vendors/vendors_test.go
index b895d571a..6aee47ea8 100644
--- a/internal/models/vendors/vendors_test.go
+++ b/internal/models/vendors/vendors_test.go
@@ -268,6 +268,40 @@ func TestFamilyExpectations(t *testing.T) {
if r := resolve(t, "deepseek", "deepseek-reasoner"); r.ThinkingLevels.Supports(api.ReasoningOff) {
t.Error("deepseek/deepseek-reasoner should not allow thinking off")
}
+ // required / named tool choices 400 in thinking mode, which is the
+ // DeepSeek default, so neither may reach the wire.
+ if r := resolve(t, "deepseek", "deepseek-v4-pro"); r.OpenAICompletions.AllowsToolChoice("required") ||
+ r.OpenAICompletions.AllowsToolChoice("function") {
+ t.Error("deepseek should not send required or named tool choices")
+ }
+ // GLM-5.2 reads "minimal" as give-up-thinking and folds "low" to high, so
+ // rewriting minimal to low here would send the weakest rung as the
+ // strongest one.
+ if r := resolve(t, "zhipu", "glm-5.2"); r.ThinkingLevels.Value(api.ReasoningMinimal) != "minimal" {
+ t.Errorf("zhipu/glm-5.2 minimal should stay minimal, got %q", r.ThinkingLevels.Value(api.ReasoningMinimal))
+ }
+ // Both entries grade with a top-level reasoning_effort; the vendor
+ // default (chat_template_kwargs) would silently drop the level.
+ for _, model := range []string{"z-ai/glm-5.3", "moonshotai/kimi-k3"} {
+ r := resolve(t, "nvidia", model)
+ if r.OpenAICompletions.ThinkingFormat != catalog.ThinkingFormatOpenAI ||
+ !r.OpenAICompletions.SupportsReasoningEffort {
+ t.Errorf("nvidia/%s should grade with a top-level reasoning_effort", model)
+ }
+ }
+ if r := resolve(t, "nvidia", "nvidia/nemotron-3-ultra-550b-a55b"); r.OpenAICompletions.ThinkingFormat !=
+ catalog.ThinkingFormatChatTemplateKwargs {
+ t.Error("nvidia nemotron should keep the chat-template switch")
+ }
+ // DashScope errors when qwen3.8-max gets both fields.
+ for _, model := range []string{"qwen3.8-max", "qwen3.8-flash", "qwen3.8-plus-2026-09-01"} {
+ if r := resolve(t, "aliyun", model); !r.OpenAICompletions.ThinkingBudgetExcludesEffort {
+ t.Errorf("aliyun/%s should not send thinking_budget next to reasoning_effort", model)
+ }
+ }
+ if r := resolve(t, "aliyun", "qwen3-max"); r.OpenAICompletions.ThinkingBudgetExcludesEffort {
+ t.Error("aliyun/qwen3-max has no effort to conflict with and should keep the budget")
+ }
}
func TestHooks(t *testing.T) {
diff --git a/internal/models/vendors/zhipu/models.json b/internal/models/vendors/zhipu/models.json
index 1eba71ee0..05f578eda 100644
--- a/internal/models/vendors/zhipu/models.json
+++ b/internal/models/vendors/zhipu/models.json
@@ -4,7 +4,7 @@
"models": [
{"id": "glm-5.3", "name": "GLM-5.3", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3"},
{"id": "glm-5.3-flash", "name": "GLM-5.3 Flash", "reasoning": true, "input": ["text", "image", "video"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 0.075, "output": 0.25, "cache_read": 0.015}, "thinking_levels": {"off": null, "minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/vlm/glm-5.3-flash"},
- {"id": "glm-5.2", "name": "GLM-5.2", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"minimal": "low", "low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.2"},
+ {"id": "glm-5.2", "name": "GLM-5.2", "reasoning": true, "input": ["text"], "context_window": 1000000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "thinking_levels": {"low": "low", "medium": "high", "high": "high", "xhigh": "max", "max": "max"}, "source": "https://docs.bigmodel.cn/cn/guide/models/text/glm-5.2"},
{"id": "glm-5.1", "name": "GLM-5.1", "reasoning": true, "input": ["text"], "context_window": 200000, "max_output_tokens": 131072, "cost": {"input": 1.4, "output": 4.4, "cache_read": 0.26}, "compat": {"supports_reasoning_effort": false}},
{"id": "glm-5", "name": "GLM-5", "reasoning": true, "input": ["text"], "context_window": 204800, "max_output_tokens": 131072, "cost": {"input": 1, "output": 3.2, "cache_read": 0.2}, "compat": {"supports_reasoning_effort": false}},
{"id": "glm-5v-turbo", "name": "GLM-5V Turbo", "reasoning": true, "input": ["text", "image", "video"], "context_window": 200000, "max_output_tokens": 131072, "cost": {"input": 5, "output": 22, "cache_read": 1.2}, "compat": {"supports_reasoning_effort": false}},
diff --git a/internal/models/vendors/zhipu/vendor.go b/internal/models/vendors/zhipu/vendor.go
index e528f66e7..24086d18a 100644
--- a/internal/models/vendors/zhipu/vendor.go
+++ b/internal/models/vendors/zhipu/vendor.go
@@ -19,7 +19,10 @@
// off -> "none";
// - per-model effort ladders narrow that set: GLM-5.3 and GLM-5.3-Flash
// only take low / high / max, and GLM-5.2 maps none|minimal to "no
-// thinking", low|medium to high and xhigh to max;
+// thinking", low|medium to high and xhigh to max. That folding is the
+// platform's own, so GLM-5.2 keeps sending "minimal" and "low"
+// verbatim: rewriting minimal to "low" here would turn the weakest rung
+// into the strongest one, because the platform then folds it to high;
// - GLM-5.3 and GLM-5.3-Flash/FlashX always think: `thinking.type` "限制只
// 能开启", so both carry "off": null
// (https://docs.bigmodel.cn/cn/guide/models/text/glm-5.3,
diff --git a/website-docs/03-features/06-models.md b/website-docs/03-features/06-models.md
index 818449a9e..d236d6090 100644
--- a/website-docs/03-features/06-models.md
+++ b/website-docs/03-features/06-models.md
@@ -199,6 +199,7 @@ builtin_models:
| `thinking_format` | `openai`(`reasoning_effort`)、`thinking-type`(`thinking.type`)、`enable-thinking`(`enable_thinking` + `thinking_budget`)、`chat-template-kwargs`(vLLM)、`openrouter`(`reasoning`)、`none` | 见各厂商 |
| `supports_reasoning_effort` | 是否额外发 `reasoning_effort` | DeepSeek、智谱、火山、OpenAI |
| `thinking_always_send` / `thinking_disable_on_non_stream` | 每次请求都钉开关;非流式强制关 | 百炼混合思考模型 |
+| `thinking_budget_excludes_effort` | 厂商禁止 `thinking_budget` 与 `reasoning_effort` 同发,发了报错;置真时按档位优先、丢掉预算 | 百炼 qwen3.8 系列 |
| `supports_temperature` / `fixed_temperature` | 推理模型拒绝采样参数;Moonshot v1 固定 1 | GPT-5 / o 系列、Kimi K2.5+ |
| `tool_choice_modes` | 允许的 `tool_choice` 取值 | DeepSeek 思考模式不支持 `required` |
| `replay_reasoning_content` | 多轮回传 `reasoning_content` | DeepSeek、MiMo、Kimi |