Skip to content

fix: omit thinking field for GLM-5.3 / GLM-5.3-Flash - #130

Merged
OnesoftQwQ merged 1 commit into
masterfrom
fix/glm5.3-thinking-param
Sep 14, 2026
Merged

OnesoftQwQ merged 1 commit into
masterfrom
fix/glm5.3-thinking-param

Conversation

@OnesoftQwQ

Copy link
Copy Markdown
Owner

Changes

1. New model capability: supportsThinkingParam

  • Added supportsThinkingParam (default true) to ModelMeta, ModelMetaOverride and OpenCodeGoModelItem, wired through the catalog merge chain and getCatalogModelConfig().
  • When false, the OpenAI Chat and Anthropic adapters omit the top-level thinking field entirely, and buildReasoningEnum() stops offering the "禁用思考" option since no request may disable thinking.
  • Applied the same opt-out to both vision-proxy request builders in provider.ts.

2. GLM-5.3 / GLM-5.3-Flash overrides

  • Marked glm-5.3 and glm-5.3-flash as thinkingMode: "always" + supportsThinkingParam: false in MODEL_OVERRIDES.
  • These models always think and their upstream rejects the thinking field with 400 json: unknown field "thinking" (issue 400 Error when using GLM5.3 flash #129); requests now carry only reasoning_effort (low/high/max) to control thinking strength, which matches the vendor migration guidance ("off" maps to the lowest tier).
  • Fixed both variants, not just flash, since they share the same always-thinking route.

3. Regression coverage and docs

  • Added scripts/test-thinking-param.mjs covering the omitted field (OpenAI + Anthropic adapters), the retained reasoning_effort, and the picker no longer exposing "禁用思考" while glm-5.2 keeps it.
  • Registered the new script in npm test and synced docs/architecture.md, docs/reference.md and docs/build.md.

Files Changed

File Change
src/modelOverrides.ts Added supportsThinkingParam override field and the GLM-5.3 / GLM-5.3-Flash entries.
src/catalogModels.ts Propagated the capability through ModelMeta and hid the unsupported off switch in the reasoning enum.
src/openai/openaiApi.ts Omits the thinking field when the route rejects it.
src/anthropic/anthropicApi.ts Same opt-out for the Anthropic-compatible adapter.
src/provider.ts Applies the opt-out in both vision-proxy request builders.
src/types.ts Added supportsThinkingParam to the model config interface.
scripts/test-thinking-param.mjs New regression test for the omitted field and picker enumeration.
package.json Registered the new test script in npm test.
docs/architecture.md, docs/reference.md, docs/build.md Documented the capability, the overrides and the new test script.

GLM-5.3 and GLM-5.3-Flash always think and their upstream route rejects
the Chat Completions thinking field outright (HTTP 400
'json: unknown field "thinking"'), so every request to these models
failed. Thinking strength is controlled only through reasoning_effort
(low/high/max).

- Add a supportsThinkingParam model capability (default true) and wire it
  through ModelMeta, ModelMetaOverride and OpenCodeGoModelItem.
- Omit the thinking field in the OpenAI/Anthropic adapters and in both
  vision-proxy request builders when the route rejects it.
- Mark glm-5.3 / glm-5.3-flash as thinkingMode "always" +
  supportsThinkingParam false so the picker no longer offers an off
  switch the endpoint cannot honour.
- Add scripts/test-thinking-param.mjs regression coverage and sync
  architecture/reference/build docs.

Fixes #129
@OnesoftQwQ
OnesoftQwQ merged commit 57beaeb into master Sep 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant