Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ from the section of its version (`scripts/releases/notes.ts`); a release
without one fails. At tag time, rename `[Unreleased]` to the version and date,
like `## [0.4.16] - 2026-10-24`.

## [Unreleased]

### Fixed

- Claude models a plan can't run (for example Fable or Mythos on a plan without them) no longer show as available on that account. The hub learns it from the plan's refusal or CLIProxyAPI's "not supported" cooldown on that account, lists that account's row under Not available ("Not on the neu plan"), and routes the model to an account that can run it. It asks again after a day, or as soon as the account is signed in again.

## [0.4.99] - 2026-11-13

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ class PickerTabsTest {
assertTrue(PickerTabs.items(entries, "", Tab.ALL).none { it is Item.Fold })
}

@Test
fun oneClaudePlanWithoutAModelHasItsRowInTheFoldTheOtherPlanKeepsIt() {
// as the hub merges it (providers/merge.ts): neu's row is its own and unavailable, personal's a route of the model
val bare = ModelInfo(id = "claude-mythos-5-1", ref = "cliproxy/claude-mythos-5-1", provider = "cliproxy", name = "Claude Mythos 5.1", via = "your Claude plan", choices = listOf("cliproxy/personal/claude-mythos-5-1"))
val personal = ModelInfo(id = "personal/claude-mythos-5-1", ref = "cliproxy/personal/claude-mythos-5-1", provider = "cliproxy", name = "Claude Mythos 5.1", sameAs = "cliproxy/claude-mythos-5-1")
val neu = ModelInfo(id = "neu/claude-mythos-5-1", ref = "cliproxy/neu/claude-mythos-5-1", provider = "cliproxy", name = "Claude Mythos 5.1", unavailable = "Not on the neu plan")
val list = PickerTabs.entries(ModelPicks.groups(listOf(g("cliproxy", bare, personal, neu, m("cliproxy", "claude-opus-5-5", "Claude Opus 5.5")))))
val open = PickerTabs.items(list, "", Tab.ANTHROPIC, unavailable = true)
val row = open.filterIsInstance<Item.Model>().last()
assertEquals("cliproxy/neu/claude-mythos-5-1", row.entry.row.ref)
assertEquals("Not on the neu plan", row.entry.row.model.unavailable)
assertEquals(Item.Fold(PickerTabs.NOT_AVAILABLE, 1, open = true), open[open.size - 2])
// the model itself is still offered, through personal
val shut = PickerTabs.items(list, "", Tab.ANTHROPIC)
val mythos = shut.filterIsInstance<Item.Model>().first { it.entry.row.ref == "cliproxy/claude-mythos-5-1" }
assertEquals(null, mythos.entry.row.model.unavailable)
assertEquals(listOf("cliproxy/claude-mythos-5-1", "cliproxy/personal/claude-mythos-5-1"), mythos.entry.row.routes.map { it.ref })
}

@Test
fun eachModelInItsTabLocalByServerAndCodingAgentsApart() {
val tabOf = entries.associate { it.row.ref to it.tab }
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export async function modelsCommand(args: ParsedArgs): Promise<number> {
' ' + p.fg(modelColor(m.ref))('●') + ' ' + (m.name || m.ref),
p.dim(m.ref),
p.dim(m.contextWindow ? formatTokens(m.contextWindow) + ' ctx' : ''),
p.dim(m.via ?? (m.inputPrice || m.outputPrice ? `$${m.inputPrice}/$${m.outputPrice} per M` : '')),
m.unavailable ? p.yellow(m.unavailable) : p.dim(m.via ?? (m.inputPrice || m.outputPrice ? `$${m.inputPrice}/$${m.outputPrice} per M` : '')),
p.dim([m.vision ? 'vision' : '', m.thinking ? 'thinking' : '', m.tier ?? ''].filter(Boolean).join(' ')),
]);
print(table(rows));
Expand Down
21 changes: 14 additions & 7 deletions packages/core/src/accounts/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ export interface CliproxyCredentialFacts {
/** Merged from the last response's signals and the usage endpoint. */
windows: LimitWindow[];
cooldowns: Array<{ model?: string; reason: string; until: number }>;
/** Undefined until read. */
/** Undefined until read. Without the models in notOn. */
models?: Array<{ id: string; name?: string }>;
/** Models CLIProxyAPI still gives this plan that it cannot run (its plan refused them): a bare id must not reach it. */
notOn?: string[];
/** A ChatGPT plan approved for Daybreak: the programs whose alias its own model list has. */
daybreak?: CyberProgram[];
observedAt?: number;
Expand Down Expand Up @@ -113,7 +115,7 @@ export class AccountsService {
private spent = new Map<string, number>();
private sticky = new Map<string, { account: string; at: number }>();
private hitListeners = new Set<(vendor: string) => void>();
private refusalListeners = new Set<(provider: string, model: string, reason: string) => void>();
private refusalListeners = new Set<(provider: string, model: string, reason: string, account?: string) => void>();
private changeListeners = new Set<() => void>();
private lastEvent = '';
private lastLimits = new Map<string, string>();
Expand Down Expand Up @@ -591,7 +593,12 @@ export class AccountsService {
// the owner's order puts a key here: the key's turn comes first
if (a.cfg.kind !== 'subscription' || a.provider !== gw) return undefined;
const label = this.label(a, all);
if (bareReaches(a)) return { wire: model, account: a.cfg.id, label, covers: this.forVendor(vendor, model).filter(bareReaches).map((x) => x.cfg.id) };
if (bareReaches(a)) {
// a plan that cannot run it still has it in CLIProxyAPI's shared list: name this plan, so the bare id is not sent there
const stray = all.some((x) => x.cfg.id !== a.cfg.id && x.provider === gw && x.facts?.notOn?.includes(bareModel(model)));
if (stray && a.facts?.prefix) return { wire: `${a.facts.prefix}/${bareModel(model)}`, account: a.cfg.id, label, covers: [a.cfg.id] };
return { wire: model, account: a.cfg.id, label, covers: this.forVendor(vendor, model).filter(bareReaches).map((x) => x.cfg.id) };
}
const own = a.facts?.prefix && a.facts.models ? ownModel(a.facts.models.map((m) => m.id), model) : undefined;
if (own) return { wire: `${a.facts!.prefix}/${bareModel(own)}`, account: a.cfg.id, label, covers: [a.cfg.id] };
}
Expand Down Expand Up @@ -779,14 +786,14 @@ export class AccountsService {
}

/** A plan refused one model (providers/errors.ts modelRefusal): the cliproxy manager marks it unavailable. Returns the unsubscribe. */
onModelRefused(fn: (provider: string, model: string, reason: string) => void): () => void {
onModelRefused(fn: (provider: string, model: string, reason: string, account?: string) => void): () => void {
this.refusalListeners.add(fn);
return () => this.refusalListeners.delete(fn);
}

/** Tell the listeners a plan refused this model (the id as called, prefixed for one plan). */
noteRefusal(provider: string, model: string, reason: string): void {
for (const fn of this.refusalListeners) fn(provider, model, reason);
/** Tell the listeners a plan refused this model (the id as called, prefixed for one plan). `account`: the plan the call went to, when it is known. */
noteRefusal(provider: string, model: string, reason: string, account?: string): void {
for (const fn of this.refusalListeners) fn(provider, model, reason, account);
}

/** The list or the order changed (the cliproxy manager writes priorities). */
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/providers/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ export function mergeModelGroups(groups: ModelGroup[], routeOf: (model: string)
// a ref that names a route of its own: one plan's prefix, or a provider outside the order (a ref on a provider in it
// still follows the order, registry routed()). Only usable ones: a choice that cannot answer is no choice
const inOrder = new Set((all ?? []).map((s) => s.provider));
const choices = others.filter((s) => usable.has(s.provider) && (s.m.id.includes('/') || !inOrder.has(s.provider))).map((s) => s.m.ref);
const choices = others.filter((s) => usable.has(s.provider) && !s.m.unavailable && (s.m.id.includes('/') || !inOrder.has(s.provider))).map((s) => s.m.ref);
const mark: Partial<ModelEntry> = {
...(steps.length && vendor ? { via: routeWords(steps, vendor, opts) } : {}),
...(others.length ? { refs: [keep.m.ref, ...others.map((s) => s.m.ref)] } : {}),
...(choices.length ? { choices } : {}),
...(listedVendor ? { vendor: listedVendor } : {}),
};
if (Object.keys(mark).length) marks.set(keep.m.ref, mark);
for (const s of others) marks.set(s.m.ref, { sameAs: keep.m.ref, ...(listedVendor ? { vendor: listedVendor } : {}) });
// one plan's row it cannot run stays a row of its own, so the pickers list it under Not available with the reason
for (const s of others) marks.set(s.m.ref, { ...(s.m.unavailable && s.m.id.includes('/') ? {} : { sameAs: keep.m.ref }), ...(listedVendor ? { vendor: listedVendor } : {}) });
}
if (!marks.size) return groups;
return groups.map((g) => (g.models.some((m) => marks.has(m.ref)) ? { ...g, models: g.models.map((m) => (marks.has(m.ref) ? { ...m, ...marks.get(m.ref) } : m)) } : g));
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/session/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ async function streamCall(
}
// a plan that refuses this one model: its picker row greys out with the reason, so the next turn is not sent to it again
const refused = paidBy === 'hub' && accounts ? modelRefusal(e) : undefined;
if (refused) accounts!.noteRefusal(resolved.provider, resolved.model, refused);
// the plan it went to, when the call named one (a pin, a prefixed id); a bare id's plan CLIProxyAPI's cooldown names
if (refused) accounts!.noteRefusal(resolved.provider, resolved.model, refused, (target.pin?.provider === resolved.provider ? target.pin.account : undefined) ?? (splitAccount(resolved.model).account ? accounts!.accountFor(resolved.provider, resolved.model) : undefined));
// a plan signed out, or a key refused: the next route in the owner's order takes the call (providers/merge.ts)
if (e.kind === 'auth' && paidBy === 'hub' && accounts && !begun && fallback(resolved.provider, `${engine.providerLabel(resolved.provider)} refused the sign in.`)) {
fullRef = `${resolved.provider}/${resolved.model}`;
Expand Down
Loading
Loading