Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
fix(catalog): show qpay@ for Qwen rows in the recommended-models list
Jack Rudenkodf70aea2b156
diff --git a/docs/serve-gateway.md b/docs/serve-gateway.mdindex 21c08918..67a71d52 100644--- a/docs/serve-gateway.md+++ b/docs/serve-gateway.md@@ -156,7 +156,8 @@ GET https://us-central1-claudish-6da10.cloudfunctions.net/queryModels?limit=200&**Method:** collect every distinct `provider` value the live catalog serves,then check each against claudish's routable slug set (`BUILTIN_PROVIDERS` names-+ shortcuts + the `FIREBASE_SLUG_TO_PROVIDER_NAME` bridge).++ shortcuts + the vendor → native provider bridge: at the time a hand-written+table, `FIREBASE_SLUG_TO_PROVIDER_NAME`, since derived by `nativeProviderForVendor`).**Headline results:**@@ -167,7 +168,7 @@ then check each against claudish's routable slug set (`BUILTIN_PROVIDERS` names- **Providers claudish routes directly all align** by identity:`openai`, `google`, `deepseek`, `minimax`, `qwen`, `x-ai`, `z-ai`.- **One real divergence among direct providers:** catalog **`moonshotai`** ↔- claudish **`kimi`**. `FIREBASE_SLUG_TO_PROVIDER_NAME` (`model-loader.ts`)+ claudish **`kimi`**. `nativeProviderForVendor` (`providers/route-candidates.ts`)bridges `moonshotai → kimi` *for the recommended-catalog renderer*, but the**serve slot path does not apply that map** — it builds`${slot.provider}@${slot.model}` verbatim. So `provider: "moonshotai"` pinneddiff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.tsindex 39a73063..560365e5 100644--- a/packages/cli/src/cli.ts+++ b/packages/cli/src/cli.ts@@ -13,7 +13,6 @@ import { EFFORT_LEVELS, isEffortLevel } from "./adapters/base-api-format.js";import { ENV } from "./config.js";import { setStderrQuiet } from "./logger.js";import {- FIREBASE_SLUG_TO_PROVIDER_NAME,type ModelDoc,type RecommendedModelGroup,collectRoutingPrefixes,@@ -62,6 +61,7 @@ import { type ProbeResult, describeProbeState } from "./providers/probe-live.js"import { pinProbeModelSpec, probeProviderRoute } from "./providers/probe-runner.js";import { BUILTIN_PROVIDERS, getProviderByName } from "./providers/provider-definitions.js";import { resolveProviderSlug } from "./providers/provider-slug-resolve.js";+import { nativeProviderForVendor } from "./providers/route-candidates.js";import {buildCatalogChain,buildRoutingChain,@@ -1202,10 +1202,10 @@ async function printRecommendedModels(jsonOutput: boolean, forceUpdate: boolean)const lastUpdated = doc.lastUpdated || "unknown";const { flagship, fast } = groupRecommendedModels(doc.models);- // Build a native-prefix lookup: Firebase slug → shortcuts[0] from provider defs.+ // Build a native-prefix lookup: vendor slug → its native API provider → shortcuts[0].const providerByName = new Map(BUILTIN_PROVIDERS.map((p) => [p.name, p] as const));const getNativePrefix = (firebaseSlug: string): string | null => {- const canonical = FIREBASE_SLUG_TO_PROVIDER_NAME[firebaseSlug];+ const canonical = nativeProviderForVendor(firebaseSlug);if (!canonical) return null;const def = providerByName.get(canonical);if (!def || !def.shortcuts || def.shortcuts.length === 0) return null;diff --git a/packages/cli/src/mcp-server.ts b/packages/cli/src/mcp-server.tsindex adb6b591..84676c09 100644--- a/packages/cli/src/mcp-server.ts+++ b/packages/cli/src/mcp-server.ts@@ -32,7 +32,6 @@ import {startHeartbeat,} from "./mcp/progress-heartbeat.js";import {- FIREBASE_SLUG_TO_PROVIDER_NAME,type RecommendedModelGroup,type RecommendedModelsDoc,collectRoutingPrefixes,@@ -50,6 +49,7 @@ import { nativeRouteFor } from "./providers/native-route.js";import { renderOpFailureBlock } from "./providers/onepassword.js";import { isReadyState, probeLink } from "./providers/probe-live.js";import { BUILTIN_PROVIDERS } from "./providers/provider-definitions.js";+import { nativeProviderForVendor } from "./providers/route-candidates.js";import { route } from "./providers/routing-rules.js";import { createProxyServer } from "./proxy-server.js";import { sanitizeForReport } from "./redact.js";@@ -736,10 +736,10 @@ function defineTools(const { flagship, fast } = groupRecommendedModels(doc.models);- // Native-prefix lookup: Firebase slug → shortcuts[0] from provider defs.+ // Native-prefix lookup: vendor slug → its native API provider → shortcuts[0].const providerByName = new Map(BUILTIN_PROVIDERS.map((p) => [p.name, p] as const));const getNativePrefix = (firebaseSlug: string): string | null => {- const canonical = FIREBASE_SLUG_TO_PROVIDER_NAME[firebaseSlug];+ const canonical = nativeProviderForVendor(firebaseSlug);if (!canonical) return null;const def = providerByName.get(canonical);if (!def || !def.shortcuts || def.shortcuts.length === 0) return null;diff --git a/packages/cli/src/model-loader.ts b/packages/cli/src/model-loader.tsindex d6991533..1e596541 100644--- a/packages/cli/src/model-loader.ts+++ b/packages/cli/src/model-loader.ts@@ -405,30 +405,6 @@ function recommendationProjection(// ─── Recommended models grouping + formatting helpers ───────────────────────-/**- * Map from Firebase provider slug (as it appears in `RecommendedModelEntry.provider`- * after the recommender capitalizes it, e.g. "Openai", "X-ai", "Moonshotai") to- * the canonical `name` used in `providers/provider-definitions.ts`. This lets- * both the CLI and MCP renderers look up the native routing prefix from the- * provider shortcuts.- *- * The lookup key is the lower-cased provider field from the Firebase entry,- * which matches the slug the recommender started from (see- * `firebase/functions/src/recommender.ts` PROVIDERS table).- */-export const FIREBASE_SLUG_TO_PROVIDER_NAME: Record<string, string> = {- openai: "openai",- google: "google",- "x-ai": "x-ai",- "z-ai": "z-ai",- moonshotai: "kimi",- minimax: "minimax",- qwen: "qwen",- deepseek: "deepseek",- mistralai: "mistralai",- sakana: "sakana",-};-/*** A group of recommended-model entries that all share the same `id`. The* `primary` is the non-subscription entry (programming/vision/reasoning/fast);diff --git a/packages/cli/src/providers/route-candidates.test.ts b/packages/cli/src/providers/route-candidates.test.tsindex a2c278b5..e2915e17 100644--- a/packages/cli/src/providers/route-candidates.test.ts+++ b/packages/cli/src/providers/route-candidates.test.ts@@ -17,6 +17,7 @@ import {catalogDeniesProvider,compareRouteCandidates,gatherRouteCandidates,+ nativeProviderForVendor,routeOwnership,} from "./route-candidates.js";import { buildCatalogChain, route } from "./routing-rules.js";@@ -236,6 +237,28 @@ function gatheredCandidate(model: string, provider: string): RouteCandidate {}describe("catalog route candidate gathering and order", () => {+ test("derives native providers from vendor route bindings", () => {+ const expected = {+ openai: "openai",+ google: "google",+ "x-ai": "x-ai",+ "z-ai": "z-ai",+ moonshotai: "kimi",+ minimax: "minimax",+ qwen: "qwen-payg",+ deepseek: "deepseek",+ mistralai: "mistralai",+ sakana: "sakana",+ } as const;++ expect(+ Object.fromEntries(+ Object.keys(expected).map((vendor) => [vendor, nativeProviderForVendor(vendor)])+ )+ ).toEqual(expected);+ expect(nativeProviderForVendor("anthropic")).toBeUndefined();+ });+test("puts a flat-rate subscription before a metered connection", () => {const candidates = gatherRouteCandidates("gpt-6-astra", cachePath).candidates;diff --git a/packages/cli/src/providers/route-candidates.ts b/packages/cli/src/providers/route-candidates.tsindex 6dd4a7a5..db811591 100644--- a/packages/cli/src/providers/route-candidates.ts+++ b/packages/cli/src/providers/route-candidates.ts@@ -67,6 +67,7 @@import { type SlimModelEntry, readAllModelsCache } from "./all-models-cache.js";import { externalIdFor, getCatalogEntries } from "./catalog-client.js";import {+ CATALOG_ROUTE_BINDINGS,type CatalogRouteBinding,catalogRouteForProvider,catalogRouteMatchesProvider,@@ -243,6 +244,31 @@ function isVendorOwnRoute(return route !== undefined && entry?.provider !== undefined && route.routeId === entry.provider;}+/**+ * The claudish provider that calls a vendor's own native API, or `undefined`.+ *+ * The same rule as {@link isVendorOwnRoute}, asked from the vendor's side: a+ * vendor's own routes are the ones whose `routeId` is its slug. Of the routing+ * table's providers bound to one of them, the first whose tier is `native` calls+ * the vendor's metered API. A subscription on the same route (`openai-codex`,+ * `kimi-coding`, `qwen-coding`) is never the answer, and neither is a+ * lookup-only name, which calls nothing.+ *+ * Read by the recommended-models listings (`--models-top`, MCP `list_models`) to+ * show a vendor's `provider@` shortcut beside its models. Deriving it replaced a+ * hand-written vendor table that mapped `qwen` to the steering placeholder `qwen`,+ * which has no shortcut, so Qwen rows showed none; the answer is `qwen-payg`+ * (`qpay@`). `anthropic` has no answer: Claude's own route here is the+ * `native-anthropic` subscription, and Anthropic's native API is lookup-only.+ */+export function nativeProviderForVendor(vendorSlug: string): string | undefined {+ for (const [provider, binding] of Object.entries(CATALOG_ROUTE_BINDINGS)) {+ if (binding.routeId !== vendorSlug) continue;+ if (getProviderByName(provider)?.tier === "native") return provider;+ }+ return undefined;+}+/*** Candidates from a provider's NAMESPACE CLAIM — dynamic subscriptions only.*