Files
magpie/docs
yetone d4eae3618f gateway: reasoning off goes to an Anthropic API as thinking off, and the log says the level a translated request went at (#1636, jswysnemc)
jswysnemc saw a custom provider think at another level than the one the
agent asked. This commit fixes two places where magpie's own translation
did that.

- A Chat or Responses client turning reasoning off (effort none),
  translated to an Anthropic endpoint, was sent thinking enabled at a
  4096-token budget (buildAnthropic read Effort "none" as a level). It
  now goes as thinking disabled. A model that refuses disabled
  (alwaysThinks / mandatoryReasoning / thinkingOffRefused, e.g. GLM) is
  asked again at its least (thinkingBackOn), and markUnfit(offRefused)
  sends it that way at once until restart.
- none/minimal go as low to Chat/Responses for a model whose levels
  aren't known (effortOf). The route, the try and the usage log all
  said none/minimal. The route still keeps the level asked; the try and
  the usage log now say the level built (noteWireEffort/wireEffort via
  a context slot filled in forwardTranslated). Routing already draws
  asked -> went from the two.

The passthrough path (a client on the provider's own API, e.g. Claude
Code to an Anthropic relay) is unchanged: it sends the client's level
as it came.

Run: go test ./internal/gateway/ (full package, 304s, green);
TestTranslatedEffortLoggedAsSent (8 cases) and
TestTranslatedThinkingOffRefused fail with 11 assertions when the
gateway.go/anthropic.go changes are reverted. gofmt; GOOS=linux and
GOOS=windows go vet.
Not tried: a real vendor's Anthropic API with thinking disabled.
2026-10-12 00:53:48 +08:00
..