gateway: a magpie's /v1/models offers Ultrafast where its accounts do
OoopsHh on X: a magpie in Docker could pick Ultrafast on a model, but another magpie that has it as its Remote magpie provider was offered Fast alone on that model. The remote's list takes its service tiers from provider.CodexTiers through codexcat.Entries, and CodexTiers only ever added "priority". Ultrafast came only from Codex's own catalog, which a magpie with no Codex beside it (Docker) does not have, and the codexcat branches for Fast and OwnTier models dropped any tier m.Tiers added. - CodexTiersWith adds "ultrafast" after Fast where provider.UltraOn says the key or account offers it (an OpenAI key's Ultrafast models, a provider added by its address on OpenAI's Ultrafast models, a Codex account whose live list has it), and on a group where a member does. UltraModels is read at most once a list, and only after a model already shows Fast. - codexcat keeps those tiers (withTiers) and names "ultrafast" "Ultrafast" when Codex's own catalog doesn't. - The asking side already sends ultrafast to a Remote magpie (RemoteTiers), and the remote already asks a member without it for priority (tierMate). Both ends need this version: the remote to list it, the local one to read it. A provider added by its address serving gpt-6.1-sol now lists Ultrafast in /v1/models, /v1/codex/models and magpie-models.json, as its editor's CanUltra already said; TestModelsListTiersForEveryClient, TestRemoteMagpieOffersItsTiers and TestCodexCatalogTiersReachDisk expect it. Tests: - TestRemoteMagpieOffersUltrafast: a relay's gpt-6.2-sol and a group of it list "priority ultrafast"; a Remote magpie provider reading that list has CanUltra on both, and an ultrafast ask through it reaches the vendor as ultrafast. Red on7d5db0f29(tiers "priority" alone, no CanUltra). - TestOpenAIKeyUltrafast: an OpenAI key's /v1/models lists ultrafast on gpt-6-astra and not on gpt-6-sol, and its trace's order says Ultra on the pick (Weighed.Ultra, previous commit). - tui, codexcat, provider and agent, and gateway's 'Tier|Ultra|Remote|Fast|Codex' tests: ok on mote. - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and the three builds: ok on mica. gofmt -l clean. Full suite (both commits; go test -count=1 -timeout 45m ./... on mica, load ~30 on 12 cores): 99 packages ok. Reds, each filed and none in code this touches: - agent TestWSLAgentFolderIsALink (#7150, ~1 in 6 on main); - dirent's five watch tests (#7031, a busy Mac); - gateway TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117, red on origin/main); - gui TestGatewayModeListsNoOwnSessions (#7064); - sessions timed out at 45m in TestWSLAntigravityLinkedHomeOnce under that load (#5451). Run alone with -timeout 90m: ok in 2925s on mica, ok in 62s on mote (origin/main3869aee3b: ok in 54s on mote), so the time is mica's, not this change's. The full suite ran on the base3869aee3b. After a rebase ontoef997d186(no files in common), at this head on mote: go build ./..., the three go vets, tui, codexcat, provider, agent, gui's Budget/Group/Fast/Ultra tests and gateway's Tier/Ultra/Remote/Fast/Codex tests ok; group-member-fast, routing-ultra-row, routing-service-tier, gui-de, gui-ja, gui-zh-tw and i18n-* 50 of 51 (gui-ja's "Gets copies" string, #7144, on main).
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -47,7 +47,10 @@ func TestCodexCatalogTiersReachDisk(t *testing.T) {
|
||||
}
|
||||
tiers[m.Slug] = s
|
||||
}
|
||||
for slug, want := range map[string]string{"sub/gpt-6.1-sol": "priority:Fast ", "sub/glm-4.6": "", "relay/glm-4.6": ""} {
|
||||
// and Ultrafast, which OpenAI serves on GPT-6.1 Sol and a provider
|
||||
// added by its address offers as its editor does (provider.CanUltra;
|
||||
// OoopsHh on X)
|
||||
for slug, want := range map[string]string{"sub/gpt-6.1-sol": "priority:Fast ultrafast:Ultrafast ", "sub/glm-4.6": "", "relay/glm-4.6": ""} {
|
||||
if g, ok := tiers[slug]; !ok {
|
||||
t.Errorf("%s is not in magpie-models.json: %s", slug, raw)
|
||||
} else if g != want {
|
||||
|
||||
@@ -377,6 +377,8 @@ func buildModels(agent string) []catalog.Model {
|
||||
_, ms, _ := find(id)
|
||||
return ms
|
||||
}
|
||||
// the models Codex's accounts offer Ultrafast on, read once a list
|
||||
ultra := sync.OnceValue(provider.UltraModels)
|
||||
for i, e := range shown {
|
||||
efforts := e.Efforts
|
||||
if agent == "codex" {
|
||||
@@ -429,7 +431,7 @@ func buildModels(agent string) []catalog.Model {
|
||||
// the service tiers Codex is offered on it, as the gateway's own
|
||||
// lists offer them: Fast in the Codex CLI magpie writes
|
||||
// magpie-models.json for (#1530)
|
||||
provider.CodexTiers(&m, e, members)
|
||||
provider.CodexTiersWith(&m, e, members, ultra)
|
||||
if agent == "codex" {
|
||||
provider.CodexSeals(&m, e, members)
|
||||
}
|
||||
|
||||
@@ -397,9 +397,9 @@ func entriesAt(ms []catalog.Model, after int, effort string) []any {
|
||||
// or a group one is in, gets the tier Codex's own catalog gives its
|
||||
// GPT models
|
||||
if slug, ok := strings.CutPrefix(m.ID, "codex/"); m.Fast || ok && strings.HasPrefix(slug, "gpt-") {
|
||||
e.Tiers = append(e.Tiers, fastTier)
|
||||
e.Tiers = withTiers(own, append(e.Tiers, fastTier), m.Tiers)
|
||||
} else if m.OwnTier && (len(m.Tiers) == 0 || len(ownTiers(own, m)) > 0) {
|
||||
e.Tiers = ownTiers(own, m)
|
||||
e.Tiers = withTiers(own, ownTiers(own, m), m.Tiers)
|
||||
} else if len(m.Tiers) > 0 {
|
||||
// another magpie's model: the tiers it offers its own Codex
|
||||
// (#1234)
|
||||
@@ -722,13 +722,18 @@ func ownTiers(own map[string]map[string]any, m catalog.Model) []tier {
|
||||
var fastTier = tier{ID: "priority", Name: "Fast", Description: "1.5x speed, increased usage"}
|
||||
|
||||
// namedTiers are the tiers ids name, each as Codex's own catalog writes it
|
||||
// on any of its models, else by its id: Fast's "priority" as Codex names it.
|
||||
// on any of its models, else by its id: Fast's "priority" as Codex names
|
||||
// it, "ultrafast" as Ultrafast.
|
||||
func namedTiers(own map[string]map[string]any, ids []string) []tier {
|
||||
ts := []tier{}
|
||||
for _, id := range ids {
|
||||
t := tier{ID: id, Name: id}
|
||||
if id == fastTier.ID {
|
||||
switch id {
|
||||
case fastTier.ID:
|
||||
t = fastTier
|
||||
case "ultrafast":
|
||||
// as magpie names it, where Codex's own catalog doesn't
|
||||
t.Name = "Ultrafast"
|
||||
}
|
||||
found:
|
||||
for _, slug := range slices.Sorted(maps.Keys(own)) {
|
||||
@@ -748,6 +753,20 @@ func namedTiers(own map[string]map[string]any, ids []string) []tier {
|
||||
return ts
|
||||
}
|
||||
|
||||
// withTiers is ts with each tier of ids it lacks after them, named as
|
||||
// namedTiers names it: Ultrafast where the provider's account or key
|
||||
// offers it (provider.CodexTiers), beside the Fast these entries take from
|
||||
// Codex's own catalog, which a magpie with no Codex beside it (Docker)
|
||||
// hasn't got (OoopsHh on X).
|
||||
func withTiers(own map[string]map[string]any, ts []tier, ids []string) []tier {
|
||||
for _, id := range ids {
|
||||
if !slices.ContainsFunc(ts, func(t tier) bool { return t.ID == id }) {
|
||||
ts = append(ts, namedTiers(own, []string{id})...)
|
||||
}
|
||||
}
|
||||
return ts
|
||||
}
|
||||
|
||||
// ServiceTiers are the service tiers Entries offers Codex on each of ms,
|
||||
// by id, where it offers any: what this magpie's list tells another magpie
|
||||
// that has it as its provider, so that one's Codex is offered them too
|
||||
|
||||
@@ -40,7 +40,9 @@ func TestModelsListTiersForEveryClient(t *testing.T) {
|
||||
}
|
||||
got[m.ID] = s
|
||||
}
|
||||
for id, want := range map[string]string{"relay/gpt-6.1-sol": "priority ", "relay/glm-5": ""} {
|
||||
// Ultrafast too: OpenAI serves it on GPT-6.1 Sol, and a provider added
|
||||
// by its address offers it as its editor does (OoopsHh on X)
|
||||
for id, want := range map[string]string{"relay/gpt-6.1-sol": "priority ultrafast ", "relay/glm-5": ""} {
|
||||
if s, ok := got[id]; !ok || s != want {
|
||||
t.Errorf("%s tiers %q (listed %v), want %q", id, s, ok, want)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
@@ -32,6 +34,32 @@ func TestOpenAIKeyUltrafast(t *testing.T) {
|
||||
if err := provider.SetFastTier("codex", "ok/gpt-6-astra", "ultrafast"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// and its list says so, to another magpie that has this one as its
|
||||
// provider: in Docker it said Fast alone (OoopsHh on X)
|
||||
rec := httptest.NewRecorder()
|
||||
s.Handler().ServeHTTP(rec, httptest.NewRequest("GET", "/v1/models", nil))
|
||||
var list struct {
|
||||
Data []struct {
|
||||
ID string `json:"id"`
|
||||
Tiers []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"service_tiers"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &list); err != nil {
|
||||
t.Fatalf("%v: %s", err, rec.Body)
|
||||
}
|
||||
listed := map[string]string{}
|
||||
for _, m := range list.Data {
|
||||
for _, x := range m.Tiers {
|
||||
listed[m.ID] += x.ID + " "
|
||||
}
|
||||
}
|
||||
for id, want := range map[string]string{"ok/gpt-6-astra": "priority ultrafast ", "ok/gpt-6-sol": "priority "} {
|
||||
if listed[id] != want {
|
||||
t.Errorf("%s listed with tiers %q, want %q", id, listed[id], want)
|
||||
}
|
||||
}
|
||||
for _, a := range []struct{ name, path, body string }{
|
||||
{"responses", "/v1/responses", `{"model":"ok/gpt-6-astra","input":"hi"}`},
|
||||
{"anthropic", "/v1/messages", `{"model":"ok/gpt-6-astra","max_tokens":1024,"messages":[{"role":"user","content":"hi"}]}`},
|
||||
@@ -41,8 +69,8 @@ func TestOpenAIKeyUltrafast(t *testing.T) {
|
||||
if host != "api.openai.com" || path != "/v1/responses" || body["service_tier"] != "ultrafast" || body["model"] != "gpt-6-astra" {
|
||||
t.Errorf("%s: sent to %s%s %v", a.name, host, path, body)
|
||||
}
|
||||
if len(r.Tries) != 1 || !r.Tries[0].Fast {
|
||||
t.Errorf("%s: traced %+v", a.name, r.Tries)
|
||||
if len(r.Tries) != 1 || !r.Tries[0].Fast || len(r.Order) == 0 || !r.Order[0].Ultra {
|
||||
t.Errorf("%s: traced %+v, order %+v", a.name, r.Tries, r.Order)
|
||||
}
|
||||
// another agent's request goes at the usual speed
|
||||
postFrom(t, s, "opencode", a.path, a.body)
|
||||
|
||||
@@ -101,8 +101,10 @@ func TestRemoteMagpieOffersItsTiers(t *testing.T) {
|
||||
}
|
||||
offered[m.Slug] = s
|
||||
}
|
||||
// Ultrafast too: OpenAI serves it on GPT-6.1 Sol, and a provider added
|
||||
// by its address offers it as its editor does (OoopsHh on X)
|
||||
for slug, want := range map[string]string{
|
||||
"relay/gpt-6.1-sol": "priority:Fast ", "office/relay/gpt-6.1-sol": "priority:Fast ",
|
||||
"relay/gpt-6.1-sol": "priority:Fast ultrafast:Ultrafast ", "office/relay/gpt-6.1-sol": "priority:Fast ultrafast:Ultrafast ",
|
||||
"relay/glm-5": "", "office/relay/glm-5": "",
|
||||
} {
|
||||
if got, ok := offered[slug]; !ok || got != want {
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/yetone/magpie/internal/provider"
|
||||
)
|
||||
|
||||
// Another magpie's model it serves Ultrafast is offered Ultrafast here,
|
||||
// and a turn asked Ultrafast goes on to it so and from it to its vendor so
|
||||
// (OoopsHh on X: a magpie in Docker set a group's member Ultrafast, and the
|
||||
// magpie that has it as its provider was offered Fast alone). The remote
|
||||
// has no Codex beside it, so only its own providers can say a model has
|
||||
// Ultrafast: here a relay's gpt-6.2-sol, and a group it is sent Ultrafast
|
||||
// in. Here the gateway is both computers', as in
|
||||
// TestRemoteMagpieOffersItsTiers.
|
||||
func TestRemoteMagpieOffersUltrafast(t *testing.T) {
|
||||
var mu sync.Mutex
|
||||
var vendor, hops []string // service_tier as the vendor, and the remote magpie, were sent it
|
||||
tierOf := func(b []byte) string {
|
||||
var v struct {
|
||||
Tier *string `json:"service_tier"`
|
||||
}
|
||||
json.Unmarshal(b, &v)
|
||||
if v.Tier == nil {
|
||||
return "(none)"
|
||||
}
|
||||
return *v.Tier
|
||||
}
|
||||
up := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
mu.Lock()
|
||||
vendor = append(vendor, tierOf(b))
|
||||
mu.Unlock()
|
||||
w.Header().Set("Content-Type", "text/event-stream")
|
||||
io.WriteString(w, sse(
|
||||
`data: {"type":"response.created","response":{"id":"resp_1","model":"gpt-6.2-sol"}}`,
|
||||
`data: {"type":"response.output_item.added","output_index":0,"item":{"type":"message","id":"m1","role":"assistant","content":[]}}`,
|
||||
`data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":"hello"}`,
|
||||
`data: {"type":"response.output_item.done","output_index":0,"item":{"type":"message","id":"m1","role":"assistant","content":[{"type":"output_text","text":"hello"}]}}`,
|
||||
`data: {"type":"response.completed","response":{"id":"resp_1","model":"gpt-6.2-sol","usage":{"input_tokens":5,"output_tokens":2}}}`))
|
||||
}))
|
||||
t.Cleanup(up.Close)
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
t.Setenv("CODEX_HOME", t.TempDir()) // no Codex beside it, as in Docker
|
||||
if err := provider.Save(provider.Provider{ID: "relay", Name: "Relay", Key: "k", Models: []string{"gpt-6.2-sol", "glm-5"}, Responses: up.URL + "/v1"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := provider.SaveGroup(provider.Group{ID: "sol", Name: "Sol", Members: []string{"relay/gpt-6.2-sol"},
|
||||
Fast: []string{"relay/gpt-6.2-sol"}, Ultra: []string{"relay/gpt-6.2-sol"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
h := New().Handler()
|
||||
remote := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == http.MethodPost {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
r.Body = io.NopCloser(strings.NewReader(string(b)))
|
||||
mu.Lock()
|
||||
hops = append(hops, tierOf(b))
|
||||
mu.Unlock()
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
}))
|
||||
t.Cleanup(remote.Close)
|
||||
|
||||
// the remote's list, as another magpie reads it
|
||||
rec := httptest.NewRecorder()
|
||||
h.ServeHTTP(rec, httptest.NewRequest("GET", "/v1/models", nil))
|
||||
var list struct {
|
||||
Data []struct {
|
||||
ID string `json:"id"`
|
||||
Tiers []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"service_tiers"`
|
||||
} `json:"data"`
|
||||
}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &list); err != nil {
|
||||
t.Fatalf("%v: %s", err, rec.Body)
|
||||
}
|
||||
listed := map[string]string{}
|
||||
for _, m := range list.Data {
|
||||
s := ""
|
||||
for _, x := range m.Tiers {
|
||||
s += x.ID + " "
|
||||
}
|
||||
listed[m.ID] = s
|
||||
}
|
||||
for id, want := range map[string]string{"relay/gpt-6.2-sol": "priority ultrafast ", "group/sol": "priority ultrafast ", "relay/glm-5": ""} {
|
||||
if s, ok := listed[id]; !ok || s != want {
|
||||
t.Errorf("%s listed with tiers %q (listed %v), want %q", id, s, ok, want)
|
||||
}
|
||||
}
|
||||
|
||||
id, err := provider.Add(provider.Provider{ID: "office", Name: "Office", Preset: provider.RemoteMagpiePreset, Chat: strings.TrimPrefix(remote.URL, "http://")})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
office, err := provider.Find(id)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := office.Fetch(context.Background()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// what the GUI's Ultrafast button, and an agent's pick, go by here
|
||||
for _, m := range []string{"relay/gpt-6.2-sol", "group/sol"} {
|
||||
if !provider.CanUltra(*office, m) {
|
||||
t.Errorf("%s: no Ultrafast on the remote's model (tiers %v)", m, provider.RemoteTiers(*office, m))
|
||||
}
|
||||
}
|
||||
if provider.CanUltra(*office, "relay/glm-5") {
|
||||
t.Error("relay/glm-5: Ultrafast where the remote offers no tier")
|
||||
}
|
||||
|
||||
// a turn asked Ultrafast, as Codex sends it, to each
|
||||
for _, m := range []string{"office/relay/gpt-6.2-sol", "office/group/sol"} {
|
||||
ask := strings.Replace(codexFastAsk("ultrafast"), `"model":"m1"`, `"model":"`+m+`"`, 1)
|
||||
if code, body := post(t, "/v1/responses", ask); code != 200 {
|
||||
t.Fatalf("%s: %d: %s", m, code, body)
|
||||
}
|
||||
}
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
if want := []string{"ultrafast", "ultrafast"}; !slices.Equal(hops, want) || !slices.Equal(vendor, want) {
|
||||
t.Errorf("tier sent to the remote magpie %v, by it to its vendor %v; want %v for both", hops, vendor, want)
|
||||
}
|
||||
}
|
||||
@@ -1027,13 +1027,15 @@ func codexListedIf(shown []Entry, members func(id string) []Member, listed func(
|
||||
s := settings.Load().ForAgent("codex")
|
||||
find := func(id string) (Group, []Member, bool) { return Group{}, members(id), true }
|
||||
apart := codexApart(shown, labels, listed)
|
||||
// read once a list, and only where a model may need it (UltraOn)
|
||||
ultra := sync.OnceValue(UltraModels)
|
||||
for i, e := range shown {
|
||||
if !listed(e) {
|
||||
continue
|
||||
}
|
||||
m := catalog.Model{ID: e.ID, Name: labels[i], Efforts: CodexEfforts(e), Images: e.Images || seen, Context: e.Context, AgentsV2: e.AgentsV2, Codex: e.Codex, Apart: apart[i]}
|
||||
m.Compact = CompactFor(s, e, find)
|
||||
CodexTiers(&m, e, members)
|
||||
CodexTiersWith(&m, e, members, ultra)
|
||||
CodexSeals(&m, e, members)
|
||||
ms = append(ms, m)
|
||||
}
|
||||
@@ -1117,8 +1119,16 @@ func codexApart(shown []Entry, labels []string, listed func(Entry) bool) []strin
|
||||
// CodexTiers sets on m what Codex is offered on e's service tiers
|
||||
// (codexcat.Entries turns them into the entry's service_tiers): one source
|
||||
// for every list Codex is handed, the gateway's and the models.json file
|
||||
// magpie writes for a Codex CLI that names magpie its provider (#1530).
|
||||
// magpie writes for a Codex CLI that names magpie its provider (#1530), and
|
||||
// the /v1/models another magpie that has this one as its provider reads
|
||||
// them from (RemoteTiers, #1234).
|
||||
func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
CodexTiersWith(m, e, members, sync.OnceValue(UltraModels))
|
||||
}
|
||||
|
||||
// CodexTiersWith is CodexTiers with UltraModels read through ultra, once
|
||||
// for a whole list.
|
||||
func CodexTiersWith(m *catalog.Model, e Entry, members func(id string) []Member, ultra func() map[string]bool) {
|
||||
// a provider the user added by its address is sent the tier Codex
|
||||
// asks for as it is (hsiangron on X)
|
||||
m.OwnTier = e.Group == "" && e.Provider.Preset == "" && e.Provider.Account == nil && e.Provider.ID != ""
|
||||
@@ -1130,13 +1140,13 @@ func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
m.Tiers = e.Tiers
|
||||
}
|
||||
if e.Group != "" {
|
||||
fast := false
|
||||
fast, ultrafast := false, false
|
||||
for _, mb := range members(e.ID) {
|
||||
if a := mb.Provider.Account; a != nil && a.Agent == "codex" && strings.HasPrefix(mb.Model, "gpt-") {
|
||||
m.Fast = true
|
||||
break
|
||||
}
|
||||
fast = fast || CanFast(mb.Provider, mb.Model)
|
||||
ultrafast = ultrafast || UltraOn(mb.Provider, mb.Model, ultra())
|
||||
}
|
||||
// a group with another member that has a fast mode (an OpenAI or
|
||||
// Anthropic key's, a relay's GPT, Cursor's, a plugin's) is offered
|
||||
@@ -1147,6 +1157,13 @@ func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
if !m.Fast && fast {
|
||||
m.Tiers = []string{codexFastTier}
|
||||
}
|
||||
// and Ultrafast where a member offers it, which the gateway asks of
|
||||
// that member, asking one that has none for priority in its place
|
||||
// (tierMate): a magpie that has this one as its provider was
|
||||
// offered Fast alone on such a group (OoopsHh on X)
|
||||
if ultrafast {
|
||||
m.Tiers = []string{codexFastTier, codexUltraTier}
|
||||
}
|
||||
return
|
||||
}
|
||||
// so is a model of its own that has one, which no tier above names
|
||||
@@ -1154,6 +1171,14 @@ func CodexTiers(m *catalog.Model, e Entry, members func(id string) []Member) {
|
||||
if len(m.Tiers) == 0 && CanFast(*e.Provider, e.Model) {
|
||||
m.Tiers = []string{codexFastTier}
|
||||
}
|
||||
// and Ultrafast where its key or account offers it (UltraOn: an OpenAI
|
||||
// key's gpt-6.2-sol, a ChatGPT account whose plan has it), which only
|
||||
// Codex's own list said: a magpie in Docker, with no Codex there,
|
||||
// offered Fast alone to the magpie that has it as its provider
|
||||
// (OoopsHh on X)
|
||||
if slices.Contains(m.Tiers, codexFastTier) && !slices.Contains(m.Tiers, codexUltraTier) && UltraOn(*e.Provider, e.Model, ultra()) {
|
||||
m.Tiers = append(slices.Clip(m.Tiers), codexUltraTier)
|
||||
}
|
||||
}
|
||||
|
||||
// CodexSeals sets m.Seals: e's provider, or a member of its group, is one
|
||||
@@ -1184,6 +1209,9 @@ func maySeal(p Provider) bool {
|
||||
// codexFastTier is Fast's service tier as Codex sends it.
|
||||
const codexFastTier = "priority"
|
||||
|
||||
// codexUltraTier is Codex's Ultra Fast, the tier faster than priority.
|
||||
const codexUltraTier = "ultrafast"
|
||||
|
||||
// CodexListRevoked says err, from CodexLiveList, is the backend calling
|
||||
// Codex's sign-in revoked (SignInRevoked), not a refusal a refresh mends,
|
||||
// a 5xx or a network error.
|
||||
|
||||
Reference in New Issue
Block a user