Skip to content

The agent that grows with you

feat(desktop): render per-model pricing in the model catalog menu

Thiago Chu67bc5676578c
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
index 2c14e6c4fe3..a436e79d798 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.test.tsx
@@ -374,3 +374,50 @@ describe('the per-row options submenu is discoverable', () => {
expect(screen.queryByText('Effort')).toBeNull()
})
})
+
+describe('the catalog renders per-model pricing', () => {
+ it('shows $/Mtok input/output and the sale tag when the provider ships pricing', 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,
+ discount_percent: 20
+ }
+ }
+ }
+ ]
+ })
+
+ renderMenu()
+
+ await screen.findByText('$1.60/$8.00')
+ expect(screen.queryByText('−20%')).not.toBeNull()
+ })
+
+ it('renders a free label for free-tier models', async () => {
+ getGlobalModelOptions.mockResolvedValue({
+ providers: [
+ {
+ models: ['nous/hermes-4'],
+ name: 'Nous Portal',
+ slug: 'nous',
+ pricing: {
+ 'nous/hermes-4': { input: 'free', output: 'free', cache: null, free: true }
+ }
+ }
+ ]
+ })
+
+ renderMenu()
+
+ await screen.findByText('free')
+ })
+})
diff --git a/apps/desktop/src/app/shell/model-catalog-menu.tsx b/apps/desktop/src/app/shell/model-catalog-menu.tsx
index b5f5bc3915f..3ca83c44087 100644
--- a/apps/desktop/src/app/shell/model-catalog-menu.tsx
+++ b/apps/desktop/src/app/shell/model-catalog-menu.tsx
@@ -1,4 +1,4 @@
-import type { ModelOptionProvider, ModelOptionsResult } from '@hermes/shared'
+import type { ModelOptionProvider, ModelOptionsResult, ModelPricing } from '@hermes/shared'
import { DEFAULT_REASONING_EFFORT } from '@hermes/shared'
import { useStore } from '@nanostores/react'
import { useQuery } from '@tanstack/react-query'
@@ -68,6 +68,31 @@ 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). */
+function ModelPrice({ pricing }: { pricing: ModelPricing }) {
+ if (pricing.free) {
+ return <span className="shrink-0 pl-2 text-[0.625rem] text-(--ui-green)">free</span>
+ }
+
+ return (
+ <span
+ className="flex shrink-0 items-center gap-1.5 pl-2 text-[0.625rem] tabular-nums text-(--ui-text-tertiary)"
+ title={`Input ${pricing.input}/Mtok · Output ${pricing.output}/Mtok`}
+ >
+ <span>
+ {pricing.input}/{pricing.output}
+ </span>
+ {pricing.discount_percent ? (
+ <span className="rounded bg-(--ui-green)/10 px-1 py-px font-medium text-(--ui-green)">
+ −{pricing.discount_percent}%
+ </span>
+ ) : null}
+ </span>
+ )
+}
+
/** One model choice, everything a caller needs to act on a selection.
* `effort` is '' for "inherit the default" and 'none' for thinking off. */
export interface ModelChoice {
@@ -637,6 +662,10 @@ export function ModelCatalogMenu({
const isCurrent = activeId !== null
const { 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]
// Managed local model loading into memory right now:
// real load percent, keyed by exact model id (remote
@@ -724,6 +753,7 @@ export function ModelCatalogMenu({
</span>
</span>
) : null}
+ {pricing ? <ModelPrice pricing={pricing} /> : null}
{isCurrent ? (
<Codicon
className={cn('text-foreground', loadProgress ? 'ml-1' : 'ml-auto')}