A provider with several keys keeps the first in key/keyName and the
rest in keys; that split is how it is stored. When the vendor's /models
didn't answer the first key (a 429, a timeout) or a key was added since
the last fetch, the per-key catalog had no list carrying it, and
Provider.Serves read that as "this key sees none of the models". The
gateway's perKeyBarred then put it in unlisted on every request, and
Routing showed four of five keys.
Serves now treats a key that no list marks as unknown, which serves: a
failed list is not an empty one. A key whose own list did answer still
serves only what that list has. Nothing in the saved keys changes.
TestCountTokensKeyFailover's k-unlisted stood for a key outside m1's
list by being in no list at all, which now reads as unknown. Its list
now answers with another model (m2), which is the case the test guards:
it is still skipped.
Run: TestKeyWithNoListStillServes (the reporter's shape: xx1 in key,
xx2..xx5 in keys, xx1's list answers 429, xx5 lists one model) failed
before the fix and passes after; go test -tags nogui ./internal/provider
and ./internal/gateway ok; the full suite found the count_tokens fixture
above, nothing else; gofmt -l clean; GOOS=linux and GOOS=windows go vet
clean. Not tried: the reporter's own providers.json (the attached zip
returned 404) or a real multi-key vendor. A key whose list answers
empty is now tried too, as nothing marks it.