WorkBuddy's China build serves its Claude models on Anthropic's Messages API (<endpoint>/v1/messages). A Claude model there is now `@ai-sdk/anthropic` and goes to Messages, where `output_config.effort` (max included) is honored. Every other model, and every WorkBuddy AI model, stays on chat. A Messages body goes as sent, minus thinking blocks with no signature, and goes once more without thinking when WorkBuddy refuses a signature it didn't make (11159). count_tokens goes on the Messages route too. One Claude Code send keeps one turn id (#48).
Reviewed at 9e0eb2b (rebased on main ba9801c; workbuddy unchanged from the 39f71a7 the author answered the last review with), by @waynesguan.
Run at 9e0eb2b, sandbox HOME and TMPDIR:
- packages/workbuddy `bun test`: 149 pass, 0 fail. Run again with HTTP(S)_PROXY pointing at a dead port: 149 pass, so no test reaches the network.
- `bun scripts/check.mjs workbuddy`: ok.
- Broken by hand: BAD_SIGNATURE that never matches turns "a signature WorkBuddy didn't make is refused once…" red; isMessages without count_tokens turns "count_tokens is a Messages request" red.
- Read: magpie's provider/plugins.go takes `firstOf(o.BaseURL, m.URL, …)`, so the loader's empty baseURL falls back to each model's api.url (/v1 for Claude, /v2 for chat).
- magpie origin/main 4dfd88206's plugin host, sandbox HOME (scripts/try.sh): the package adds, workbuddy lists 15 models and workbuddy-ai 16.
Not tried against the real API here: the sandbox has no WorkBuddy account that can reach a Claude model. The author's replays with a real account (empty text block 200, signature binding table) are what the 11159 handling rests on.