diff --git a/docs/subsystems/providers-accounts.md b/docs/subsystems/providers-accounts.md index 13ee309f8..ae50ed2c4 100644 --- a/docs/subsystems/providers-accounts.md +++ b/docs/subsystems/providers-accounts.md @@ -52,6 +52,8 @@ keys and accounts per request is in [Gateway routing and fallback](gateway-routi | An endpoint's catalog | A key's provider with no catalog of its own (none named, none from a preset) is priced from the models.dev catalog whose `api` is one of its endpoints (`EndpointCatalog`, `catalog.AtEndpoint`; a trailing slash and case don't count, and an Anthropic base, kept as its root, is also matched with its `/v1`). Only when exactly one catalog is at that address, and it isn't a plan's (an id with `-plan`, or a `membershipCatalogs` one): a plan lists its membership's $0, and two catalogs at one address can't be told apart. A subscription's account never gets one. A provider at AMD's own endpoint is priced from `amd`, which lists Qwen3.8-27B at $0, a price, where its maker sells no such model and it had none (#2052); a relay's endpoint matches nothing and its model stays unpriced, never priced at a reseller's guess. `magpie model price` names the catalog, and says how to give a price when none is known. | [`models.go`](../../internal/provider/models.go), [`catalog.go`](../../internal/catalog/catalog.go) | | A membership's $0 catalog | models.dev lists every model of Kimi Code's plans (`kimi-code-plan-global`, `kimi-code-plan-cn`) and of Xiaomi MiMo's Token Plans (`xiaomi-token-plan-cn`, `-sgp`, `-ams`) at $0: what the membership charges per token, not what the model costs. `membershipCatalogs` are never read for a price (`priceCatalogs`, `makerPriceCatalogs`), so a Xiaomi MiMo model is priced at `xiaomi`'s list price at every region, and each region of the preset names its own catalog, pay as you go `xiaomi` alone (#1873). A Kimi Code provider's model is priced at the Kimi API model it is (`kimiCodeAPI`, from Kimi Code's docs: k3 and k3-256k are kimi-k3, kimi-for-coding-highspeed is kimi-k2.7-code-highspeed), and kimi-for-coding (K2.8 Preview, not on the API) is unpriced rather than free (#1370). The alias is Kimi Code's alone (`kimiCodePlans`): a relay's own `k3` keeps its own price. A catalog other than these that lists a model at $0 still prices it at $0: models.dev has truly free models (nvidia, modelscope). The Requests list names the API model it was priced as (`PricedNameFor`). | [`models.go`](../../internal/provider/models.go) | | A plugin's own price | A model no catalog prices (models.dev has no vendor's own model: Devin's SWE-2 and SWE-1.7 Lightning, Cursor's auto, Qoder's efficient) is priced at what its plugin lists it at (`ListPrice` → `pluginListPrice`, `plugin.Model.Cost`, read by `pluginPrice`: an input or output above 0, OpenCode's 0 being none), else at $0 when the plugin says the plan serves it free (`pluginFree`, `plugin.Model.Free`: Devin's Free cost tier, Qoder's and WorkBuddy's x0). Both come after every catalog, so a price a catalog gives is kept over the plugin's. Devin's plugin (0.1.18) lists each paid model at the price Devin's GetCliModelConfigs gives it (input, cached input and output per 1M tokens); a moved Devin user's calls on Devin's own models had no cost on Usage before (太陽と向日葵 on Discord, `TestPluginFreeModelCostsNothing`). A plugin that gives no price and doesn't say free leaves the model unpriced. | [`models.go`](../../internal/provider/models.go), [`plugins.go`](../../internal/provider/plugins.go), [`providers.go`](../../internal/plugin/providers.go) | +| A lab's models | models.dev keeps two catalogs: `api.json`, each provider's models with that host's prices, and `models.json`, each lab's models with only what is the model's on every host (name, window, reply limit, thinking, inputs, release), no price. `Sync` keeps the second beside the first as `labs.json` (`LabsPath`, `syncLabs`: best effort, through a rename, a failed fetch keeping the last; a catalog with none beside it is `Stale` once a process, so it comes at the next look). A model only a lab lists, no provider (models.dev took the gated Claude Mythos 5.1 out of anthropic's list in #11327 and kept its lab file), is voted into the same tables as a listed one (`loadGen`, `labs`), so `ContextOf`, `OutputOf`, `NameOf`, `Thinks`, `SeesImages` and every entry built on them know it wherever a vendor's or an account's list has it; a thinking one with no levels takes the levels of the newest of its family a provider gives them (`labKinEfforts`: Mythos 5.1 takes Mythos 5's). A model a provider lists keeps what providers say of it. `catalog.Describe` builds a model from these for a list that names an id alone. `TestLabOnlyModelIsKnown`, `TestLabsLeaveListedModels`, `TestSyncKeepsLabs`, `TestAnthropicKeyGatedModelDescribed` (iebb on Discord). | [`labs.go`](../../internal/catalog/labs.go), [`catalog.go`](../../internal/catalog/catalog.go) | +| A Claude account's models | magpie never asks Anthropic with a Claude sign-in, so a Claude account's list is models.dev's anthropic list and what Anthropic told the account's Claude Code beyond it. Claude Code keeps that in its `.claude.json` from its own bootstrap: `additionalModelOptionsCache` (models its /model picker offers beyond its own; a `null` value or a `disabled` one is not a model), `modelAccessCache` (`entitled` per API id) and `additionalModelCostsCache` (Anthropic's prices). `claudeModels` reads the file of Claude Code's own sign-in (`claudeProfilePath`) and of each saved account's directory (`claudeAccountDir`), through `filememo`, and adds each model none of them lists, described by `catalog.Describe` and priced as Anthropic told it. `Account.Lists` for a Claude account goes by its own file (`claudeLists`: the saved directory's, or Claude Code's own when its `oauthAccount` is that account, the one Anthropic answered last): a model it isn't entitled to is out, so routing tries the accounts entitled to a gated model first; with no file, every model is taken to be in, as before. `ListPrice` of a provider whose catalogs include anthropic falls back to that price after every catalog (`claudeCodePrice`). The agent's own Claude Code model picker (`claudeOwn`) offers what `ClaudeCodeModels` gives for the account signed in here; a WSL distro's keeps the catalog's. Not done: a Claude Code that never started on a saved account has no file, so its gated models show only once it has run there. `TestClaudeAccountListsGatedModels`. | [`claude_code_models.go`](../../internal/provider/claude_code_models.go), [`account.go`](../../internal/provider/account.go), [`codex_models.go`](../../internal/provider/codex_models.go), [`claude.go`](../../internal/agent/claude.go) | | A key's own windows | A sub2api key given a spending limit per 5 hours, day or 7 days answers its `/v1/usage` with `rate_limits` and no `remaining` (`readSub2APIKeyLimits`). With the Balance URL set to it, the key's card shows them as the windows *5 hours*, *1 day*, *7 days*, in USD, beside a balance field the user wrote; *Check balance* and `magpie provider show` give what its fullest window has left (`Balance`). A Balance URL at an account query left without its token (a sub2api panel's `/api/v1/user/profile`, new-api's `/api/user/self`, after the token was removed) asks the same panel's query for the key instead, the saved URL untouched (`keyQueryOf`, `BalanceQuery`), unless the user's Headers carry an Authorization or Cookie of their own. A Balance URL of the user's own is asked with GET, or with POST and no body when the provider's `BalanceMethod` says so (#2368: an endpoint that answers only a POST; the editor's GET/POST beside the URL, `balance.method=` on the command line); any other method is refused before anything is sent (`balanceMethodOf`). `KeyAllowance` gives routing the same windows: never waited for, read in the background at most once a minute, a failed read keeping the last, and seeded from the card's last reading (`quotas.json`) after a restart. A key bought as a plan (Kimi Code, GLM Coding Plan and Z.ai, MiniMax Coding Plan, OpenCode Go, Command Code, Ollama Cloud: `planQuotaSourceOf`) gives routing its card's windows the same way (`planKeyWindows`, Zhipu's team quota behind a key with none of its own); the Usage page's read of its card is taken at once (`noteKeyAllowance`), and a key there that turns out pay-as-you-go, with no windows, is asked again only every 30 minutes (`keyNoWindowsAge`). A Command Code plan's key has its month of credits as a *Credits* window beside the 5-hour and weekly ones, as the signed-in subscription's card has (`cmdKeyWindows`, #2451): billing/credits leaves the plan out, so it is the key's billing/subscriptions plan, asked at most every ten minutes and the last one kept while it can't be read; a key whose plan was never read has its two windows alone. Ollama Cloud's `ollama.com/api/balance` (#1888, `readOllamaPlan`) tells the plan's included allowance as one window in USD, *Month* when its period is a month long, renewing at `period.until`, and Aside while credits bought on top are left; those credits are the key's balance card (`readOllamaCredits`), and a reply that names none has no balance card rather than $0. StepFun's Step Plan is read through a platform sign-in, not the key, and isn't one of them: the sign-in is the provider's own, kept by provider id in `stepfun-auth.json` (two StepFun providers on one site can be two accounts, #2384), one card per signed-in provider; a file from before that, kept by site, is given on read to the StepFun providers on that site (`stepfunBySite`), and copies of one sign-in are renewed together. Nor are Volcengine Ark's Coding Plan and Agent Plan (#1427): their 5-hour, weekly and monthly windows are told only to the account's access key (`AccessKeyID`, `SecretAccessKey`), asked of `open.volcengineapi.com` (`GetCodingPlanUsage`, `GetAFPUsage`) and signed as Volcengine's own SDK signs (`volcSign`), so they are cards on the Usage page (`volcPlanQuotas` in `PlanQuotas`), never routing's windows. Nor is Tencent Cloud's Token Plan 企业版 (#1574): what a team plan has used of its cycle's credits (专业套餐) or tokens (轻享套餐) is told only to the account's SecretId and SecretKey (kept as `AccessKeyID`, `SecretAccessKey`), asked of `tokenhub.tencentcloudapi.com` (`DescribeTokenPlanList`, `DescribeTokenPlan`, version 2026-03-22) and signed TC3-HMAC-SHA256 (`tc3Sign`), one card per team plan (`tencentPlanQuotas`). | [`sub2api_usage.go`](../../internal/provider/sub2api_usage.go), [`key_allowance.go`](../../internal/provider/key_allowance.go), [`volcengine_usage.go`](../../internal/provider/volcengine_usage.go), [`tencent_usage.go`](../../internal/provider/tencent_usage.go) | | Account names and seats | `AccountNames` (by the account, in lower case, like `AccountCaps`) are names the user gives accounts, set by `SetAccountName` (GUI `provider/accountname`, `magpie accounts alias`); they live in providers.json only, never in a vendor's or plugin's sign-in. A GLM Coding Plan read with a key (`glmPlan`) and a ZCode account (built-in or `zcode-plugin`) whose windows' resets agree are one seat (`seatMatch`, #90/#953), shown once, on the account's card (`seatCards`, used by `quotas`, `Allotted` and `CachedCards`). A match is remembered in `seats.json` beside `quotas.json`: a failed read or a window with no reset yet is unknown and keeps the key's card off while the account is signed in; windows that disagree forget it (#1515). Cards carry `Seat` (the key provider's name, and the key's when it has several) and `Alias` (the user's name, else `Seat`), as `/v1/magpie/quotas`, `magpie quota` and `magpie accounts` do. Records (a trace's `who`, usage's `ProviderAccount`) keep the vendor's name, the key the user's name is kept by, and every list of them looks the name up as it is shown (`AccountShown`, `AccountShownOf`, `AccountRef.Shown`), so a request from before a rename reads by the new name too: the Routing page's accounts and requests (`userShown` in `plugins/routing/client.js`, from `/api/providers`' `accountNames`), its Several accounts pools (`onOf`), the Usage page's Accounts and the request log's Account filter (`usageapi`), `magpie usage`, and a gateway key's accounts (`AccountNames`, `/api/caller-keys`). Before plugins#310 (a renamed Kiro account read by its old name on every request after) those showed the vendor's name. | [`account_names.go`](../../internal/provider/account_names.go), [`account_seats.go`](../../internal/provider/account_seats.go) | | Last served | `served.json` records when each account, plan or key last answered, shown as `lastServedAt` (#570) on `/v1/magpie/quotas` and on the Usage page's own cards (`Quotas` → `cardsServed`, this computer's cards only, the caches left alone). The Usage page and the tray panel show the last-answered account in full, and a menu bar card that follows the account in use (`codex|*`) takes the one that answered within the last hour, else `InUseLogin`'s guess, else the one that answered last at all (a plugin's accounts, #1516) (`trayInUseCard`; okingkee on X: A spent, B answering, the menu bar stayed on A). `NoteServed` calls `OnServedMoved` when a provider's answers move to another account or key, and `SwitchLogin` after a switch, so the menu bar reads its cards again at once. | [`served.go`](../../internal/provider/served.go), [`trayusage.go`](../../internal/gui/trayusage.go) | diff --git a/internal/agent/claude.go b/internal/agent/claude.go index f26e254b7..f1ee04bd1 100644 --- a/internal/agent/claude.go +++ b/internal/agent/claude.go @@ -1662,7 +1662,7 @@ func claudeIn(at place) *Agent { } return env(tierEnv(t)) } - own := claudeOwn(cur["model"], tier) + own := claudeOwn(cur["model"], tier, provider.ClaudeCodeModels()) for i := range own { own[i].Direct = direct } @@ -2268,14 +2268,15 @@ func claudeDropModelEffort(path, n string) error { return nil } -// claudeOwn is Anthropic's models as Claude Code takes them: only the -// catalog's; Claude Code's own short aliases are not something any API -// lists, and a compiled-in copy would just go stale. One the user's +// claudeOwn is Anthropic's models as Claude Code takes them, ms: the +// catalog's, and on this computer the ones Anthropic told Claude Code +// its account has beyond them (provider.ClaudeCodeModels: Claude Mythos +// 5.1); Claude Code's own short aliases are not something any API lists, +// and a compiled-in copy would just go stale. One the user's // settings.json names (cur: "model": "sonnet") comes first, said as the // model it stands for, so the row doesn't show a bare word; tier is the // model the user's env gives a tier, "" for none. -func claudeOwn(cur string, tier func(string) string) []Option { - ms := catalog.Provider("anthropic") +func claudeOwn(cur string, tier func(string) string, ms []catalog.Model) []Option { var own []Option if o, ok := claudeAliasOption(cur, ms, tier); ok { own = append(own, o) diff --git a/internal/agent/wsl.go b/internal/agent/wsl.go index 39bfb71f6..874bcad50 100644 --- a/internal/agent/wsl.go +++ b/internal/agent/wsl.go @@ -349,7 +349,7 @@ var wslKinds = []wslKind{ case "model": // whether it has a base URL of its own is the distro's file return func(cur map[string]string) []Option { - return append(group("Claude Code", claudeOwn(cur["model"], nil)), claudeViaMagpie(false)...) + return append(group("Claude Code", claudeOwn(cur["model"], nil, catalog.Provider("anthropic"))), claudeViaMagpie(false)...) } case "effort": return nil diff --git a/internal/catalog/catalog.go b/internal/catalog/catalog.go index 66c2bab56..8eeb07a6f 100644 --- a/internal/catalog/catalog.go +++ b/internal/catalog/catalog.go @@ -469,6 +469,9 @@ var ( // listed are the bare ids of every model models.dev lists, whatever it // says of them: an id listed is never taken for another (renamed) listed map[string]bool + // labs are the models models.dev lists under their lab alone + // (models.json), by bare id: none of its providers lists them + labs map[string]mdModel // canonical are the bare ids of every model models.dev says an entry is // (canonical_model_id, #1520): DeepSeek's deepseek-flash is // deepseek/deepseek-v4.1-flash, the id WorkBuddy and the relays serve it @@ -602,6 +605,31 @@ func loadGen() (map[string]mdProvider, int) { } } } + // and a model no provider lists at all, only its lab + // (models.dev's models.json): a gated one, as Claude + // Mythos 5.1 is since models.dev took it out of + // anthropic's list, that a vendor's own list or the + // account's still serves (iebb on Discord). Its lab + // file holds what is the model's on every host — name, + // window, reply limit, thinking, images — and no + // price. One a provider lists keeps its answers. + labs = map[string]mdModel{} + for id, x := range readLabs() { + b := bareID(id) + if listed[b] || canonical[b] { + continue + } + if x.ID == "" { + x.ID = id + } + if _, ok := labs[b]; !ok || id < labs[b].ID { + labs[b] = x + } + vote(b, b, "lab:"+id, x) + } + for b := range labs { + listed[b] = true + } windows = map[string]int{} for id, by := range sizes { windows[id] = mostGiven(by) @@ -630,6 +658,7 @@ func loadGen() (map[string]mdProvider, int) { images[id] = true } } + labKinEfforts(m) return } } @@ -647,7 +676,7 @@ func Reset() { loaded = false built = nil gen++ - mdev, images, windows, outputs, efforts, thinks, names, listed, canonical = nil, nil, nil, nil, nil, nil, nil, nil, nil + mdev, images, windows, outputs, efforts, thinks, names, listed, canonical, labs = nil, nil, nil, nil, nil, nil, nil, nil, nil, nil loadMu.Unlock() if Forget != nil { Forget() @@ -704,16 +733,19 @@ func syncLock(ctx context.Context, onlyIfMissing bool) error { if err := os.WriteFile(p, b, 0o644); err != nil { return err } + // the lab catalog beside it is best effort: without it the provider + // catalog answers alone, and one kept before is kept + _ = syncLabs(ctx) Reset() Touched() // names, reasoning levels and context windows may be others return nil } // Stale reports whether no catalog exists or the cache is older than a day -// (fresh.go). +// (fresh.go), or magpie's has no lab catalog beside it yet (labs.go). func Stale() bool { src := Source() - if src == "" { + if src == "" || labsMissing() { return true } st, err := os.Stat(src) diff --git a/internal/catalog/labs.go b/internal/catalog/labs.go new file mode 100644 index 000000000..f6ff334d3 --- /dev/null +++ b/internal/catalog/labs.go @@ -0,0 +1,185 @@ +package catalog + +// models.dev keeps two lists. api.json is each provider's models, with +// what that host charges; models.json is each lab's models (labs/), +// with only what is the model's on every host: name, window, reply limit, +// thinking, inputs, release. A model can be in the second alone: models.dev +// took the gated Claude Mythos 5.1 out of anthropic's provider list +// (models.dev #11327) and kept its lab file (#11328), since not every +// account may call it. An account that has it still lists it — Anthropic's +// /v1/models with its key, the models Claude Code was told a Claude account +// has — and magpie describes it from its lab file (iebb on Discord). + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "os" + "path/filepath" + "slices" + "strings" + "sync/atomic" +) + +// LabsPath is where Sync keeps models.dev's lab catalog (models.json), +// beside its provider catalog. +func LabsPath() string { return filepath.Join(filepath.Dir(CachePath()), "labs.json") } + +// labsTried is set once this process asked models.dev for its lab +// catalog, answered or not: one models.dev stops serving doesn't have the +// provider catalog fetched again every hour (Stale). +var labsTried atomic.Bool + +// labsURL is the lab catalog beside the provider catalog modelsDevURL +// names, or "" when it names none (a test's own server root). +func labsURL() string { + if base, ok := strings.CutSuffix(modelsDevURL, "/api.json"); ok { + return base + "/models.json" + } + return "" +} + +// readLabs is the lab catalog Sync kept, by "lab/model", or none when it +// has none or can't be read: the provider catalog answers alone, as it did +// before there was one. +func readLabs() map[string]mdModel { + b, err := os.ReadFile(LabsPath()) + if err != nil { + return nil + } + var m map[string]mdModel + if json.Unmarshal(b, &m) != nil { + return nil + } + return m +} + +// syncLabs fetches the lab catalog into LabsPath, written whole through a +// rename. A failed fetch keeps the one kept before. +func syncLabs(ctx context.Context) error { + u := labsURL() + if u == "" { + return nil + } + labsTried.Store(true) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil) + if err != nil { + return err + } + req.Header.Set("User-Agent", "magpie") + resp, err := http.DefaultClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("models.dev labs: %s", resp.Status) + } + b, err := io.ReadAll(io.LimitReader(resp.Body, 64<<20)) + if err != nil { + return err + } + var probe map[string]mdModel + if err := json.Unmarshal(b, &probe); err != nil || len(probe) == 0 { + return fmt.Errorf("models.dev labs: unexpected payload") + } + p := LabsPath() + if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil { + return err + } + tmp, err := os.CreateTemp(filepath.Dir(p), ".labs-*.json") + if err != nil { + return err + } + if _, err := tmp.Write(b); err != nil { + tmp.Close() + os.Remove(tmp.Name()) + return err + } + if err := tmp.Close(); err != nil { + os.Remove(tmp.Name()) + return err + } + if err := os.Chmod(tmp.Name(), 0o644); err != nil { + os.Remove(tmp.Name()) + return err + } + if err := os.Rename(tmp.Name(), p); err != nil { + os.Remove(tmp.Name()) + return err + } + return nil +} + +// labsMissing says the provider catalog is magpie's own but no lab catalog +// was kept beside it, and none was asked for yet: one kept before magpie +// read labs is fetched again at once, not a day later. +func labsMissing() bool { + if labsTried.Load() || labsURL() == "" || Source() != CachePath() { + return false + } + _, err := os.Stat(LabsPath()) + return err != nil +} + +// labKinEfforts gives a lab-only model that thinks and lists no levels +// (lab files have none) the levels of the newest thinking model of its +// family released by then that any provider gives levels: Claude Mythos +// 5.1 takes Mythos 5's. Called under loadMu, as the tables are built. +func labKinEfforts(all map[string]mdProvider) { + type kin struct{ id, date string } + byFamily := map[string][]kin{} + for _, p := range all { + for id, x := range p.Models { + if x.Family != "" { + byFamily[x.Family] = append(byFamily[x.Family], kin{bareID(id), x.ReleaseDate}) + } + } + } + for b, x := range labs { + if len(efforts[b]) > 0 || !thinks[b] || x.Family == "" { + continue + } + var best kin + for _, k := range byFamily[x.Family] { + if len(efforts[k.id]) == 0 || !thinks[k.id] || x.ReleaseDate != "" && k.date > x.ReleaseDate { + continue + } + if best.id == "" || k.date > best.date || k.date == best.date && k.id > best.id { + best = k + } + } + if best.id != "" { + efforts[b] = slices.Clone(efforts[best.id]) + } + } +} + +// Describe is a model a vendor or an account lists by id, described as +// models.dev knows it on any host — most providers' word, else its lab's — +// for a list that has it where the provider's own catalog doesn't: its +// window, reply limit, thinking, levels, images and release. name is the +// list's own, kept when it gives one. It has no price: a lab gives none, +// and another host's isn't this one's. +func Describe(id, name string) Model { + load() + m := Model{ID: id, Name: strings.TrimSpace(name)} + if m.Name == "" || m.Name == id { + m.Name = id + if n := NameOf(id); n != "" { + m.Name = n + } + } + m.Context, m.Output = ContextOf(id), OutputOf(id) + m.Efforts = EffortsOf(id) + m.Reasoning = Thinks(id) || len(m.Efforts) > 0 + m.Images = SeesImages(id) + if x, ok := lookup(id, labs); ok { + m.ImageInput = imageInput(x.Modalities.Input) + m.Released, m.Temperature = x.ReleaseDate, x.Temperature + m.InputModalities, m.OutputModalities = x.Modalities.Input, x.Modalities.Output + } + return m +} diff --git a/internal/catalog/labs_test.go b/internal/catalog/labs_test.go new file mode 100644 index 000000000..3281b0129 --- /dev/null +++ b/internal/catalog/labs_test.go @@ -0,0 +1,169 @@ +package catalog + +import ( + "context" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "slices" + "testing" +) + +// The catalogs as models.dev serves them on 10-27, cut to Claude: its +// anthropic and azure providers (api.json) and the anthropic lab +// (models.json). models.dev took the gated Claude Mythos 5.1 out of +// anthropic's provider list (#11327) and kept its lab file (#11328). +const ( + claudeAPI10_27 = "testdata/models.dev-2026-10-27-claude.json" + claudeLabs10_27 = "testdata/models.dev-labs-2026-10-27-anthropic.json" +) + +func useCatalogs(t *testing.T, api, labs string) { + t.Helper() + t.Setenv("XDG_CACHE_HOME", t.TempDir()) + t.Cleanup(Reset) + for src, dst := range map[string]string{api: CachePath(), labs: LabsPath()} { + if src == "" { + continue + } + b, err := os.ReadFile(src) + if err != nil { + t.Fatal(err) + } + os.MkdirAll(filepath.Dir(dst), 0o755) + if err := os.WriteFile(dst, b, 0o644); err != nil { + t.Fatal(err) + } + } + Reset() +} + +// A model models.dev keeps under its lab alone is still known: an account +// or a vendor's list that has Claude Mythos 5.1 gets its name, 1M window, +// reply limit, thinking and images from the lab file, and Mythos 5's +// levels, the newest of its family any provider gives (iebb on Discord). +func TestLabOnlyModelIsKnown(t *testing.T) { + useCatalogs(t, claudeAPI10_27, claudeLabs10_27) + for _, m := range Provider("anthropic") { + if m.ID == "claude-mythos-5-1" { + t.Fatal("fixture: models.dev's anthropic list has Mythos 5.1 again") + } + } + const id = "claude-mythos-5-1" + if got := NameOf(id); got != "Claude Mythos 5.1" { + t.Errorf("NameOf = %q", got) + } + if got := ContextOf(id); got != 1_000_000 { + t.Errorf("ContextOf = %d", got) + } + if got := OutputOf(id); got != 128_000 { + t.Errorf("OutputOf = %d", got) + } + if !Thinks(id) || !SeesImages(id) { + t.Errorf("Thinks %v, SeesImages %v", Thinks(id), SeesImages(id)) + } + want := EffortsOf("claude-mythos-5") + if len(want) == 0 { + t.Fatal("fixture: Mythos 5 has no levels") + } + if got := EffortsOf(id); !slices.Equal(got, want) { + t.Errorf("EffortsOf = %v, want Mythos 5's %v", got, want) + } + // a vendor prefix and Claude Code's [1m] reach it as they reach any + for _, as := range []string{"anthropic/claude-mythos-5-1", "claude-mythos-5-1[1m]"} { + if got := ContextOf(as); got != 1_000_000 { + t.Errorf("ContextOf(%q) = %d", as, got) + } + } + + d := Describe(id, "") + if d.Name != "Claude Mythos 5.1" || d.Context != 1_000_000 || d.Output != 128_000 || + !d.Reasoning || !slices.Equal(d.Efforts, want) || !d.Images || d.Released != "2026-09-01" || + d.Temperature == nil || *d.Temperature || d.Price != nil { + t.Errorf("Describe = %+v", d) + } + if d := Describe(id, "Mythos (account)"); d.Name != "Mythos (account)" { + t.Errorf("Describe kept no list name: %q", d.Name) + } +} + +// A model a provider lists keeps what providers say of it: its lab file +// adds nothing to it, and without a lab catalog the catalog answers as +// before. +func TestLabsLeaveListedModels(t *testing.T) { + useCatalogs(t, claudeAPI10_27, "") + want := map[string]int{} + for _, m := range Provider("anthropic") { + want[m.ID] = ContextOf(m.ID) + } + if ContextOf("claude-mythos-5-1") != 0 { + t.Fatal("Mythos 5.1 known without a lab catalog") + } + useCatalogs(t, claudeAPI10_27, claudeLabs10_27) + for id, w := range want { + if got := ContextOf(id); got != w { + t.Errorf("%s: window %d with labs, %d without", id, got, w) + } + } +} + +// Sync keeps models.dev's lab catalog beside its provider catalog, and a +// lab fetch that fails keeps the one it had. +func TestSyncKeepsLabs(t *testing.T) { + api, _ := os.ReadFile(claudeAPI10_27) + labs, _ := os.ReadFile(claudeLabs10_27) + labsDown := false + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/api.json": + w.Write(api) + case "/models.json": + if labsDown { + http.Error(w, "down", http.StatusBadGateway) + return + } + w.Write(labs) + default: + http.NotFound(w, r) + } + })) + defer srv.Close() + useCatalogs(t, "", "") + was := modelsDevURL + modelsDevURL = srv.URL + "/api.json" + t.Cleanup(func() { modelsDevURL = was; labsTried.Store(false) }) + + labsTried.Store(false) + if err := Sync(context.Background()); err != nil { + t.Fatal(err) + } + if got := ContextOf("claude-mythos-5-1"); got != 1_000_000 { + t.Fatalf("after Sync, Mythos 5.1's window = %d", got) + } + if Stale() { + t.Error("a catalog just synced with its labs is stale") + } + + labsDown = true + if err := Sync(context.Background()); err != nil { + t.Fatal("a lab fetch failing failed Sync:", err) + } + if got := ContextOf("claude-mythos-5-1"); got != 1_000_000 { + t.Errorf("a failed lab fetch lost the kept labs: window %d", got) + } + + // a cache kept before magpie read labs is fetched again at once + os.Remove(LabsPath()) + labsTried.Store(false) + if !Stale() { + t.Error("a catalog without its labs isn't stale") + } + labsDown = false + if err := Sync(context.Background()); err != nil { + t.Fatal(err) + } + if Stale() { + t.Error("stale after the labs came") + } +} diff --git a/internal/catalog/testdata/models.dev-2026-10-27-claude.json b/internal/catalog/testdata/models.dev-2026-10-27-claude.json new file mode 100644 index 000000000..32618db2d --- /dev/null +++ b/internal/catalog/testdata/models.dev-2026-10-27-claude.json @@ -0,0 +1,1720 @@ +{ + "anthropic": { + "doc": "https://docs.anthropic.com/en/docs/about-claude/models", + "env": [ + "ANTHROPIC_API_KEY" + ], + "id": "anthropic", + "models": { + "claude-fable-5": { + "attachment": true, + "cost": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "description": "Claude model for creative writing, analysis, and controlled agent workflows", + "family": "claude-fable", + "id": "claude-fable-5", + "last_updated": "2026-06-09", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-06-07", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-fable-5-1": { + "attachment": true, + "canonical_model_id": "anthropic/claude-fable-5-1", + "cost": { + "cache_read": 0.25, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "description": "Claude model for demanding reasoning and long-horizon agentic work", + "family": "claude-fable", + "id": "claude-fable-5-1", + "knowledge": "2026-06", + "last_updated": "2026-09-01", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5.1", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-09-01", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-haiku-4-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-haiku-4-5", + "cost": { + "cache_read": 0.1, + "cache_write": 1.25, + "input": 1, + "output": 5 + }, + "description": "Fast Claude lane for lightweight agents, office tasks, and responsive chat", + "family": "claude-haiku", + "id": "claude-haiku-4-5", + "knowledge": "2025-02-28", + "last_updated": "2025-10-15", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-10-15", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-haiku-4-5-20251001": { + "attachment": true, + "cost": { + "cache_read": 0.1, + "cache_write": 1.25, + "input": 1, + "output": 5 + }, + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "claude-haiku-4-5-20251001", + "knowledge": "2025-02-28", + "last_updated": "2025-10-15", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 4.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-10-15", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-haiku-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-haiku-5-5", + "cost": { + "cache_read": 0.01, + "cache_write": 0.125, + "input": 0.1, + "output": 0.5, + "tiers": [ + { + "cache_read": 0.05, + "cache_write": 0.625, + "input": 0.5, + "output": 2.5, + "tier": { + "size": 100000, + "type": "context" + } + } + ] + }, + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "claude-haiku-5-5", + "knowledge": "2026-06", + "last_updated": "2026-10-07", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 5.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "toggle" + }, + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-10-07", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-4-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-4-5", + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "claude-opus-4-5", + "knowledge": "2025-05", + "last_updated": "2025-11-24", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-11-24", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-opus-4-5-20251101": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "claude-opus-4-5-20251101", + "knowledge": "2025-05", + "last_updated": "2025-11-01", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-11-24", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-opus-4-6": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "High-end Claude for difficult coding, planning, and slower expert reasoning", + "family": "claude-opus", + "id": "claude-opus-4-6", + "knowledge": "2025-05-31", + "last_updated": "2026-03-13", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.6", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "max" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2026-02-04", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-opus-4-7": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Stronger Opus tier for advanced software work and high-stakes reasoning", + "family": "claude-opus", + "id": "claude-opus-4-7", + "knowledge": "2026-01-31", + "last_updated": "2026-04-16", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.7", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-04-14", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-4-8": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Top Claude Opus tier for the hardest reasoning, coding, and long-horizon agents", + "experimental": { + "modes": { + "fast": { + "cost": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "provider": { + "body": { + "speed": "fast" + }, + "headers": { + "anthropic-beta": "fast-mode-2026-02-01" + } + } + } + } + }, + "family": "claude-opus", + "id": "claude-opus-4-8", + "knowledge": "2026-01", + "last_updated": "2026-05-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.8", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-05-28", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-5", + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Strongest Claude Opus model for coding, agents, and professional work", + "experimental": { + "modes": { + "fast": { + "cost": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "provider": { + "body": { + "speed": "fast" + }, + "headers": { + "anthropic-beta": "fast-mode-2026-02-01" + } + } + } + } + }, + "family": "claude-opus", + "id": "claude-opus-5", + "knowledge": "2026-05", + "last_updated": "2026-07-24", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-07-24", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-5-5", + "cost": { + "cache_read": 0.2, + "cache_write": 5, + "input": 4, + "output": 20 + }, + "description": "Claude model for long-running agentic coding and knowledge work", + "experimental": { + "modes": { + "fast": { + "cost": { + "cache_read": 0.4, + "cache_write": 10, + "input": 8, + "output": 40 + }, + "provider": { + "body": { + "speed": "fast" + }, + "headers": { + "anthropic-beta": "fast-mode-2026-02-01" + } + } + } + } + }, + "family": "claude-opus", + "id": "claude-opus-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-22", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-09-22", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-sonnet-4-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-sonnet-4-5", + "cost": { + "cache_read": 0.3, + "cache_write": 3.75, + "input": 3, + "output": 15 + }, + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "claude-sonnet-4-5", + "knowledge": "2025-07-31", + "last_updated": "2025-09-29", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-09-29", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-sonnet-4-5-20250929": { + "attachment": true, + "cost": { + "cache_read": 0.3, + "cache_write": 3.75, + "input": 3, + "output": 15 + }, + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "claude-sonnet-4-5-20250929", + "knowledge": "2025-07-31", + "last_updated": "2025-09-29", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-09-29", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-sonnet-4-6": { + "attachment": true, + "cost": { + "cache_read": 0.3, + "cache_write": 3.75, + "input": 3, + "output": 15 + }, + "description": "Claude workhorse for coding agents, careful analysis, and production cost control", + "family": "claude-sonnet", + "id": "claude-sonnet-4-6", + "knowledge": "2025-08-31", + "last_updated": "2026-03-13", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.6", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "max" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2026-02-17", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-sonnet-5": { + "attachment": true, + "cost": { + "cache_read": 0.2, + "cache_write": 2.5, + "input": 2, + "output": 10 + }, + "description": "Everyday Claude agent model for coding, planning, browsing, and general work", + "family": "claude-sonnet", + "id": "claude-sonnet-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-30", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "toggle" + }, + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-06-29", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-sonnet-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-sonnet-5-5", + "cost": { + "cache_read": 0.1, + "cache_write": 2.5, + "input": 2, + "output": 10 + }, + "description": "Fast Claude model for everyday coding, agents, and knowledge work", + "family": "claude-sonnet", + "id": "claude-sonnet-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5.5", + "open_weights": false, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-09-28", + "structured_output": true, + "temperature": false, + "tool_call": true + } + }, + "name": "Anthropic", + "npm": "@ai-sdk/anthropic" + }, + "azure": { + "doc": "https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models", + "env": [ + "AZURE_RESOURCE_NAME", + "AZURE_API_KEY" + ], + "id": "azure", + "models": { + "claude-fable-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-fable-5", + "cost": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "description": "Claude model for creative writing, analysis, and controlled agent workflows", + "family": "claude-fable", + "id": "claude-fable-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-09", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh" + ] + } + ], + "release_date": "2026-06-09", + "status": "beta", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-fable-5-1": { + "attachment": true, + "canonical_model_id": "anthropic/claude-fable-5-1", + "cost": { + "cache_read": 0.25, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "description": "Claude model for demanding reasoning and long-horizon agentic work", + "family": "claude-fable", + "id": "claude-fable-5-1", + "knowledge": "2026-06", + "last_updated": "2026-09-01", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5.1", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh" + ] + } + ], + "release_date": "2026-09-01", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-haiku-4-5": { + "attachment": true, + "cost": { + "cache_read": 0.1, + "cache_write": 1.25, + "input": 1, + "output": 5 + }, + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "claude-haiku-4-5", + "knowledge": "2025-02-28", + "last_updated": "2025-11-18", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 4.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-11-18", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-haiku-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-haiku-5-5", + "cost": { + "cache_read": 0.01, + "cache_write": 0.125, + "input": 0.1, + "output": 0.5, + "tiers": [ + { + "cache_read": 0.05, + "cache_write": 0.625, + "input": 0.5, + "output": 2.5, + "tier": { + "size": 100000, + "type": "context" + } + } + ] + }, + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "claude-haiku-5-5", + "knowledge": "2026-06", + "last_updated": "2026-10-07", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 5.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "toggle" + }, + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-10-07", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-mythos-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-mythos-5", + "cost": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 50 + }, + "description": "Restricted Claude model for advanced cybersecurity and biology research workflows", + "family": "claude-mythos", + "id": "claude-mythos-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-09", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Mythos 5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh" + ] + } + ], + "release_date": "2026-06-09", + "status": "beta", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-4-5": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "claude-opus-4-5", + "knowledge": "2025-03-31", + "last_updated": "2025-08-01", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-11-24", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-opus-4-6": { + "attachment": true, + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "context_over_200k": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 37.5 + }, + "input": 5, + "output": 25, + "tiers": [ + { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 37.5, + "tier": { + "size": 200000, + "type": "context" + } + } + ] + }, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "claude-opus-4-6", + "knowledge": "2025-05-31", + "last_updated": "2026-07-17", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.6", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "max" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2026-02-05", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-opus-4-7": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-4-7", + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Stronger Opus tier for advanced software work and high-stakes reasoning", + "family": "claude-opus", + "id": "claude-opus-4-7", + "knowledge": "2026-01-31", + "last_updated": "2026-04-16", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.7", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-04-16", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-4-8": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-4-8", + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "context_over_200k": { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 37.5 + }, + "input": 5, + "output": 25, + "tiers": [ + { + "cache_read": 1, + "cache_write": 12.5, + "input": 10, + "output": 37.5, + "tier": { + "size": 200000, + "type": "context" + } + } + ] + }, + "description": "Top Claude Opus tier for the hardest reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "claude-opus-4-8", + "knowledge": "2025-12-31", + "last_updated": "2026-05-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.8", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-05-28", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-5", + "cost": { + "cache_read": 0.5, + "cache_write": 6.25, + "input": 5, + "output": 25 + }, + "description": "Strongest Claude Opus model for coding, agents, and professional work", + "family": "claude-opus", + "id": "claude-opus-5", + "knowledge": "2026-05", + "last_updated": "2026-07-24", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-07-24", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-opus-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-opus-5-5", + "cost": { + "cache_read": 0.2, + "cache_write": 5, + "input": 4, + "output": 20 + }, + "description": "Claude model for long-running agentic coding and knowledge work", + "family": "claude-opus", + "id": "claude-opus-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-22", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-09-22", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-sonnet-4-5": { + "attachment": true, + "cost": { + "cache_read": 0.3, + "cache_write": 3.75, + "input": 3, + "output": 15 + }, + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "claude-sonnet-4-5", + "knowledge": "2025-07-31", + "last_updated": "2025-11-18", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2025-11-18", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-sonnet-4-6": { + "attachment": true, + "canonical_model_id": "anthropic/claude-sonnet-4-6", + "cost": { + "cache_read": 0.3, + "cache_write": 3.75, + "input": 3, + "output": 15 + }, + "description": "Claude workhorse for coding agents, careful analysis, and production cost control", + "family": "claude-sonnet", + "id": "claude-sonnet-4-6", + "knowledge": "2025-08-31", + "last_updated": "2026-03-13", + "limit": { + "context": 1000000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.6", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "max" + ] + }, + { + "min": 1024, + "type": "budget_tokens" + } + ], + "release_date": "2026-02-17", + "structured_output": true, + "temperature": true, + "tool_call": true + }, + "claude-sonnet-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-sonnet-5", + "cost": { + "cache_read": 0.2, + "cache_write": 2.5, + "input": 2, + "output": 10 + }, + "description": "Everyday Claude agent model for coding, planning, browsing, and general work", + "family": "claude-sonnet", + "id": "claude-sonnet-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-30", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "toggle" + }, + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-06-30", + "structured_output": true, + "temperature": false, + "tool_call": true + }, + "claude-sonnet-5-5": { + "attachment": true, + "canonical_model_id": "anthropic/claude-sonnet-5-5", + "cost": { + "cache_read": 0.2, + "cache_write": 2.5, + "input": 2, + "output": 10 + }, + "description": "Fast Claude model for everyday coding, agents, and knowledge work", + "family": "claude-sonnet", + "id": "claude-sonnet-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5.5", + "open_weights": false, + "provider": { + "api": "https://${AZURE_RESOURCE_NAME}.services.ai.azure.com/anthropic/v1", + "npm": "@ai-sdk/anthropic" + }, + "reasoning": true, + "reasoning_options": [ + { + "type": "effort", + "values": [ + "low", + "medium", + "high", + "xhigh", + "max" + ] + } + ], + "release_date": "2026-09-28", + "structured_output": true, + "temperature": false, + "tool_call": true + } + }, + "name": "Azure", + "npm": "@ai-sdk/azure" + } +} \ No newline at end of file diff --git a/internal/catalog/testdata/models.dev-labs-2026-10-27-anthropic.json b/internal/catalog/testdata/models.dev-labs-2026-10-27-anthropic.json new file mode 100644 index 000000000..b07f8fb38 --- /dev/null +++ b/internal/catalog/testdata/models.dev-labs-2026-10-27-anthropic.json @@ -0,0 +1,1853 @@ +{ + "anthropic/claude-3-5-haiku-20241022": { + "attachment": true, + "benchmarks": [ + { + "date": "2024-12-21", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 28, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "anthropic/claude-3-5-haiku-20241022", + "knowledge": "2024-07-31", + "last_updated": "2024-10-22", + "limit": { + "context": 200000, + "output": 8192 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 3.5", + "open_weights": false, + "reasoning": false, + "release_date": "2024-10-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-3-5-sonnet-20241022": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-01-17", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 51.6, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-3-5-sonnet-20241022", + "knowledge": "2024-04-30", + "last_updated": "2024-10-22", + "limit": { + "context": 200000, + "output": 8192 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 3.5 v2", + "open_weights": false, + "reasoning": false, + "release_date": "2024-10-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-3-7-sonnet-20250219": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-02-24", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 64.9, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-3-7-sonnet-20250219", + "knowledge": "2024-10-31", + "last_updated": "2025-02-19", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 3.7", + "open_weights": false, + "reasoning": true, + "release_date": "2025-02-19", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-3-haiku-20240307": { + "attachment": true, + "description": "Legacy model retained for compatibility with older integrations", + "family": "claude-haiku", + "id": "anthropic/claude-3-haiku-20240307", + "knowledge": "2023-08-31", + "last_updated": "2024-03-13", + "limit": { + "context": 200000, + "output": 4096 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 3", + "open_weights": false, + "reasoning": false, + "release_date": "2024-03-13", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-fable-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-06-09", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 80.3, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5" + }, + { + "metric": "resolved", + "name": "SWE-Bench Verified", + "score": 95, + "source": "https://benchlm.ai/benchmarks/sweVerified" + }, + { + "date": "2026-06-09", + "metric": "success rate", + "name": "Terminal-Bench", + "score": 88, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "version": "2.1" + }, + { + "date": "2026-06-09", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 59, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "no tools" + }, + { + "date": "2026-06-09", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 64.5, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "with tools" + }, + { + "date": "2026-06-09", + "metric": "success rate", + "name": "OSWorld-Verified", + "score": 85, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5" + }, + { + "dataset": "Diamond", + "date": "2026-06-09", + "metric": "pass rate", + "name": "FrontierCode", + "score": 29.3, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "high effort" + }, + { + "date": "2026-06-09", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1932, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5" + }, + { + "date": "2026-06-09", + "metric": "success rate", + "name": "AutomationBench", + "score": 17.4, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5" + } + ], + "description": "Claude model for creative writing, analysis, and controlled agent workflows", + "family": "claude-fable", + "id": "anthropic/claude-fable-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-09", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-06-09", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-fable-5-1": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-09-01", + "metric": "score", + "name": "Terminal-Bench-Science", + "score": 52.6, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards with fallback", + "version": "0.1" + }, + { + "date": "2026-09-01", + "metric": "score", + "name": "Terminal-Bench", + "score": 55.8, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards with fallback", + "version": "4.0" + }, + { + "date": "2026-09-01", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1853, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards with fallback", + "version": "2" + }, + { + "dataset": "August 2026 task release", + "date": "2026-09-01", + "metric": "partial score", + "name": "OSWorld", + "score": 77.9, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards; interventions score zero; no fallback", + "version": "2.0" + }, + { + "dataset": "August 2026 task release", + "date": "2026-09-01", + "metric": "strict success rate", + "name": "OSWorld", + "score": 41.7, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards; interventions score zero; no fallback", + "version": "2.0" + }, + { + "date": "2026-09-01", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 60.9, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "without tools; production safeguards with fallback" + }, + { + "date": "2026-09-01", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 65, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "with tools; production safeguards with fallback" + }, + { + "date": "2026-09-01", + "metric": "pass rate", + "name": "AutomationBench", + "score": 31.4, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "production safeguards with fallback" + }, + { + "date": "2026-09-01", + "metric": "score", + "name": "CursorBench", + "score": 73.4, + "source": "https://www.anthropic.com/claude-fable-and-mythos-5-1", + "variant": "max effort; production safeguards with fallback", + "version": "3.2.0" + } + ], + "description": "Claude model for demanding reasoning and long-horizon agentic work", + "family": "claude-fable", + "id": "anthropic/claude-fable-5-1", + "knowledge": "2026-06", + "last_updated": "2026-09-01", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Fable 5.1", + "open_weights": false, + "reasoning": true, + "release_date": "2026-09-01", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-haiku-4-5": { + "attachment": true, + "benchmarks": [ + { + "dataset": "public", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 39.45, + "source": "https://labs.scale.com/leaderboard/swe_bench_pro_public" + } + ], + "description": "Fast Claude lane for lightweight agents, office tasks, and responsive chat", + "family": "claude-haiku", + "id": "anthropic/claude-haiku-4-5", + "knowledge": "2025-02-28", + "last_updated": "2025-10-15", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-10-15", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-haiku-4-5-20251001": { + "attachment": true, + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "anthropic/claude-haiku-4-5-20251001", + "knowledge": "2025-02-28", + "last_updated": "2025-10-15", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 4.5", + "open_weights": false, + "reasoning": true, + "release_date": "2025-10-15", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-haiku-5-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-10-07", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1620, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "version": "2.1" + }, + { + "date": "2026-10-07", + "metric": "Elo", + "name": "AA-Briefcase", + "score": 1578, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "version": "1.1" + }, + { + "date": "2026-10-07", + "metric": "partial score", + "name": "OSWorld", + "score": 72.4, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "variant": "offline subset", + "version": "2.1" + }, + { + "date": "2026-10-07", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 45.9, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "variant": "no tools" + }, + { + "date": "2026-10-07", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 57.4, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "variant": "with tools" + }, + { + "date": "2026-10-07", + "metric": "score", + "name": "Terminal-Bench", + "score": 39.2, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "version": "4.0" + }, + { + "dataset": "Main", + "date": "2026-10-07", + "metric": "score", + "name": "FrontierCode", + "score": 46.4, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "version": "1.1" + }, + { + "date": "2026-10-07", + "metric": "score", + "name": "Chartography", + "score": 46.4, + "source": "https://www.anthropic.com/claude-haiku-5-5", + "variant": "no tools" + } + ], + "description": "Fast Claude model for responsive assistance, classification, and lightweight agents", + "family": "claude-haiku", + "id": "anthropic/claude-haiku-5-5", + "knowledge": "2026-06", + "last_updated": "2026-10-07", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Haiku 5.5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-10-07", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-mythos-5": { + "attachment": true, + "description": "Restricted Claude model for advanced cybersecurity and biology research workflows", + "family": "claude-mythos", + "id": "anthropic/claude-mythos-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-09", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Mythos 5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-06-09", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-mythos-5-1": { + "attachment": true, + "description": "Restricted Claude model for advanced cybersecurity and biology research workflows", + "family": "claude-mythos", + "id": "anthropic/claude-mythos-5-1", + "knowledge": "2026-06", + "last_updated": "2026-09-01", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Mythos 5.1", + "open_weights": false, + "reasoning": true, + "release_date": "2026-09-01", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-opus-4-0": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-05-25", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 72, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-0", + "knowledge": "2025-03-31", + "last_updated": "2025-05-22", + "limit": { + "context": 200000, + "output": 32000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-05-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-1": { + "attachment": true, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-1", + "knowledge": "2025-03-31", + "last_updated": "2025-08-05", + "limit": { + "context": 200000, + "output": 32000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.1 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-08-05", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-1-20250805": { + "attachment": true, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-1-20250805", + "knowledge": "2025-03-31", + "last_updated": "2025-08-05", + "limit": { + "context": 200000, + "output": 32000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.1", + "open_weights": false, + "reasoning": true, + "release_date": "2025-08-05", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-20250514": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-05-25", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 72, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-20250514", + "knowledge": "2025-03-31", + "last_updated": "2025-05-22", + "limit": { + "context": 200000, + "output": 32000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4", + "open_weights": false, + "reasoning": true, + "release_date": "2025-05-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-5": { + "attachment": true, + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-5", + "knowledge": "2025-05", + "last_updated": "2025-11-24", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-11-24", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-5-20251101": { + "attachment": true, + "benchmarks": [ + { + "dataset": "public", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 45.89, + "source": "https://labs.scale.com/leaderboard/swe_bench_pro_public" + } + ], + "description": "Flagship Claude model for deep reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-5-20251101", + "knowledge": "2025-05", + "last_updated": "2025-11-24", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.5", + "open_weights": false, + "reasoning": true, + "release_date": "2025-11-24", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-6": { + "attachment": true, + "benchmarks": [ + { + "dataset": "public", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 51.9, + "source": "https://labs.scale.com/leaderboard/swe_bench_pro_public" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Codebase QnA", + "score": 33.3, + "source": "https://labs.scale.com/leaderboard/sweatlas-qna" + }, + { + "harness": "Mini-SWE-Agent", + "metric": "score", + "name": "SWE-Atlas Codebase QnA", + "score": 30, + "source": "https://labs.scale.com/leaderboard/sweatlas-qna" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Refactoring", + "score": 35.58, + "source": "https://labs.scale.com/leaderboard/sweatlas-refactoring" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Test Writing", + "score": 36.67, + "source": "https://labs.scale.com/leaderboard/sweatlas-tw" + }, + { + "harness": "Mini-SWE-Agent", + "metric": "score", + "name": "SWE-Atlas Test Writing", + "score": 36.08, + "source": "https://labs.scale.com/leaderboard/sweatlas-tw" + }, + { + "harness": "Claude Code", + "metric": "average pass@1", + "name": "Artificial Analysis Coding Agent Index", + "score": 51.3, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Atlas Codebase QnA", + "score": 71.9, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "dataset": "hard-aa", + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Bench Pro", + "score": 11.8, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "Terminal-Bench", + "score": 70.2, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium", + "version": "2.1" + } + ], + "description": "High-end Claude for difficult coding, planning, and slower expert reasoning", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-6", + "knowledge": "2025-05-31", + "last_updated": "2026-03-13", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.6", + "open_weights": false, + "reasoning": true, + "release_date": "2026-02-05", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-opus-4-7": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-05-28", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 64.3, + "source": "https://www.anthropic.com/news/claude-opus-4-8" + }, + { + "date": "2026-05-28", + "harness": "Terminus-2", + "metric": "success rate", + "name": "Terminal-Bench", + "score": 66.1, + "source": "https://www.anthropic.com/news/claude-opus-4-8", + "version": "2.1" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Refactoring", + "score": 48.57, + "source": "https://labs.scale.com/leaderboard/sweatlas-refactoring" + }, + { + "harness": "Claude Code", + "metric": "average pass@1", + "name": "Artificial Analysis Coding Agent Index", + "score": 66.6, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "max" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Atlas Codebase QnA", + "score": 81, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "max" + }, + { + "dataset": "hard-aa", + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Bench Pro", + "score": 44.9, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "max" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "Terminal-Bench", + "score": 73.8, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "max", + "version": "2.1" + }, + { + "harness": "Cursor CLI", + "metric": "average pass@1", + "name": "Artificial Analysis Coding Agent Index", + "score": 61.2, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Cursor CLI", + "metric": "pass@1", + "name": "SWE-Atlas Codebase QnA", + "score": 78.4, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "dataset": "hard-aa", + "harness": "Cursor CLI", + "metric": "pass@1", + "name": "SWE-Bench Pro", + "score": 34.4, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Cursor CLI", + "metric": "pass@1", + "name": "Terminal-Bench", + "score": 70.6, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium", + "version": "2.1" + }, + { + "harness": "Claude Code", + "metric": "average pass@1", + "name": "Artificial Analysis Coding Agent Index", + "score": 59.9, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Atlas Codebase QnA", + "score": 71.7, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "dataset": "hard-aa", + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Bench Pro", + "score": 36.4, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "Terminal-Bench", + "score": 71.4, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium", + "version": "2.1" + }, + { + "date": "2026-04-23", + "metric": "accuracy", + "name": "GPQA Diamond", + "score": 94.2, + "source": "https://openai.com/index/introducing-gpt-5-5/" + }, + { + "date": "2026-04-23", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 46.9, + "source": "https://openai.com/index/introducing-gpt-5-5/", + "variant": "no tools" + }, + { + "date": "2026-04-23", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 54.7, + "source": "https://openai.com/index/introducing-gpt-5-5/", + "variant": "with tools" + }, + { + "date": "2026-04-23", + "metric": "success rate", + "name": "OSWorld-Verified", + "score": 78, + "source": "https://openai.com/index/introducing-gpt-5-5/" + } + ], + "description": "Stronger Opus tier for advanced software work and high-stakes reasoning", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-7", + "knowledge": "2026-01-31", + "last_updated": "2026-04-16", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.7", + "open_weights": false, + "reasoning": true, + "release_date": "2026-04-16", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-opus-4-8": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-05-28", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 69.2, + "source": "https://www.anthropic.com/news/claude-opus-4-8" + }, + { + "date": "2026-05-28", + "harness": "Terminus-2", + "metric": "success rate", + "name": "Terminal-Bench", + "score": 74.6, + "source": "https://www.anthropic.com/news/claude-opus-4-8", + "version": "2.1" + }, + { + "metric": "resolved", + "name": "SWE-Bench Verified", + "score": 88.6, + "source": "https://benchlm.ai/benchmarks/sweVerified" + }, + { + "date": "2026-06-09", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 49.8, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "no tools" + }, + { + "date": "2026-06-09", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 57.9, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "with tools" + }, + { + "date": "2026-06-09", + "metric": "success rate", + "name": "OSWorld-Verified", + "score": 83.4, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5" + }, + { + "dataset": "Diamond", + "date": "2026-06-09", + "metric": "pass rate", + "name": "FrontierCode", + "score": 13.4, + "source": "https://www.anthropic.com/news/claude-fable-5-mythos-5", + "variant": "high effort" + } + ], + "description": "Top Claude Opus tier for the hardest reasoning, coding, and long-horizon agents", + "family": "claude-opus", + "id": "anthropic/claude-opus-4-8", + "knowledge": "2026-01", + "last_updated": "2026-05-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 4.8", + "open_weights": false, + "reasoning": true, + "release_date": "2026-05-28", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-opus-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-07-24", + "metric": "resolved", + "name": "SWE-Bench Verified", + "score": 96, + "source": "https://www.anthropic.com/claude-opus-5-system-card" + }, + { + "date": "2026-07-24", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 79.2, + "source": "https://www.anthropic.com/claude-opus-5-system-card" + }, + { + "date": "2026-07-24", + "metric": "resolve rate", + "name": "SWE-Bench Multilingual", + "score": 89.5, + "source": "https://www.anthropic.com/claude-opus-5-system-card" + }, + { + "date": "2026-07-24", + "metric": "resolve rate", + "name": "SWE-Bench Multimodal", + "score": 59.4, + "source": "https://www.anthropic.com/claude-opus-5-system-card" + }, + { + "date": "2026-07-24", + "metric": "resolve rate", + "name": "DeepSWE", + "score": 68.8, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "version": "1.1" + }, + { + "dataset": "Main", + "date": "2026-07-24", + "metric": "mean@5", + "name": "FrontierCode", + "score": 53.4, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "medium effort", + "version": "1.1" + }, + { + "date": "2026-07-24", + "harness": "mini-SWE-agent", + "metric": "mean reward", + "name": "Frontier-Bench", + "score": 43.3, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort", + "version": "v0.1" + }, + { + "date": "2026-07-24", + "metric": "accuracy", + "name": "BrowseComp", + "score": 90.8, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "single agent" + }, + { + "date": "2026-07-24", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 56.3, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "no tools" + }, + { + "date": "2026-07-24", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 64.7, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "with tools" + }, + { + "date": "2026-07-24", + "metric": "F1", + "name": "DeepSearchQA", + "score": 95, + "source": "https://www.anthropic.com/news/claude-opus-5", + "variant": "max effort" + }, + { + "date": "2026-07-24", + "metric": "success rate", + "name": "OSWorld", + "score": 70.6, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "version": "2.0" + }, + { + "date": "2026-07-24", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1861, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort", + "version": "v2" + }, + { + "date": "2026-07-24", + "metric": "Elo", + "name": "AA-Briefcase", + "score": 1720, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort" + }, + { + "date": "2026-07-24", + "metric": "success rate", + "name": "AutomationBench", + "score": 26, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort" + }, + { + "date": "2026-07-24", + "metric": "accuracy", + "name": "ARC-AGI-1", + "score": 97.5, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort" + }, + { + "date": "2026-07-24", + "metric": "accuracy", + "name": "ARC-AGI-2", + "score": 90.4, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort" + }, + { + "date": "2026-07-24", + "metric": "RHAE", + "name": "ARC-AGI-3", + "score": 30.2, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "high effort" + }, + { + "date": "2026-07-24", + "metric": "score", + "name": "HealthBench Professional", + "score": 59.8, + "source": "https://www.anthropic.com/claude-opus-5-system-card", + "variant": "max effort" + } + ], + "description": "Strongest Claude Opus model for coding, agents, and professional work", + "family": "claude-opus", + "id": "anthropic/claude-opus-5", + "knowledge": "2026-05", + "last_updated": "2026-07-24", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-07-24", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-opus-5-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-09-22", + "metric": "score", + "name": "Terminal-Bench", + "score": 66.4, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "xhigh effort; production safeguards with fallback", + "version": "4.0" + }, + { + "dataset": "Main", + "date": "2026-09-22", + "metric": "score", + "name": "FrontierCode", + "score": 54.4, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards with fallback", + "version": "1.1" + }, + { + "date": "2026-09-22", + "metric": "score", + "name": "CursorBench", + "score": 57.8, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards with fallback", + "version": "4.0" + }, + { + "date": "2026-09-22", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1846, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards with fallback", + "version": "2.1" + }, + { + "date": "2026-09-22", + "metric": "pass rate", + "name": "AutomationBench", + "score": 40, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards; no fallback" + }, + { + "date": "2026-09-22", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 67.7, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; with tools; production safeguards with fallback" + }, + { + "date": "2026-09-22", + "metric": "score", + "name": "Terminal-Bench-Science", + "score": 58.7, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards with fallback", + "version": "0.1" + }, + { + "date": "2026-09-22", + "metric": "partial score", + "name": "OSWorld", + "score": 81.8, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; production safeguards with fallback", + "version": "2.0" + }, + { + "date": "2026-09-22", + "metric": "score", + "name": "Chartography", + "score": 89, + "source": "https://www.anthropic.com/claude-opus-5-5", + "variant": "max effort; with tools; production safeguards with fallback" + } + ], + "description": "Claude model for long-running agentic coding and knowledge work", + "family": "claude-opus", + "id": "anthropic/claude-opus-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-22", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Opus 5.5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-09-22", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-sonnet-4-0": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-05-24", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 61.3, + "source": "https://aider.chat/docs/leaderboards/" + }, + { + "dataset": "public", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 42.7, + "source": "https://labs.scale.com/leaderboard/swe_bench_pro_public" + } + ], + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-4-0", + "knowledge": "2025-03-31", + "last_updated": "2025-05-22", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-05-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-sonnet-4-20250514": { + "attachment": true, + "benchmarks": [ + { + "date": "2025-05-24", + "metric": "percent correct", + "name": "Aider Polyglot", + "score": 61.3, + "source": "https://aider.chat/docs/leaderboards/" + } + ], + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-4-20250514", + "knowledge": "2025-03-31", + "last_updated": "2025-05-22", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4", + "open_weights": false, + "reasoning": true, + "release_date": "2025-05-22", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-sonnet-4-5": { + "attachment": true, + "benchmarks": [ + { + "dataset": "public", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 43.6, + "source": "https://labs.scale.com/leaderboard/swe_bench_pro_public" + } + ], + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-4-5", + "knowledge": "2025-07-31", + "last_updated": "2025-09-29", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.5 (latest)", + "open_weights": false, + "reasoning": true, + "release_date": "2025-09-29", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-sonnet-4-5-20250929": { + "attachment": true, + "description": "Balanced Claude model for coding, analysis, agent workflows, and cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-4-5-20250929", + "knowledge": "2025-07-31", + "last_updated": "2025-09-29", + "limit": { + "context": 200000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.5", + "open_weights": false, + "reasoning": true, + "release_date": "2025-09-29", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-sonnet-4-6": { + "attachment": true, + "benchmarks": [ + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Codebase QnA", + "score": 31.2, + "source": "https://labs.scale.com/leaderboard/sweatlas-qna" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Refactoring", + "score": 32.21, + "source": "https://labs.scale.com/leaderboard/sweatlas-refactoring" + }, + { + "harness": "Claude Code", + "metric": "score", + "name": "SWE-Atlas Test Writing", + "score": 31.76, + "source": "https://labs.scale.com/leaderboard/sweatlas-tw" + }, + { + "harness": "Claude Code", + "metric": "average pass@1", + "name": "Artificial Analysis Coding Agent Index", + "score": 49.4, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Atlas Codebase QnA", + "score": 70.3, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "dataset": "hard-aa", + "harness": "Claude Code", + "metric": "pass@1", + "name": "SWE-Bench Pro", + "score": 14.9, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium" + }, + { + "harness": "Claude Code", + "metric": "pass@1", + "name": "Terminal-Bench", + "score": 63.1, + "source": "https://artificialanalysis.ai/agents/coding-agents", + "variant": "medium", + "version": "2.1" + }, + { + "date": "2026-06-30", + "harness": "Terminus-2", + "metric": "success rate", + "name": "Terminal-Bench", + "score": 67, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "version": "2.1" + }, + { + "date": "2026-06-30", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 34.6, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "variant": "no tools" + }, + { + "date": "2026-06-30", + "metric": "accuracy", + "name": "Humanity's Last Exam", + "score": 46.8, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "variant": "with tools" + }, + { + "date": "2026-06-30", + "metric": "success rate", + "name": "OSWorld-Verified", + "score": 78.5, + "source": "https://www.anthropic.com/news/claude-sonnet-5" + } + ], + "description": "Claude workhorse for coding agents, careful analysis, and production cost control", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-4-6", + "knowledge": "2025-08-31", + "last_updated": "2026-03-13", + "limit": { + "context": 1000000, + "output": 64000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 4.6", + "open_weights": false, + "reasoning": true, + "release_date": "2026-02-17", + "temperature": true, + "tool_call": true + }, + "anthropic/claude-sonnet-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-06-30", + "metric": "resolved", + "name": "SWE-Bench Verified", + "score": 85.2, + "source": "https://www.anthropic.com/news/claude-sonnet-5" + }, + { + "date": "2026-06-30", + "metric": "resolve rate", + "name": "SWE-Bench Pro", + "score": 63.2, + "source": "https://www.anthropic.com/news/claude-sonnet-5" + }, + { + "date": "2026-06-30", + "metric": "resolve rate", + "name": "SWE-Bench Multilingual", + "score": 78.3, + "source": "https://www.anthropic.com/news/claude-sonnet-5" + }, + { + "date": "2026-06-30", + "harness": "Terminus-2", + "metric": "success rate", + "name": "Terminal-Bench", + "score": 80.4, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "version": "2.1" + }, + { + "date": "2026-06-30", + "metric": "success rate", + "name": "OSWorld-Verified", + "score": 81.2, + "source": "https://www.anthropic.com/news/claude-sonnet-5" + }, + { + "date": "2026-06-30", + "metric": "accuracy", + "name": "BrowseComp", + "score": 84.7, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "variant": "single agent" + }, + { + "date": "2026-06-30", + "metric": "pass rate", + "name": "FrontierCode", + "score": 38.8, + "source": "https://www.anthropic.com/news/claude-sonnet-5", + "version": "v1" + } + ], + "description": "Everyday Claude agent model for coding, planning, browsing, and general work", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-5", + "knowledge": "2026-01-31", + "last_updated": "2026-06-30", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-06-30", + "temperature": false, + "tool_call": true + }, + "anthropic/claude-sonnet-5-5": { + "attachment": true, + "benchmarks": [ + { + "date": "2026-09-28", + "metric": "score", + "name": "Terminal-Bench", + "score": 70.6, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "version": "4.0" + }, + { + "dataset": "Main", + "date": "2026-09-28", + "metric": "score", + "name": "FrontierCode", + "score": 46.2, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "variant": "max effort", + "version": "1.1" + }, + { + "date": "2026-09-28", + "metric": "score", + "name": "CursorBench", + "score": 55.5, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "version": "4.0" + }, + { + "date": "2026-09-28", + "metric": "Elo", + "name": "GDPval-AA", + "score": 1844, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "version": "2.1" + }, + { + "date": "2026-09-28", + "metric": "score", + "name": "Humanity's Last Exam", + "score": 64.5, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "variant": "with tools" + }, + { + "date": "2026-09-28", + "metric": "partial score", + "name": "OSWorld", + "score": 80.1, + "source": "https://www.anthropic.com/claude-sonnet-5-5", + "version": "2.1" + } + ], + "description": "Fast Claude model for everyday coding, agents, and knowledge work", + "family": "claude-sonnet", + "id": "anthropic/claude-sonnet-5-5", + "knowledge": "2026-06", + "last_updated": "2026-09-28", + "limit": { + "context": 1000000, + "output": 128000 + }, + "modalities": { + "input": [ + "text", + "image", + "pdf" + ], + "output": [ + "text" + ] + }, + "name": "Claude Sonnet 5.5", + "open_weights": false, + "reasoning": true, + "release_date": "2026-09-28", + "temperature": false, + "tool_call": true + } +} \ No newline at end of file diff --git a/internal/provider/account.go b/internal/provider/account.go index 2248bc5a7..c0028a28a 100644 --- a/internal/provider/account.go +++ b/internal/provider/account.go @@ -826,12 +826,13 @@ func claudeProvider(acct *Account) Provider { // account runs Claude Code itself (the gateway's bridge, a test), so // one that would go straight to the API with its sign-in is refused acct.sign = func(context.Context, *http.Request, []byte) error { return errClaudeViaCLI } - acct.models = func() []catalog.Model { return catalog.Provider("anthropic") } + acct.models = claudeModels acct.magpieList = true - // Claude's models are the ones magpie knows: listing them would ask + // Claude's models are the ones magpie knows and the ones Claude Code + // was told an account has (claude_models.go): listing them would ask // Anthropic with the account's sign-in, which magpie never does acct.fetch = func(context.Context) ([]catalog.Model, error) { - ms := catalog.Provider("anthropic") + ms := claudeModels() return ms, catalog.SaveLive("claude", claudeBase, ms) } return Provider{ID: "claude", Name: "Claude Code", Icon: "claudecode-color", Anthropic: claudeBase, diff --git a/internal/provider/claude_code_models.go b/internal/provider/claude_code_models.go new file mode 100644 index 000000000..d5e9e0b58 --- /dev/null +++ b/internal/provider/claude_code_models.go @@ -0,0 +1,278 @@ +package provider + +// A Claude account's models are the ones models.dev lists under anthropic +// and the ones Anthropic told Claude Code the account has beyond them. +// models.dev's list is what every account may call; a gated model, as +// Claude Mythos 5.1 is since models.dev took it out of that list +// (models.dev #11327), or one kept for some accounts (Opus 3), is only in +// what Claude Code was told. Claude Code asks Anthropic itself, at its +// start (/api/claude_cli/bootstrap), and keeps the answer in its global +// state file (.claude.json): additionalModelOptionsCache, the models its +// /model picker offers beyond its own; modelAccessCache, the models the +// account is or isn't entitled to; additionalModelCostsCache, their +// prices. magpie reads them back, as it reads the account's identity from +// the same file: nothing is asked of Anthropic in Claude Code's name +// (iebb on Discord: "最好以 claude code 返回为准"). + +import ( + "encoding/json" + "path/filepath" + "slices" + "sort" + "strings" + + "github.com/yetone/magpie/internal/catalog" + "github.com/yetone/magpie/internal/filememo" + "github.com/yetone/magpie/internal/settings" +) + +// claudeCodeModels is what Claude Code keeps of an account's models. +type claudeCodeModels struct { + // at is when Anthropic answered (additionalModelOptionsAnsweredAt), + // in ms: of two files of one account, the later one's word goes + at float64 + // extra are the models it offers beyond its own, by API id, with the + // name it gives them + extra []claudeExtra + // entitled is, by API id, whether the account may call the model + entitled map[string]bool + // prices are Anthropic's, by API id, USD per million tokens + prices map[string]catalog.Price +} + +type claudeExtra struct{ id, name string } + +func parseClaudeCodeModels(b []byte) (claudeCodeModels, error) { + var raw struct { + Options []struct { + Value *string `json:"value"` + Label string `json:"label"` + Disabled bool `json:"disabled"` + } `json:"additionalModelOptionsCache"` + At float64 `json:"additionalModelOptionsAnsweredAt"` + Access []struct { + APIName string `json:"apiName"` + Entitled *bool `json:"entitled"` + } `json:"modelAccessCache"` + Costs map[string]struct { + Input float64 `json:"inputTokens"` + Output float64 `json:"outputTokens"` + Write float64 `json:"promptCacheWriteTokens"` + Write1h *float64 `json:"promptCacheWrite1hTokens"` + CacheRead float64 `json:"promptCacheReadTokens"` + } `json:"additionalModelCostsCache"` + } + if err := json.Unmarshal(b, &raw); err != nil { + return claudeCodeModels{}, err + } + out := claudeCodeModels{at: raw.At} + seen := map[string]bool{} + for _, o := range raw.Options { + if o.Value == nil || o.Disabled { + continue + } + id := claudeAPIID(*o.Value) + if id == "" || seen[id] { + continue + } + seen[id] = true + out.extra = append(out.extra, claudeExtra{id, strings.TrimSpace(o.Label)}) + } + for _, a := range raw.Access { + if id := claudeAPIID(a.APIName); id != "" && a.Entitled != nil { + if out.entitled == nil { + out.entitled = map[string]bool{} + } + out.entitled[id] = *a.Entitled + if *a.Entitled && !seen[id] { + seen[id] = true + out.extra = append(out.extra, claudeExtra{id: id}) + } + } + } + for id, c := range raw.Costs { + id = claudeAPIID(id) + if id == "" || c.Input <= 0 || c.Output <= 0 { + continue + } + p := catalog.Price{Input: c.Input, Output: c.Output, CacheRead: c.CacheRead, CacheWrite: c.Write} + if c.Write1h != nil && *c.Write1h > 0 { + p.CacheWrite1h = *c.Write1h + } + catalog.OneHourFor(id, &p) + if out.prices == nil { + out.prices = map[string]catalog.Price{} + } + out.prices[id] = p + } + return out, nil +} + +// claudeAPIID is a model id as Claude Code names it, without the window +// it takes in the name (claude-mythos-5-1[1m]): the id the API knows. "" +// for one that isn't a Claude model's id (an alias, "default"). +func claudeAPIID(v string) string { + v = strings.ToLower(strings.TrimSpace(v)) + if i := strings.IndexByte(v, '['); i > 0 && strings.HasSuffix(v, "]") { + v = v[:i] + } + if !strings.HasPrefix(v, "claude-") || strings.ContainsAny(v, " /") { + return "" + } + return v +} + +func readClaudeCodeModels(path string) (claudeCodeModels, bool) { + m, err := filememo.Read("claude models", path, parseClaudeCodeModels) + return m, err == nil +} + +// claudeCodeFiles are the state files of every Claude Code magpie knows of +// an account in: the one Claude Code itself is signed in to, then each +// saved account's own config directory (claude_dirs.go). +func claudeCodeFiles() []string { + if settings.AccountDiscoveryOff() { + return nil + } + out := []string{claudeProfilePath()} + saved, _ := filepath.Glob(filepath.Join(claudeDirsRoot(), "*", ".claude.json")) + sort.Strings(saved) + return append(out, saved...) +} + +// claudeModelsOf is what Claude Code keeps of the account user's models: +// from its saved directory or Claude Code's own sign-in, whichever +// Anthropic answered last, as that file's account is the user's. +func claudeModelsOf(user string) (claudeCodeModels, bool) { + var best claudeCodeModels + found := false + take := func(m claudeCodeModels) { + if !found || m.at > best.at { + best, found = m, true + } + } + if user == "" { + return best, false + } + if m, ok := readClaudeCodeModels(filepath.Join(claudeAccountDir(user), ".claude.json")); ok { + take(m) + } + if acct, ok := claudeProfileAccount(); ok { + email, _ := acct["emailAddress"].(string) + email = strings.ToLower(strings.TrimSpace(email)) + u := strings.ToLower(strings.TrimSpace(user)) + if email != "" && (u == email || strings.HasPrefix(u, email+" · ")) { + if m, ok := readClaudeCodeModels(claudeProfilePath()); ok { + take(m) + } + } + } + return best, found +} + +// claudeModels is the Claude provider's list: models.dev's anthropic list, +// and each model an account's Claude Code offers beyond it, described as +// models.dev knows it anywhere (its lab file for a gated one). +func claudeModels() []catalog.Model { + out := catalog.Provider("anthropic") + have := map[string]bool{} + for _, m := range out { + have[m.ID] = true + } + for _, f := range claudeCodeFiles() { + cm, ok := readClaudeCodeModels(f) + if !ok { + continue + } + for _, x := range cm.extra { + if have[x.id] { + continue + } + have[x.id] = true + m := catalog.Describe(x.id, x.name) + m.Provider = "anthropic" + if p, ok := cm.prices[x.id]; ok { + m.Price = &p + } + out = append(out, m) + } + } + sort.SliceStable(out, func(i, j int) bool { + if out[i].Released != out[j].Released { + return out[i].Released > out[j].Released + } + return out[i].ID < out[j].ID + }) + return out +} + +// claudeLists says whether the Claude account user has model, as its +// Claude Code was told: a model it isn't entitled to is left out, and one +// it offers or models.dev lists for every account is in. ok is false when +// no Claude Code of the account has said. +func claudeLists(user, model string) (has, ok bool) { + cm, found := claudeModelsOf(user) + if !found { + return false, false + } + id := claudeAPIID(model) + if id == "" { + return true, true + } + if e, said := cm.entitled[id]; said { + return e, true + } + return true, true +} + +// ClaudeCodeModels is the list Claude Code, as it is signed in on this +// computer, offers: models.dev's anthropic list without what the account +// isn't entitled to, and the models Anthropic told it the account has +// beyond them (Claude Mythos 5.1). +func ClaudeCodeModels() []catalog.Model { + if settings.AccountDiscoveryOff() { + return catalog.Provider("anthropic") + } + cm, ok := readClaudeCodeModels(claudeProfilePath()) + return claudeModelsWith(cm, ok) +} + +// claudeModelsWith is the provider's list as one account's Claude Code +// was told it: none it isn't entitled to, and of the models models.dev +// doesn't list for every account only its own. +func claudeModelsWith(cm claudeCodeModels, ok bool) []catalog.Model { + if !ok { + return catalog.Provider("anthropic") + } + base := map[string]bool{} + for _, m := range catalog.Provider("anthropic") { + base[m.ID] = true + } + own := map[string]bool{} + for _, x := range cm.extra { + own[x.id] = true + } + return slices.DeleteFunc(claudeModels(), func(m catalog.Model) bool { + if e, said := cm.entitled[m.ID]; said && !e { + return true + } + return !base[m.ID] && !own[m.ID] + }) +} + +// claudeCodePrice is Anthropic's price for a model Claude Code was told +// of, from any account's: a gated model models.dev prices nowhere. +func claudeCodePrice(model string) (catalog.Price, bool) { + id := claudeAPIID(model) + if id == "" { + return catalog.Price{}, false + } + for _, f := range claudeCodeFiles() { + if cm, ok := readClaudeCodeModels(f); ok { + if p, ok := cm.prices[id]; ok { + return p, true + } + } + } + return catalog.Price{}, false +} diff --git a/internal/provider/claude_code_models_test.go b/internal/provider/claude_code_models_test.go new file mode 100644 index 000000000..b8c3fe85e --- /dev/null +++ b/internal/provider/claude_code_models_test.go @@ -0,0 +1,177 @@ +package provider + +import ( + "context" + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "slices" + "testing" + "time" + + "github.com/yetone/magpie/internal/agentenv" + "github.com/yetone/magpie/internal/catalog" + "github.com/yetone/magpie/internal/filememo" +) + +// mythosCatalogs puts models.dev's catalogs as they were on 10-27, cut to +// Claude, where magpie keeps them: Claude Mythos 5.1 is in the anthropic +// lab (models.json) and in no provider's list (api.json). +func mythosCatalogs(t *testing.T) { + t.Helper() + for src, dst := range map[string]string{ + "../catalog/testdata/models.dev-2026-10-27-claude.json": catalog.CachePath(), + "../catalog/testdata/models.dev-labs-2026-10-27-anthropic.json": catalog.LabsPath(), + } { + b, err := os.ReadFile(src) + if err != nil { + t.Fatal(err) + } + os.MkdirAll(filepath.Dir(dst), 0o755) + if err := os.WriteFile(dst, b, 0o644); err != nil { + t.Fatal(err) + } + } + catalog.Reset() + t.Cleanup(catalog.Reset) + filememo.Forget() +} + +// what Claude Code keeps in .claude.json from Anthropic's answer to its +// bootstrap, in the shape its 2.1.311 reads it +func claudeCodeState(t *testing.T, path, email string, options []map[string]any, access []map[string]any, costs map[string]any) { + t.Helper() + writeFile(t, path, map[string]any{ + "oauthAccount": map[string]any{"emailAddress": email, "accountUuid": "u-" + email}, + "additionalModelOptionsCache": options, + "additionalModelOptionsAnsweredAt": time.Now().UnixMilli(), + "modelAccessCache": access, + "additionalModelCostsCache": costs, + }) +} + +// A Claude account lists a gated model Anthropic told its Claude Code it +// has, though models.dev's anthropic list no longer does: Claude Mythos +// 5.1, with its lab file's window and name and Anthropic's own price; an +// account not entitled to it isn't routed it (iebb on Discord). +func TestClaudeAccountListsGatedModels(t *testing.T) { + home := claudeHome(t) + claudeSignIn(t, home, time.Now().Add(time.Hour)) + claudeBase = "http://127.0.0.1:1" // asked nothing + mythosCatalogs(t) + if slices.Contains(modelIDs(catalog.Provider("anthropic")), "claude-mythos-5-1") { + t.Fatal("fixture: models.dev lists Mythos 5.1 under anthropic again") + } + + no := false + claudeCodeState(t, filepath.Join(home, ".claude.json"), "iebb@example.com", + []map[string]any{ + {"value": "claude-mythos-5-1[1m]", "label": "Mythos 5.1", "description": "Restricted research model"}, + {"value": nil, "label": "Default", "description": "Recommended"}, + {"value": "claude-opus-3", "label": "Opus 3", "description": "Retired", "disabled": true}, + }, + []map[string]any{{"apiName": "claude-mythos-5-1", "entitled": true}, {"apiName": "claude-opus-4-5", "entitled": no}}, + map[string]any{"claude-mythos-5-1": map[string]any{ + "inputTokens": 25, "outputTokens": 125, "promptCacheWriteTokens": 31.25, + "promptCacheWrite1hTokens": 50, "promptCacheReadTokens": 2.5, "webSearchRequests": 0.01}}) + filememo.Forget() + + p, ok := find(All(), "claude") + if !ok || p.Account == nil { + t.Fatal("no Claude account") + } + ms := p.Available() + i := slices.IndexFunc(ms, func(m catalog.Model) bool { return m.ID == "claude-mythos-5-1" }) + if i < 0 { + t.Fatalf("Claude account's list has no Mythos 5.1: %v", modelIDs(ms)) + } + if m := ms[i]; m.Name != "Mythos 5.1" || m.Context != 1_000_000 || m.Output != 128_000 || !m.Reasoning || len(m.Efforts) == 0 { + t.Errorf("Mythos 5.1 = %+v", m) + } + if slices.Contains(modelIDs(ms), "claude-opus-3") { + t.Error("a disabled option listed") + } + if pr, ok := p.ListPrice("claude-mythos-5-1"); !ok || pr.Input != 25 || pr.Output != 125 || pr.CacheWrite1h != 50 { + t.Errorf("price = %+v %v", pr, ok) + } + fetched, err := p.Fetch(context.Background()) + if err != nil || !slices.Contains(modelIDs(fetched), "claude-mythos-5-1") { + t.Fatalf("fetch: %v %v", modelIDs(fetched), err) + } + if e, ok := EntryOf("claude/claude-mythos-5-1"); !ok || e.Context != 1_000_000 { + t.Errorf("entry: %+v %v", e, ok) + } + + // routed to the account Anthropic entitles to it, not one it doesn't + if !p.Account.Lists("claude-mythos-5-1") { + t.Error("the entitled account doesn't list Mythos 5.1") + } + if p.Account.Lists("claude-opus-4-5") { + t.Error("a model the account isn't entitled to is listed") + } + if !p.Account.Lists("claude-sonnet-5") { + t.Error("a model models.dev lists for every account isn't listed") + } + other := &Account{Agent: "claude", User: "someone@example.com"} + claudeCodeState(t, filepath.Join(claudeAccountDir(other.User), ".claude.json"), other.User, + nil, []map[string]any{{"apiName": "claude-mythos-5-1", "entitled": no}}, nil) + filememo.Forget() + if other.Lists("claude-mythos-5-1") { + t.Error("an account not entitled to Mythos 5.1 lists it") + } + if !other.Lists("claude-sonnet-5") { + t.Error("the other account lost what every account has") + } + if nobody := (&Account{Agent: "claude", User: "unknown@example.com"}); !nobody.Lists("claude-mythos-5-1") { + t.Error("an account no Claude Code has said of is taken to lack it") + } + + // Claude Code's own picker on this computer offers it too + if own := modelIDs(ClaudeCodeModels()); !slices.Contains(own, "claude-mythos-5-1") || slices.Contains(own, "claude-opus-4-5") { + t.Errorf("ClaudeCodeModels = %v", own) + } +} + +// A vendor's own list that has a model models.dev keeps under its lab +// alone gets the lab's window, reply limit, name and thinking: an +// Anthropic API key whose /v1/models has Claude Mythos 5.1. +func TestAnthropicKeyGatedModelDescribed(t *testing.T) { + isolate(t) + h := t.TempDir() + t.Setenv("HOME", h) + t.Setenv("USERPROFILE", h) + t.Setenv("XDG_CONFIG_HOME", filepath.Join(h, ".config")) + t.Setenv("XDG_CACHE_HOME", filepath.Join(h, ".cache")) + t.Setenv("PATH", h) + for _, v := range agentenv.Vars { + t.Setenv(v, "") + } + mythosCatalogs(t) + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/v1/models" { + http.NotFound(w, r) + return + } + w.Write([]byte(`{"data":[{"type":"model","id":"claude-mythos-5-1","created_at":"2026-09-01T00:00:00Z"},` + + `{"type":"model","id":"claude-sonnet-5","display_name":"Claude Sonnet 5"}],"has_more":false}`)) + })) + defer srv.Close() + if err := Save(Provider{ID: "anth", Name: "Anthropic key", Anthropic: srv.URL + "/v1", Key: "sk-ant-test"}); err != nil { + t.Fatal(err) + } + q, err := Find("anth") + if err != nil { + t.Fatal(err) + } + if _, err := q.Fetch(context.Background()); err != nil { + t.Fatal(err) + } + e, ok := EntryOf("anth/claude-mythos-5-1") + if !ok { + t.Fatal("Mythos 5.1 not listed") + } + if e.Context != 1_000_000 || e.Output != 128_000 || e.Default != "Claude Mythos 5.1" && e.Name != "Claude Mythos 5.1" || len(e.Efforts) == 0 { + t.Errorf("entry = id %s name %q default %q context %d output %d efforts %v", e.ID, e.Name, e.Default, e.Context, e.Output, e.Efforts) + } +} diff --git a/internal/provider/codex_models.go b/internal/provider/codex_models.go index 9beb4be16..b965b651e 100644 --- a/internal/provider/codex_models.go +++ b/internal/provider/codex_models.go @@ -242,6 +242,13 @@ func (a *Account) Lists(model string) bool { if a.plugin != nil { return a.pluginLists(model) } + if a.Agent == "claude" { + // what the account's Claude Code was told it has: a gated model + // (Claude Mythos 5.1) goes to the accounts entitled to it + if has, ok := claudeLists(a.User, model); ok { + return has + } + } live, _, ok := catalog.Live(accountModels(a.Agent, a.User)) if !ok { return true diff --git a/internal/provider/models.go b/internal/provider/models.go index 346fd47de..3dac0af9f 100644 --- a/internal/provider/models.go +++ b/internal/provider/models.go @@ -1855,6 +1855,13 @@ func (p Provider) ListPrice(model string) (catalog.Price, bool) { return pr, true } } + if slices.Contains(cats, "anthropic") { + // a gated Claude model models.dev prices nowhere (Claude Mythos + // 5.1): Anthropic's price, as it told Claude Code + if pr, ok := claudeCodePrice(model); ok { + return pr, true + } + } if pr, ok := p.pluginListPrice(model); ok { return pr, true }