Files
magpie/internal/provider/testdata
yetone 934263f543 zen: Test with the public key asks each API for a free model Zen serves on it, and leaves out an API no free model is on (z'x on Discord; #2385)
z'x on Discord: Test on an OpenCode Zen provider with the key public always
failed. Reproduced with Zen's real list: Test asked public for
claude-fable-5 on Messages and gemini-3-flash on Gemini, which public
doesn't reach (Zen's free models alone answer it), and big-pickle on
Responses, a chat-only model. Only chat (big-pickle) could pass, so the
card was red every time.

- testModel: on OpenCode's gateway a model models.dev names no API for
  (no per-model provider.npm) is served on chat alone, so no other
  endpoint is tried with it (a Claude id on Messages still is). This also
  stops a paid key's Responses probe asking big-pickle.
- With public, only a free model (OpenCodeFree) is tried, and with none on
  an API that API is left out of the result; with none on any, one row
  says why (zenPublicNone), and a client-scoped Test says the same.

#2385 itself (deepseek-v4.1-flash-free not offered): the built-in Zen
lists whatever Zen's /models lists, with no table of free ones;
TestZenPublicListsNewFreeModels pins that with the real bytes. The model
was missing in the opencode-zen-free plugin, fixed there (zen-free 0.1.9,
magpie-community/plugins).

Fixtures: testdata/zen_public_models.json is Zen's /inference/v1/models
as the public key read it on 2026-10-15 (one GET, byte for byte);
zen_catalog.json is models.dev's opencode entries for those ids from the
same day's synced catalog.

Run (worktree at origin/main a1f7b8c13, -tags nogui -p 1):
- go test -run 'TestZen|TestOpenCode' ./internal/provider: ok
- the 77 provider tests that call Test, testModel or tiny, plus
  TestZen*/TestOpenCode*: ok
- broken by hand: test.go back to main's, the two new tests kept:
  TestZenPublicTestAsksFreeModels red (responses asked big-pickle,
  anthropic claude-fable-5, gemini gemini-3-flash, all 401; own key's
  Responses model big-pickle); green again with the fix
- gofmt -l clean; go vet -tags nogui ./internal/provider for darwin,
  linux and windows: ok

Not tried: Test against real Zen. The fake answers 401 to a paid model
with public and to a model off its API, as the reporter's red rows say,
but Zen's exact status there wasn't asked. Responses now asks
muse-spark-1.2-contributor-free (first in Zen's list, "deprecated" in
models.dev though Zen lists it); whether Zen still answers it wasn't
asked.

Full suite: SUITE_LINE
2026-10-15 23:08:04 +08:00
..