Skip to content

Fix: Fixed models returning '404 model not found' when using :THINKING suffix - #1

Closed
stargazer617 wants to merge 9 commits into
chutesai:mainfrom
stargazer617:fix/thinking-suffix-404
Closed

Fix: Fixed models returning '404 model not found' when using :THINKING suffix#1
stargazer617 wants to merge 9 commits into
chutesai:mainfrom
stargazer617:fix/thinking-suffix-404

Conversation

@stargazer617

@stargazer617 stargazer617 commented Apr 19, 2026

Copy link
Copy Markdown

Bug

Sending messages to models with the :THINKING suffix returns a 404 model not found error.

For example, sending a test message to zai-org/GLM-5.1-TEE:THINKING returns:

Status Code:

404

Response Body:

{
  "error": {
    "message": "model 'zai-org/GLM-5.1-TEE:THINKING' not found",
    "type": "proxy_error"
  }
}

Whereas sending the same message to zai-org/GLM-5.1-TEE works as expected.

Root Cause

I believe this is because in e2ee_discovery.lua, the proxy calls:

local entry = map[model]
return check_confidential(model, entry)

But in the fetch_model_map() function, the model map is populated from the v1/models endpoint:

local map = {}
    for _, model in ipairs(data.data) do
        if model.id and model.chute_id then
            map[model.id] = {
                chute_id = model.chute_id,
                confidential = model.confidential_compute == true,
            }
        end
    end

The v1/models endpoint only returns the models' base names, without any variants or suffixes. For example, for GLM 5.1, the ID is zai-org/GLM-5.1-TEE. So if we make a request with the model zai-org/GLM-5.1-TEE:THINKING, the entry would be null, as the model map only contains zai-org/GLM-5.1-TEE, and not the suffixed variant.

Then, since entry is null, this line in check_confidential():

if not entry then return nil, "model '" .. model .. "' not found" end

returns model 'zai-org/GLM-5.1-TEE:THINKING' not found.

Fix

This pull request aims to fix this issue by stripping the :THINKING suffix from the model name before looking the model up in the model map.

@stargazer617
stargazer617 marked this pull request as draft April 19, 2026 10:11
@stargazer617
stargazer617 marked this pull request as ready for review April 20, 2026 08:00
sirouk and others added 6 commits April 21, 2026 13:15
Stripping any ":" suffix in resolve_chute_id masks unknown suffixes
(e.g. LoRA adapter names) by silently resolving them to the base
chute, after which vLLM emits a confusing "LoRA adapter X not found"
error.

Only strip :THINKING — the one suffix the proxy knows how to handle.
Other suffixes are now passed through unchanged so discovery fails
with a clear "model not found" error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Equivalent to the previous :sub-based check but reads more naturally.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The prefix list, exact-match list, and MiMo-V2-Flash special case
mirror chutes-api's invocation router. Hoist them to top-level
constants so the coupling is visible at a glance, and add a comment
noting that /v1/models exposes a "reasoning" capability but not the
per-model default value — which is why we still duplicate the list
here.

No behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Standalone LuaJIT tests stub ngx/cjson/resty.http and exercise
handle_thinking across 19 scenarios:

  - :THINKING suffix strip + flag set
  - X-Enable-Thinking header (true / false / TRUE)
  - Key normalization (thinking/enable_thinking)
  - Per-model prefix defaults (GLM-4.7, Kimi-K2.5, DeepSeek-V3.2-Speciale)
  - Per-model exact defaults (TEE variants)
  - MiMo-V2-Flash default-off
  - User overrides (explicit false, :THINKING on MiMo)
  - Edge cases (mid-string :THINKING, unrelated kwargs preserved)

Run with: luajit tests/test_thinking.lua

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR1 follow-up: tighten :THINKING handling, add lua tests
Bringing branch up to date

@fstandhartinger fstandhartinger left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@sirouk

sirouk commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Superseded by #2 — moved the :THINKING handling to e2ee_round_trip
and dropped the per-model defaults. Thanks for catching the 404 and
for the back-and-forth. Your investigation is what made it clear
where the real chokepoint was.

@sirouk

sirouk commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

Opened #2 to supersede this — moved the :THINKING handling to
e2ee_round_trip and dropped the per-model defaults per the review
discussion. Thanks for catching the 404 and for the back-and-forth.
Your investigation is what made it clear where the real chokepoint
was. Feel free to close this out.

@stargazer617
stargazer617 deleted the fix/thinking-suffix-404 branch April 24, 2026 19:58
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.

3 participants