The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(desktop): surface cached-read rates in the model catalog menu
Brooklyn Nicholsona9d14d0ac1a6
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsxindex ce224c72280..c9ea2839e94 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx@@ -421,6 +421,57 @@ describe('the catalog renders per-model pricing', () => {await screen.findByText('free')})+ it('appends the cached-read rate next to the uncached input/output prices', async () => {+ getGlobalModelOptions.mockResolvedValue({+ providers: [+ {+ models: ['anthropic/claude-sonnet-5'],+ name: 'Nous Portal',+ slug: 'nous',+ pricing: {+ 'anthropic/claude-sonnet-5': {+ input: '$1.60',+ output: '$8.00',+ cache: '$0.16',+ free: false+ }+ }+ }+ ]+ })++ renderMenu()++ const prices = await screen.findByText('$1.60/$8.00')+ expect(prices.parentElement?.textContent).toContain('·$0.16')+ // The cached rate carries its own hover label naming it.+ expect(screen.getByTitle('cached read $0.16/Mtok')).not.toBeNull()+ })++ it('prices a collapsed -fast family from the fast sibling when the base id is unpriced', async () => {+ getGlobalModelOptions.mockResolvedValue({+ providers: [+ {+ models: ['anthropic/claude-sonnet-5', 'anthropic/claude-sonnet-5-fast'],+ name: 'Nous Portal',+ slug: 'nous',+ pricing: {+ 'anthropic/claude-sonnet-5-fast': {+ input: '$0.80',+ output: '$4.00',+ cache: null,+ free: false+ }+ }+ }+ ]+ })++ renderMenu()++ await screen.findByText('$0.80/$4.00')+ })+it('renders no price span when the provider carries no pricing for the model', async () => {getGlobalModelOptions.mockResolvedValue({providers: [diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsxindex a442f25a55b..47cdc6aa4d8 100644--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx@@ -68,17 +68,26 @@ import { type FastControl, ModelEditSubmenu, resolveFastControl } from './model-// items preventDefault on select).export const ModelMenuCloseContext = createContext<() => void>(() => {})-/** Compact per-row price: `$in/$out` per Mtok, "free", and a sale tag when the- * portal reports a discounted list price. Rendered only when the provider's- * payload carries pricing (Nous Portal and others that ship it). */+/** Compact per-row price: `$in/$out` per Mtok (cached read appended when the+ * provider ships it), "free", and a sale tag when the portal reports a+ * discounted list price. Rendered only when the provider's payload carries+ * pricing (Nous Portal and others that ship it). */function ModelPrice({ pricing }: { pricing: ModelPricing }) {+ const { t } = useI18n()+ const copy = t.shell.modelMenu// Partial payloads: `_apply_pricing` ships "" for unknown, but a provider// can report null — render nothing rather than "null/null" or "—/—".const input = pricing.input || nullconst output = pricing.output || null+ // Cached-input rate (`cache`, from the backend's `input_cache_read`); the+ // inline `input` rate is the uncached read, so together they cover the+ // cached-vs-uncached comparison without a tooltip round-trip (#63125).+ const cache = pricing.cache || null+if (pricing.free) {- return <span className="shrink-0 pl-2 text-[0.625rem] text-(--ui-green)">free</span>+ return <span className="shrink-0 pl-2 text-[0.625rem] text-(--ui-green)">{copy.free}</span>}+if (!input && !output) {return null}@@ -90,11 +99,16 @@ function ModelPrice({ pricing }: { pricing: ModelPricing }) {return (<spanclassName="flex shrink-0 items-center gap-1.5 pl-2 text-[0.625rem] tabular-nums text-(--ui-text-tertiary)"- title={`Input ${input ?? '—'}/Mtok · Output ${output ?? '—'}/Mtok`}+ title={copy.priceTitle(input ?? '—', output ?? '—', cache ?? '')}><span>{input ?? '—'}/{output ?? '—'}</span>+ {cache ? (+ <span className="text-(--ui-text-quaternary)" title={`${copy.cacheRead} ${cache}/Mtok`}>+ ·{cache}+ </span>+ ) : null}{discount ? (<span className="rounded bg-(--ui-green)/10 px-1 py-px font-medium text-(--ui-green)">−{discount}%@@ -673,10 +687,14 @@ export function ModelCatalogMenu({const isCurrent = activeId !== nullconst { name, tag } = modelDisplayParts(family.id)const caps = group.provider.capabilities?.[family.id]+// Live per-model $/Mtok pricing (Nous Portal and other- // providers that ship it). The `-fast` sibling shares the- // base id's price.- const pricing = group.provider.pricing?.[family.id]+ // providers that ship it). A `-fast` sibling shares the+ // base id's price: the collapsed row fronts the base, so+ // fall back to it when only the fast variant is unpriced.+ const pricing =+ group.provider.pricing?.[family.id] ??+ (family.fastId ? group.provider.pricing?.[family.fastId] : undefined)// Managed local model loading into memory right now:// real load percent, keyed by exact model id (remotediff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.tsindex f3e192c276a..cf37b60fa29 100644--- a/apps/desktop/src/i18n/ar.ts+++ b/apps/desktop/src/i18n/ar.ts@@ -2898,7 +2898,11 @@ export const ar = defineLocale({editModels: 'تحرير النماذج',followDefault: 'استخدام الافتراضي من الإعدادات',refreshModels: 'تحديث النماذج',- fast: 'سريع'+ fast: 'سريع',+ free: 'مجاني',+ cacheRead: 'قراءة من الذاكرة المؤقتة',+ priceTitle: (input: string, output: string, cache: string) =>+ `الإدخال ${input}/Mtok · الإخراج ${output}/Mtok` + (cache ? ` · قراءة من الذاكرة المؤقتة ${cache}/Mtok` : '')},modelOptions: {noOptions: 'لا توجد خيارات لهذا النموذج',diff --git a/apps/desktop/src/i18n/de.ts b/apps/desktop/src/i18n/de.tsindex 51e3748cca5..dbed2524889 100644--- a/apps/desktop/src/i18n/de.ts+++ b/apps/desktop/src/i18n/de.ts@@ -5001,7 +5001,11 @@ export const deOverrides = {editModels: 'Modelle bearbeiten…',followDefault: 'Standard aus den Einstellungen verwenden',refreshModels: 'Modelle aktualisieren',- fast: 'Schnell'+ fast: 'Schnell',+ free: 'kostenlos',+ cacheRead: 'Cache-Lesung',+ priceTitle: (input: string, output: string, cache: string) =>+ `Eingabe ${input}/Mtok · Ausgabe ${output}/Mtok` + (cache ? ` · Cache-Lesung ${cache}/Mtok` : '')},modelOptions: {noOptions: 'Keine Optionen für dieses Modell',diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.tsindex f52e7a8798c..ec2a1334c84 100644--- a/apps/desktop/src/i18n/en.ts+++ b/apps/desktop/src/i18n/en.ts@@ -4605,7 +4605,11 @@ export const en: Translations = {editModels: 'Edit models…',followDefault: 'Use Settings default',refreshModels: 'Refresh models',- fast: 'Fast'+ fast: 'Fast',+ free: 'free',+ cacheRead: 'cached read',+ priceTitle: (input: string, output: string, cache: string) =>+ `Input ${input}/Mtok · Output ${output}/Mtok` + (cache ? ` · Cached read ${cache}/Mtok` : '')},modelOptions: {noOptions: 'No options for this model',diff --git a/apps/desktop/src/i18n/es.ts b/apps/desktop/src/i18n/es.tsindex 5c6f155a27e..dbfc0c6643b 100644--- a/apps/desktop/src/i18n/es.ts+++ b/apps/desktop/src/i18n/es.ts@@ -4991,7 +4991,11 @@ export const esOverrides = {editModels: 'Editar modelos…',followDefault: 'Usar el predeterminado de Ajustes',refreshModels: 'Actualizar modelos',- fast: 'Rápido'+ fast: 'Rápido',+ free: 'gratis',+ cacheRead: 'lectura en caché',+ priceTitle: (input: string, output: string, cache: string) =>+ `Entrada ${input}/Mtok · Salida ${output}/Mtok` + (cache ? ` · Lectura en caché ${cache}/Mtok` : '')},modelOptions: {noOptions: 'No hay opciones para este modelo',diff --git a/apps/desktop/src/i18n/fr.ts b/apps/desktop/src/i18n/fr.tsindex a524c9aa72e..f85a59e4fce 100644--- a/apps/desktop/src/i18n/fr.ts+++ b/apps/desktop/src/i18n/fr.ts@@ -5013,7 +5013,11 @@ export const frOverrides = {editModels: 'Modifier les modèles…',followDefault: 'Utiliser le modèle par défaut des Réglages',refreshModels: 'Actualiser les modèles',- fast: 'Rapide'+ fast: 'Rapide',+ free: 'gratuit',+ cacheRead: 'lecture en cache',+ priceTitle: (input: string, output: string, cache: string) =>+ `Entrée ${input}/Mtok · Sortie ${output}/Mtok` + (cache ? ` · Lecture en cache ${cache}/Mtok` : '')},modelOptions: {noOptions: 'Aucune option pour ce modèle',diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.tsindex a40efa70de2..62f60a2e1ca 100644--- a/apps/desktop/src/i18n/ja.ts+++ b/apps/desktop/src/i18n/ja.ts@@ -3346,7 +3346,11 @@ export const ja = defineLocale({editModels: 'モデルを編集…',followDefault: '設定のデフォルトを使用',refreshModels: 'モデルを更新',- fast: '高速'+ fast: '高速',+ free: '無料',+ cacheRead: 'キャッシュ読み取り',+ priceTitle: (input: string, output: string, cache: string) =>+ `入力 ${input}/Mtok · 出力 ${output}/Mtok` + (cache ? ` · キャッシュ読み取り ${cache}/Mtok` : '')},modelOptions: {noOptions: 'このモデルにはオプションがありません',diff --git a/apps/desktop/src/i18n/ru.ts b/apps/desktop/src/i18n/ru.tsindex 137b18b1307..333d4852a35 100644--- a/apps/desktop/src/i18n/ru.ts+++ b/apps/desktop/src/i18n/ru.ts@@ -3573,7 +3573,11 @@ export const ru = defineLocale({editModels: 'Изменить модели…',followDefault: 'Использовать модель по умолчанию из настроек',refreshModels: 'Обновить модели',- fast: 'Быстрая'+ fast: 'Быстрая',+ free: 'бесплатно',+ cacheRead: 'чтение из кэша',+ priceTitle: (input: string, output: string, cache: string) =>+ `Вход ${input}/Mtok · Выход ${output}/Mtok` + (cache ? ` · Чтение из кэша ${cache}/Mtok` : '')},modelOptions: {noOptions: 'Для этой модели нет опций',diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.tsindex ac9dd579db0..34905e56b87 100644--- a/apps/desktop/src/i18n/types.ts+++ b/apps/desktop/src/i18n/types.ts@@ -3858,6 +3858,9 @@ export interface Translations {followDefault: stringrefreshModels: stringfast: string+ free: string+ cacheRead: string+ priceTitle: (input: string, output: string, cache: string) => string}modelOptions: {noOptions: stringdiff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.tsindex fd3a473f26a..3c17eaff4ab 100644--- a/apps/desktop/src/i18n/zh-hant.ts+++ b/apps/desktop/src/i18n/zh-hant.ts@@ -3532,7 +3532,11 @@ export const zhHant = defineLocale({editModels: '編輯模型…',followDefault: '使用設定中的預設模型',refreshModels: '重新整理模型',- fast: '快速'+ fast: '快速',+ free: '免費',+ cacheRead: '快取讀取',+ priceTitle: (input: string, output: string, cache: string) =>+ `輸入 ${input}/Mtok · 輸出 ${output}/Mtok` + (cache ? ` · 快取讀取 ${cache}/Mtok` : '')},modelOptions: {noOptions: '此模型沒有可用選項',diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.tsindex 4e8eef3cc91..bb714b56568 100644--- a/apps/desktop/src/i18n/zh.ts+++ b/apps/desktop/src/i18n/zh.ts@@ -4306,7 +4306,11 @@ export const zh = defineLocale({editModels: '编辑模型…',followDefault: '使用设置中的默认模型',refreshModels: '刷新模型',- fast: '快速'+ fast: '快速',+ free: '免费',+ cacheRead: '缓存读取',+ priceTitle: (input: string, output: string, cache: string) =>+ `输入 ${input}/Mtok · 输出 ${output}/Mtok` + (cache ? ` · 缓存读取 ${cache}/Mtok` : '')},modelOptions: {noOptions: '此模型没有可用选项',