Files
magpie/internal/gateway/xhigh_effort_test.go
T
yetone 6fe754cb20 claude: Fable 5.2 on Vertex, Bedrock, Desktop's fable tier and Anthropic's fast mode
Anthropic launched Claude Fable 5.2 (claude-fable-5-2) on 11-09
(thelegendof2414 on X: not in magpie's list). Checked against
Anthropic's "What's new in Fable 5.2" page, AWS's model card, models.dev
and Claude Code 2.1.321's own bundle:

- Claude subscription and Anthropic API: the list follows models.dev,
  which already has claude-fable-5-2 (8/40, cache read 0.2, write 10,
  1M context, 128k out), so it shows once the catalog syncs (at most
  24h). TestClaudeAccountListsFable52 holds that with the literal
  models.dev row: listed first, priced, 1M window, low to max efforts.
- Vertex global and Bedrock presets list it
  (global.anthropic.claude-fable-5-2 is on AWS's card).
- Claude Desktop's fable tier now behaves as claude-fable-5-2 (2.1.321's
  latest_per_family); Desktop's own catalog v4371 still ends at 5.1.
- Fast mode on Anthropic's API key: Fable 5.2 has it ($16/$80; 2.1.321's
  fast-mode opt-in set is fable-5-2 and mythos-5-2). Fable 5.1 never had
  it and stays off. A Claude subscription account still gets no fast
  mode in magpie, as before.
- Claude Code's effort: 2.1.321 reads the top-level effortLevel only for
  models up to Fable 5.1 and Mythos 5.1, so 5.2 goes in modelSettings,
  as Opus 5.5 does (claudeReadsTop unchanged, test added).
- Gateway: adaptive-only thinking, no sampling, thinking off never sent,
  xhigh kept: the version rules already cover 5.2; tests now name it.

Run at this tree (mote): gofmt -l clean; go vet ./... (darwin),
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... ok;
go test -count=1 ./internal/agent ./internal/gateway ./internal/provider
-run 'Fable|Claude|Fast|Vertex|Bedrock|Effort|Thinking|Xhigh|XHigh|Desktop|Sampling|Adaptive'
ok (84s, 178s, 36s).
Not run before the push: the full go test ./... (mote had six suites
queued on suite.lock at load 420); it runs after, and a red is filed.
Not tried: a real Fable 5.2 request through magpie; fast mode on a real
API key.
2026-11-10 04:58:30 +08:00

50 lines
2.2 KiB
Go

package gateway
import (
"net/http/httptest"
"testing"
"github.com/yetone/magpie/internal/provider"
)
// A client that asks xhigh of a Claude that takes it (Opus 4.7 on, Sonnet
// 5 on, Haiku 5.5, Fable: platform.claude.com/docs/en/build-with-claude/effort)
// gets xhigh, not max, which spends without limit; Opus and Sonnet 4.6,
// which have no xhigh, are asked max.
func TestXhighStaysXhighWhereClaudeTakesIt(t *testing.T) {
fresh(t)
up := &adaptiveVendor{}
srv := httptest.NewServer(up)
t.Cleanup(srv.Close)
if err := provider.Save(provider.Provider{ID: "anth", Name: "Anth", Key: "k", Anthropic: srv.URL,
Models: []string{"claude-opus-5-5", "claude-opus-4-7", "claude-sonnet-5", "claude-haiku-5-5", "claude-fable-5-2", "claude-fable-5-1", "claude-opus-4-6", "claude-sonnet-4-6"}}); err != nil {
t.Fatal(err)
}
for _, c := range []struct{ model, path, body, want string }{
{"claude-opus-5-5", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-opus-5-5", "/v1/responses", `"reasoning":{"effort":"xhigh"}`, "xhigh"},
{"claude-opus-4-7", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-sonnet-5", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-haiku-5-5", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-fable-5-2", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-fable-5-1", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "xhigh"},
{"claude-opus-4-6", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "max"},
{"claude-sonnet-4-6", "/v1/chat/completions", `"reasoning_effort":"xhigh"`, "max"},
} {
t.Run(c.model+c.path, func(t *testing.T) {
body := `{"model":"anth/` + c.model + `",` + c.body + `,"messages":[{"role":"user","content":"hi"}]}`
if c.path == "/v1/responses" {
body = `{"model":"anth/` + c.model + `",` + c.body + `,"input":"hi"}`
}
code, out := post(t, c.path, body)
if code != 200 {
t.Fatalf("status %d: %s", code, out)
}
oc, _ := up.last()["output_config"].(map[string]any)
if e, _ := oc["effort"].(string); e != c.want {
t.Errorf("output_config = %v, want effort %q", up.last()["output_config"], c.want)
}
})
}
}