Files
magpie/docs
yetoneandZhuoyuan Hao 9b376de163 gateway: a Gemini model's levels above high come from its provider too (#6871, hhh2210)
withGeminiEffort (decide.go) and geminiLevelFor (gemini_level_body.go)
let a level above high through only where models.dev's catalog lists
it (catalog.EffortsOf). A model a plugin or relay lists that models.dev
doesn't have, such as ai-studio's gemini-4-hydrogen-search with
low/medium/high/xhigh, had agy's xhigh or max sent as high, after the
candidate step had already fitted it to xhigh from p.Efforts.

withGeminiEffortFor and geminiLevelForEfforts now take the provider's
levels (p.Efforts(model)) first and fall back to the catalog's; the four
withModelEffort sites in serve and passthrough's onEffort retry, and
geminiLevelBody, pass them. A model whose levels stop at high is still
asked high. Left as they were: aiStudioThinking and withFixedEffort
(no provider in scope there). Ported from hhh2210's
hhh2210/magpie#3 (8dd4c5f6e), the doc line reapplied by hand on
today's gateway-routing.md.

Broken by hand: with the tests alone on origin/main, both new tests
are red (gemini-4-hydrogen-search sent "high" for xhigh and max on
Gemini and Chat upstreams, output_config {"effort":"high"} on an
Anthropic relay); the high-only gemini-4-carbon-search case stays high
either way.

Run on mote at b394095c7 (origin/main ccae8e821 + this): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... ok; go build, GOOS=linux and GOOS=windows builds ok; go test
-tags nogui -count=1 -timeout 45m ./... under a sandbox HOME: 101
packages ok, none failed (internal/gateway 993s).
Rebased onto 2896e82cc (one Claude image commit in internal/gateway);
at 4e9533cdb go vet ./internal/gateway ok and go test -tags nogui
./internal/gateway ok (924s).

Not tried: a live ai-studio/gemini-4-hydrogen-search request. Not
changed: #6778 (dsh writes no forceAdaptiveThinking for
agy-cli/gemini-4-hydrogen on magpie-anthropic), which is the agent
wiring's per-model compat, not this fit.

Co-authored-by: Zhuoyuan Hao <hzy2210@gmail.com>
2026-11-16 21:10:12 +08:00
..