xyenon (Discord #feedback, 10-29): Volcengine Ark lists
kimi-k3-1-pro-261024 where models.dev lists kimi-k3.1-pro, so magpie
knew neither its context window nor its reply limit. The ids differ only
in what the provider package's sameModel already folds when it groups
models: a version's dot written as "-" (or Fireworks' "p"), and Ark's
six-digit YYMMDD date.
Design
- sameModel moves to internal/catalog as SameModel, word for word
(snapshotDate, modelGaps and atoi2 with it). provider's sameModel calls
it, so grouping and catalog lookups fold ids by one rule.
- Exact matches go first and are unchanged: found (exact, Bedrock
profile, "(variant)", ":tag"), then renamed (relay prefixes, window
marks). Only when both miss does normalFor look up the id models.dev
spells as SameModel(id) folds it. When several spellings fold into one
key, the spelling most providers use wins, and then the lowest id, so
Venice's kimi-k3-1-pro keeps its own 1000000/131072 and the other
spelling gets the majority's 1048576/1048576.
- Decorate (a vendor's live list against the provider's own models.dev
entries) tries the same provider's entry under another spelling before
anything else. It fills only what the vendor's list leaves at zero and
never copies a price, so a limit the upstream states always wins.
ListedBy (a provider's own levels) gets the same last pass, per
provider, after its exact passes.
- What is not borrowed: a price (PricedBy has no such pass, so nothing is
priced from another provider's or another spelling's row) and a display
name (NameOf; the upstream id stays the id).
- What is not matched: -pro-max, -mini, another version (k3.2, k3), a
four-digit release (-2610), a six-digit number that isn't a date
(261324), and OpenAI's dashed date. SameModel already kept those apart.
- Re-derived: everything that reads these tables goes through
ContextOf/OutputOf/lookup, so ListedWindow, replyLimit, the Codex
catalog, efforts and thinks get the fallback with them. Knows now takes
other spellings too, so the usage report (stats modelLabel), which may
send only ids models.dev lists, reads the new KnowsAsWritten, which
doesn't.
- docs/subsystems/providers-accounts.md says all this.
Tests (internal/catalog/spelling_test.go, a fixture from models.dev's
rows for these ids, no network)
- TestOtherSpellingLimits: the report's literal ids
(kimi-k3-1-pro-261024, volcengine/…, Kimi-K3.1-Pro-20261024) and
twelve near misses; levels; Knows vs KnowsAsWritten; no name.
- TestOtherSpellingIsNotPriced: no provider prices the dated id, and the
plan's price isn't taken for pay-as-you-go's id.
- TestDecorateOtherSpelling: the vendor's 200000 stays, the reply limit,
levels and name are filled, no price; a -max id and kimi-k3 vs
kimi-k3.1-pro are kept apart; ListedBy likewise.
- TestSameModelReportIDs.
- stats_test: a dated id models.dev knows only under another spelling is
sent as "other".
Red on the old code (catalog.go and live.go reverted, KnowsAsWritten
stubbed): TestOtherSpellingLimits "ContextOf("kimi-k3-1-pro-261024") = 0,
want 1048576" and the rest; TestDecorateOtherSpelling Output 0, ListedBy
false.
Broken by hand
- The majority vote inverted: Venice's spelling wins, and the test asks
for 1048576 and gets 1000000/131072. Red.
- KnowsAsWritten taking other spellings: TestOtherSpellingLimits red.
- stats reading Knows: "deepseek/DeepSeek_V4-260101", want
"deepseek/other". Red.
Real catalog (models.dev cache on the WSL box, a throwaway test since
deleted): kimi-k3-1-pro-261024 gets 1048576/1048576 and levels
low,high,max, is not priced by volcengine, and isn't KnowsAsWritten;
kimi-k3-1-pro-max-261024 gets 0; Decorate of glm-5-3-flash-260828
against volcengine-coding-plan gets 1000000/131072 and the name
GLM-5.3-Flash with no price; claude-opus-5-5-20260801 gets
1000000/128000; gpt-4o-2024-08-06 is unchanged.
Run
- Full suite on the Linux box (wsl-run, Go 1.26.8) at 242e5c68d on base
be8b0f381: go vet -tags nogui ./..., go build -tags nogui ., go test
-tags nogui ./... -timeout 45m -count=1. 77 packages ok (catalog,
provider, stats, gateway and gui among them). One red package,
internal/agent: TestInstalledVersion, TestGrokInstalled and
TestOmpDetectedWithPiDir, the three install-detection reds #4033 and
#3548 already name for that box at main. They don't read the catalog.
- On mote at 242e5c68d: GOOS=windows go vet and darwin go vet of
catalog, provider and stats, and a GOOS=windows build of magpie. All ok.
- Rebased on origin/main 4d9058a98, whose Ark plan list change touches
none of these files: gofmt -l (clean), go vet, and go test -count=1 of
internal/catalog, internal/provider and internal/stats on the Linux
box. All ok.
Not tried: a request on a real Volcengine Ark account; the report's ids
come from xyenon's message and models.dev.
164 lines
7.1 KiB
Go
164 lines
7.1 KiB
Go
package catalog
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// spellingCatalog is models.dev's rows for the models of xyenon's report
|
|
// (Discord #feedback, 10-29), as models.dev/api.json had them on 10-29 and
|
|
// trimmed to their limits, levels and prices, beside near misses: Ark's
|
|
// pay-as-you-go list says kimi-k3-1-pro-261024 for what Moonshot and the
|
|
// relays list as kimi-k3.1-pro, and Venice as kimi-k3-1-pro.
|
|
const spellingCatalog = `{
|
|
"moonshotai": {"models": {
|
|
"kimi-k3.1-pro": {"id":"kimi-k3.1-pro","name":"Kimi K3.1 Pro","limit":{"context":1048576,"output":1048576},
|
|
"reasoning_options":[{"type":"effort","values":["low","high"]}],
|
|
"cost":{"input":2,"output":10,"cache_read":0.2,"cache_write":2}},
|
|
"kimi-k3.1-pro-highspeed": {"id":"kimi-k3.1-pro-highspeed","limit":{"context":1048576,"output":1048576},
|
|
"cost":{"input":4,"output":20,"cache_read":0.2,"cache_write":4}},
|
|
"kimi-k3": {"id":"kimi-k3","limit":{"context":1048576,"output":131072},
|
|
"cost":{"input":3,"output":15,"cache_read":0.3,"cache_write":3}}
|
|
}},
|
|
"vercel": {"models": {
|
|
"moonshotai/kimi-k3.1-pro": {"id":"moonshotai/kimi-k3.1-pro","limit":{"context":1048576,"output":1048576},
|
|
"cost":{"input":2,"output":10,"cache_read":0.2,"cache_write":2}}
|
|
}},
|
|
"venice": {"models": {
|
|
"kimi-k3-1-pro": {"id":"kimi-k3-1-pro","limit":{"context":1000000,"output":131072},
|
|
"cost":{"input":3,"output":15,"cache_read":0.3}}
|
|
}},
|
|
"near-miss": {"models": {
|
|
"kimi-k3.1-pro-max": {"id":"kimi-k3.1-pro-max","limit":{"context":524288,"output":65536}},
|
|
"kimi-k3.1-mini": {"id":"kimi-k3.1-mini","limit":{"context":262144,"output":32768}},
|
|
"kimi-k3.2-pro": {"id":"kimi-k3.2-pro","limit":{"context":2097152,"output":262144}}
|
|
}},
|
|
"volcengine": {"models": {
|
|
"glm-5-3-flash-260828": {"id":"glm-5-3-flash-260828","limit":{"context":1000000,"output":131072},
|
|
"cost":{"input":0.11875,"output":0.41563,"cache_read":0.03414}}
|
|
}},
|
|
"volcengine-coding-plan": {"models": {
|
|
"glm-5.3-flash": {"id":"glm-5.3-flash","name":"GLM-5.3-Flash","limit":{"context":1000000,"output":131072},
|
|
"reasoning_options":[{"type":"effort","values":["low","high","max"]}],
|
|
"cost":{"input":0,"output":0,"cache_read":0}},
|
|
"kimi-k3": {"id":"kimi-k3","limit":{"context":1048576,"output":131072},
|
|
"cost":{"input":0,"output":0,"cache_read":0}}
|
|
}}
|
|
}`
|
|
|
|
// A model models.dev lists under another spelling alone has its window,
|
|
// reply limit and levels: the one its spelling (SameModel) folds into, as
|
|
// most entries spell it. A different model (-pro-max, -mini, another
|
|
// version, a four-digit release) folds into nothing it lists.
|
|
func TestOtherSpellingLimits(t *testing.T) {
|
|
writeCatalog(t, spellingCatalog)
|
|
for _, c := range []struct {
|
|
id string
|
|
window, out int
|
|
}{
|
|
// the report: Ark's id for kimi-k3.1-pro
|
|
{"kimi-k3-1-pro-261024", 1048576, 1048576},
|
|
{"volcengine/kimi-k3-1-pro-261024", 1048576, 1048576},
|
|
{"Kimi-K3.1-Pro-20261024", 1048576, 1048576},
|
|
// listed as given: Venice's own word, not the other spelling's
|
|
{"kimi-k3-1-pro", 1000000, 131072},
|
|
{"kimi-k3.1-pro", 1048576, 1048576},
|
|
// near misses keep their own, or none
|
|
{"kimi-k3-1-pro-max-261024", 524288, 65536},
|
|
{"kimi-k3-1-mini-261024", 262144, 32768},
|
|
{"kimi-k3-1-pro-mini-261024", 0, 0},
|
|
{"kimi-k3-2-pro-261024", 2097152, 262144},
|
|
{"kimi-k3-3-pro-261024", 0, 0},
|
|
{"kimi-k3-pro-261024", 0, 0},
|
|
{"kimi-k3-1-261024", 0, 0},
|
|
{"kimi-k3-1-pro-highspeed-261024", 1048576, 1048576},
|
|
{"kimi-k3-1-pro-2610", 0, 0}, // a four-digit release is a model of its own
|
|
{"kimi-k3-1-pro-261324", 0, 0}, // no month 13: not a date
|
|
{"kimi-k3-1-pro-fast-261024", 0, 0},
|
|
} {
|
|
if got := ContextOf(c.id); got != c.window {
|
|
t.Errorf("ContextOf(%q) = %d, want %d", c.id, got, c.window)
|
|
}
|
|
if got := OutputOf(c.id); got != c.out {
|
|
t.Errorf("OutputOf(%q) = %d, want %d", c.id, got, c.out)
|
|
}
|
|
}
|
|
if got := strings.Join(EffortsOf("kimi-k3-1-pro-261024"), ","); got != "low,high" {
|
|
t.Errorf("EffortsOf = %q, want low,high", got)
|
|
}
|
|
if !Knows("kimi-k3-1-pro-261024") {
|
|
t.Error("Knows: the other spelling is a model models.dev knows")
|
|
}
|
|
// the usage report sends only an id models.dev knows as written
|
|
if KnowsAsWritten("kimi-k3-1-pro-261024") || !KnowsAsWritten("kimi-k3.1-pro") || !KnowsAsWritten("kimi-k3-1-pro") {
|
|
t.Error("KnowsAsWritten took another spelling")
|
|
}
|
|
// the id itself is kept: only what is known of it is borrowed
|
|
if got := NameOf("kimi-k3-1-pro-261024"); got != "" {
|
|
t.Errorf("NameOf = %q: the other spelling's name stands for a dated id", got)
|
|
}
|
|
}
|
|
|
|
// A price is never borrowed by another spelling: neither the maker's nor
|
|
// another host's prices Ark's dated id.
|
|
func TestOtherSpellingIsNotPriced(t *testing.T) {
|
|
writeCatalog(t, spellingCatalog)
|
|
for _, ps := range [][]string{{"volcengine"}, {"moonshotai"}, {"volcengine", "moonshotai", "vercel", "venice"}} {
|
|
if pr, ok := PricedBy(ps, "kimi-k3-1-pro-261024"); ok {
|
|
t.Errorf("PricedBy(%v) = %+v", ps, pr)
|
|
}
|
|
}
|
|
if pr, ok := PricedBy([]string{"volcengine-coding-plan"}, "glm-5-3-flash-260828"); ok {
|
|
t.Errorf("the plan's price taken for pay-as-you-go's id: %+v", pr)
|
|
}
|
|
}
|
|
|
|
// The provider's own catalog answers first: Ark's pay-as-you-go list says
|
|
// glm-5-3-flash-260828 where its plan's catalog says glm-5.3-flash. What
|
|
// the vendor's list says itself stays, and no price comes with it.
|
|
func TestDecorateOtherSpelling(t *testing.T) {
|
|
writeCatalog(t, spellingCatalog)
|
|
known := Provider("volcengine-coding-plan")
|
|
out := Decorate([]Model{
|
|
{ID: "glm-5-3-flash-260828", Context: 200000},
|
|
{ID: "glm-5-3-flash-max-260828"},
|
|
{ID: "kimi-k3-1-pro-261024"},
|
|
}, known)
|
|
g := out[0]
|
|
if g.ID != "glm-5-3-flash-260828" || g.Context != 200000 || g.Output != 131072 || g.Price != nil {
|
|
t.Errorf("glm: %+v", g)
|
|
}
|
|
if strings.Join(g.Efforts, ",") != "low,high,max" || g.Name != "GLM-5.3-Flash" {
|
|
t.Errorf("glm levels/name: %v %q", g.Efforts, g.Name)
|
|
}
|
|
if m := out[1]; m.Context != 0 || m.Output != 0 || len(m.Efforts) > 0 {
|
|
t.Errorf("a -max variant took glm-5.3-flash's: %+v", m)
|
|
}
|
|
// the plan doesn't list kimi-k3.1-pro, and kimi-k3 is another model
|
|
if m := out[2]; m.Context != 0 || m.Output != 0 {
|
|
t.Errorf("kimi-k3.1-pro took kimi-k3's: %+v", m)
|
|
}
|
|
if got, ok := ListedBy([]string{"volcengine-coding-plan"}, "glm-5-3-flash-260828"); !ok || strings.Join(got, ",") != "low,high,max" {
|
|
t.Errorf("ListedBy = %v %v", got, ok)
|
|
}
|
|
if _, ok := ListedBy([]string{"volcengine-coding-plan"}, "kimi-k3-1-pro-261024"); ok {
|
|
t.Error("ListedBy took kimi-k3 for kimi-k3.1-pro")
|
|
}
|
|
}
|
|
|
|
// SameModel folds what the report's ids differ by, and nothing that names
|
|
// another model.
|
|
func TestSameModelReportIDs(t *testing.T) {
|
|
k := SameModel("kimi-k3.1-pro")
|
|
for _, id := range []string{"kimi-k3-1-pro-261024", "kimi-k3-1-pro", "moonshotai/Kimi-K3.1-Pro", "kimi_k3_1_pro"} {
|
|
if SameModel(id) != k {
|
|
t.Errorf("SameModel(%q) = %q, want %q", id, SameModel(id), k)
|
|
}
|
|
}
|
|
for _, id := range []string{"kimi-k3.1-pro-max", "kimi-k3.1-mini", "kimi-k3.2-pro", "kimi-k3-pro", "kimi-k3.1-pro-2610", "kimi-k31-pro"} {
|
|
if SameModel(id) == k {
|
|
t.Errorf("SameModel(%q) folds into kimi-k3.1-pro", id)
|
|
}
|
|
}
|
|
}
|