Gemini 4 Argon turns every thinkingBudget away with a 400 ("Thinking
budget is not supported for this model. Use thinking level instead."),
and magpie sent it one: thinkingConfig gave a level only to ids starting
gemini-3 (and gemini-pro-agent), so a gemini-4-* id on a provider that
speaks Gemini's own API (the reporter's google-vertex catalog, a custom
gemini= base) got a budget on every request.
geminiGeneration reads the generation from the id (gemini-N, after a
models/ prefix too); 3 and later are told a level. Medium goes as medium
on a later generation as it does on Flash: Argon lists low, medium and
high, and the effort is already fitted to the model's levels (fitFor). An
id naming no generation (gemini-flash-latest, an alias) is 0 and keeps
its budget, as before. The Chat path (aiStudioThinking) already gave a
budget only to gemini-2, and Vertex's vertexThinking is unchanged.
Run:
- TestGeminiLaterGenerationsToldALevel: a fake Gemini upstream that
answers a budget on gemini-4* with the reporter's literal 400; Argon
low/medium/high on /v1/chat/completions and /v1/responses, 3.8 Flash,
3 Pro medium (high, as before), 2.5 Flash (budget 24000). FAILs on the
old code with Argon's 400 on both routes; FAILs with "thinkingLevel
high, want medium" when only the medium case is reverted.
- TestGeminiGeneration (id table).
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/gateway; go test -tags nogui ./internal/gateway/.
Not tried: a real Gemini 4 Argon request (no AI Studio or Vertex key on
this machine). A magpie alias that names no generation but is wired to a
Gemini 4 model still gets a budget.