diff --git a/internal/provider/models.go b/internal/provider/models.go index ce89a29a6..9af0587cf 100644 --- a/internal/provider/models.go +++ b/internal/provider/models.go @@ -2397,6 +2397,9 @@ func (p Provider) listPriceIn(c priceCats, model string) (catalog.Price, bool, i if pr, ok := p.grokFastPrice(model); ok { return pr, true, pricedOwn } + if pr, ok := p.openDesignSamePrice(model); ok { + return pr, true, pricedOwn + } // the names on the stack: made for each model priced, they were // 1.5 MB of forty Providers asks var buf [4]string @@ -2614,6 +2617,31 @@ func (p Provider) grokFastPrice(model string) (catalog.Price, bool) { return pr.Times(GrokFastTimes), true } +// openDesignSame are the Open Design plugin's ids of a model it serves +// under another of its ids too, on another schedule: deepseek-v4.1-flash-eco +// is DeepSeek V4.1 Flash on the low-priority, high-quota schedule, the same +// weights ("Yes, same weights as DeepSeek V4.1 Flash", Open Design on X, +// read 2026-11-13; the plugin's models.mjs seeds it as the same model). No +// catalog lists the -eco id, so its calls had no estimated cost (#6352, +// Winnie7572 on X). +var openDesignSame = map[string]string{"deepseek-v4.1-flash-eco": "deepseek-v4.1-flash"} + +// openDesignSamePrice is an Open Design model's price as the model it is +// the same as (openDesignSame), on the Open Design plugin only: elsewhere +// an -eco id is another vendor's to price. +func (p Provider) openDesignSamePrice(model string) (catalog.Price, bool) { + if p.PluginProvider() != "opendesign" { + return catalog.Price{}, false + } + m := strings.ToLower(strings.TrimSpace(model)) + m = strings.TrimPrefix(m, "opendesign/") + base, ok := openDesignSame[m] + if !ok { + return catalog.Price{}, false + } + return p.ListPrice(base) +} + // GrokFastTimes is how many times its model's price xAI sells a Grok // model's fast variant at (grokFastPrice). const GrokFastTimes = 2 diff --git a/internal/provider/relay_snapshot_price_test.go b/internal/provider/relay_snapshot_price_test.go index 0fcfddfdc..dd2a56880 100644 --- a/internal/provider/relay_snapshot_price_test.go +++ b/internal/provider/relay_snapshot_price_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/yetone/magpie/internal/catalog" + "github.com/yetone/magpie/internal/plugin" ) // A relay that serves DeepSeek's V4.1 Flash under the id the maker's @@ -46,3 +47,42 @@ func TestRelayDeepSeekSnapshotCanonicalPriced(t *testing.T) { } } } + +// Open Design's deepseek-v4.1-flash-eco is DeepSeek V4.1 Flash on its eco +// schedule, the same weights, so its estimated cost is V4.1 Flash's (#6352, +// Winnie7572 on X). Only on the Open Design plugin: the id elsewhere, or +// any other -eco id, stays unpriced. +func TestOpenDesignEcoPricedAsFlash(t *testing.T) { + claudeHome(t) + b, err := os.ReadFile("testdata/models_dev_opendesign.json") + if err != nil { + t.Fatal(err) + } + os.MkdirAll(filepath.Dir(catalog.CachePath()), 0o755) + os.WriteFile(catalog.CachePath(), b, 0o644) + catalog.Reset() + t.Cleanup(catalog.Reset) + od := Provider{ID: "opendesign", Name: "Open Design", Account: &Account{plugin: &plugin.Provider{ID: "opendesign"}}} + flash, ok := od.ListPrice("deepseek-v4.1-flash") + if !ok || flash.Input != 0.15 || flash.Output != 0.6 || flash.CacheRead != 0.003 { + t.Fatalf("opendesign deepseek-v4.1-flash: %+v %v", flash, ok) + } + for _, m := range []string{"deepseek-v4.1-flash-eco", "DeepSeek-V4.1-Flash-Eco", "opendesign/deepseek-v4.1-flash-eco"} { + if pr, ok := od.ListPrice(m); !ok || pr.Input != flash.Input || pr.Output != flash.Output || pr.CacheRead != flash.CacheRead { + t.Errorf("opendesign %s: %+v %v; want V4.1 Flash's %+v", m, pr, ok, flash) + } + } + if pr, ok := od.ListPrice("deepseek-v4-pro-eco"); ok { + t.Errorf("opendesign deepseek-v4-pro-eco priced %+v", pr) + } + // no other vendor's id changes + for _, p := range []Provider{ + {ID: "relay", Chat: "https://relay.example/v1"}, + {ID: "opendesign"}, + {ID: "other", Account: &Account{plugin: &plugin.Provider{ID: "other"}}}, + } { + if pr, ok := p.ListPrice("deepseek-v4.1-flash-eco"); ok { + t.Errorf("%s deepseek-v4.1-flash-eco priced %+v", p.ID, pr) + } + } +}