bodyEffort read a request's reasoning effort for Chat
(reasoning_effort), Responses (reasoning.effort, or its last
configuration_update's) and Anthropic (output_config.effort), and had
no Gemini branch: a request to a Gemini native endpoint
(:generateContent, :streamGenerateContent) that asked its model to
think through generationConfig.thinkingConfig — thinkingLevel, or a
thinkingBudget — recorded no effort at all. The upstream ran at the
strength asked (the reporter's request spent 625 thinking tokens at
thinkingLevel high), but the request list, the usage and a group
rule's effort condition all saw "", where the same client through the
OpenAI-compatible endpoint shows reasoning_effort fine.
parseGemini already reads the same config into r.Effort, through
gThinking.effort (level, else budget as the level it is nearest, -1 as
medium, none for a budget of 0 or includeThoughts alone). The new
geminiBodyEffort reads it the same way — geminiCamel first, as
parseGemini does, since clients send the snake_case spellings too —
and bodyEffort's new Gemini branch returns it. requestEffort and
routeEffort come along, so the route record, the usage and group
rules all see what the client asked for. Nothing sent upstream
changes.
Writing effort back (withBodyEffort) stays without a Gemini branch:
no reporter asked for it, and it would have to fit the level to the
model's own words.
Verification on the branch's base 47173f593, macOS arm64:
- RED before the fix, GREEN after: TestGeminiRequestEffort, new, runs
requestEffort and parseGemini on the same bodies and asks for the
same answer — thinkingLevel high, thinking_level LOW, thinkingBudget
512, thinking_budget 32768, -1, 0, includeThoughts alone, no
thinkingConfig.
- go test -tags nogui ./... : ok (see the issue comment for the rest).
Generated-by: GLM-5.3-FlashX (ZCode)
Broken by hand: with the gateway.go and gemini.go hunks reverted,
TestGeminiRequestEffort is red on its level and budget cases
(requestEffort "", want "high", ...). Callers of bodyEffort checked:
withBodyEffort is a no-op for Gemini, and effortOf never returns
none or minimal, so the 5338 branch is never reached for Gemini.