fix(higress): strip provider prefix from extra-provider model names - #8
Merged
Merged
Conversation
OpenAI-compatible upstreams (Ollama Cloud, MiMo, Vanchin/StreamLake)
reject model names carrying the "<provider>/" routing prefix with a
404 — they expect the bare upstream name. The extra-provider routes
created by setup-higress.sh matched on the prefixed name for routing
but left modelMapping empty, so the prefixed name was forwarded
upstream unchanged. This is the OpenClaw bug #67435 / #72353 pattern
applied to custom openai-type providers.
Fix: each extra-provider AI route now carries a regex modelMapping
{"~^<provider>/(.+)$":"$1"} that strips the prefix before the upstream
call, while the route's modelPredicate still matches the prefixed name
for routing. Verified against Higress ai-proxy provider.go
(getMappedModel ~regex branch, re.ReplaceAllString expands $1) and
simulated for ollama/glm-5.2, mimo/mimo-v2.5-pro,
vanchin/kat-coder-pro-v2.5, etc.
Also update the model catalog (known-models.json,
manager-openclaw.json.tmpl, agentconfig/generator.go presets + lists)
to the real provider model IDs (plain, lowercase, no fake -cloud
suffix) with correct context windows and maxTokens — the prior
provisional entries used "ollama/gpt-oss:120b-cloud" / "mimo/MiMo-V2.5-Pro"
which never existed upstream and would 404 even after this fix.
- manager/scripts/init/setup-higress.sh: modelMapping regex on POST
+ PUT (upgrade) paths
- manager/configs/known-models.json: real model IDs, correct ctx/max
- manager/configs/manager-openclaw.json.tmpl: same
- hiclaw-controller/internal/agentconfig/generator.go: presets + lists
go vet clean, agentconfig tests pass.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewClean fix that correctly strips the Files Reviewed (4 files)
Reviewed by mimo-v2.5-pro · Input: 65.3K · Output: 15K · Cached: 386.9K |
nattiini45
added a commit
that referenced
this pull request
Jul 31, 2026
- CreateProviderRoute was creating AI routes with empty modelMapping,
so prefixed model names (ollama/glm-5.2) were forwarded upstream
unchanged and rejected with 404.
- Add the ~regex prefix-strip ({'~^<provider>/(.+)$':'$1'}) matching
the existing fix in setup-higress.sh (PR #8), on both POST and PUT paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
OpenAI-compatible upstreams (Ollama Cloud, MiMo, Vanchin/StreamLake) reject model names carrying the
<provider>/routing prefix with a 404 — they expect the bare upstream name (e.g.gpt-oss:120b, notollama/gpt-oss:120b). The extra-provider AI routes created bysetup-higress.shmatched on the prefixed name for routing but leftmodelMappingempty, so the prefixed name was forwarded upstream unchanged. This is the OpenClaw bug #67435 / #72353 pattern applied to customopenai-type providers.The fix
Each extra-provider AI route now carries a regex
modelMapping:This strips the
<provider>/prefix before the upstream call, while the route'smodelPredicatestill matches the prefixed name for routing. Applied to both the POST (new route) and PUT (upgrade existing route) paths insetup-higress.sh.How it was verified
ai-proxysource (provider.go:getMappedModel): supports~regexkeys with$1capture via Go'sregexp.ReplaceAllString. Confirmed by reading the source.regexpsemantics (not Python's\1):ollama/gpt-oss:120b→gpt-oss:120b✅ollama/glm-5.2→glm-5.2✅ollama/kimi-k2.7-code→kimi-k2.7-code✅mimo/mimo-v2.5-pro→mimo-v2.5-pro✅vanchin/kat-coder-pro-v2→kat-coder-pro-v2✅vanchin/kat-coder-pro-v2.5→kat-coder-pro-v2.5✅bash -n setup-higress.sh— syntax validgo build ./...— compiles cleango vet ./...— cleango test ./internal/agentconfig/...— passesModel catalog (also fixed)
Updated the 3 source spots (
known-models.json,manager-openclaw.json.tmpl,agentconfig/generator.gopresets + lists) with the real provider model IDs and correct context windows / maxTokens. The prior provisional entries usedollama/gpt-oss:120b-cloud(the-cloudsuffix doesn't exist upstream) andmimo/MiMo-V2.5-Pro(capitalized; MiMo's API wants lowercasemimo-v2.5-pro) — both would 404 even after this fix.New entries:
ollama/gpt-oss:120b,ollama/glm-5.2,ollama/glm-5.1,ollama/kimi-k2.7-codemimo/mimo-v2.5,mimo/mimo-v2.5-provanchin/kat-coder-pro-v2(reasoning:false, 32k max),vanchin/kat-coder-pro-v2.5(reasoning:false, 64k max)Files changed (4)
manager/scripts/init/setup-higress.sh—modelMappingregex on POST + PUT pathsmanager/configs/known-models.json— real model IDs, correct ctx/maxmanager/configs/manager-openclaw.json.tmpl— samehiclaw-controller/internal/agentconfig/generator.go— presets + listsgo vetclean, agentconfig tests pass.🤖 This PR was generated by Rumi (Caspar's AI assistant) after live-verifying all 4 upstream providers against the actual APIs and confirming the root cause against the Higress source code.