Skip to content

🤖 feat: show model pricing on hover in chat-input picker#3366

Open
Neppkun wants to merge 1 commit into
coder:mainfrom
Neppkun:pricing_on_hover
Open

🤖 feat: show model pricing on hover in chat-input picker#3366
Neppkun wants to merge 1 commit into
coder:mainfrom
Neppkun:pricing_on_hover

Conversation

@Neppkun
Copy link
Copy Markdown

@Neppkun Neppkun commented May 23, 2026

Summary

Hovering a model row in the chat-input picker now shows a tooltip with that model's pricing (input / output / cache-read / cache-write per 1M tokens), context window, and max output. No delay — the tooltip appears as soon as the cursor lands on a row.

demo

Background

Users frequently want to know what a model costs before they pick it, but today that info is only available two extra clicks away in Settings → Models. Surfacing it right in the picker turns "switch model" into a decision that includes cost without any context switch.

Implementation

  • Extracted the existing per-model tooltip body from ModelRow.tsx into a new shared component ModelPricingTooltip (src/browser/components/ModelPricingTooltip/ModelPricingTooltip.tsx). The markup, Tailwind classes, and formatCostPerMillion / formatTokenCount helpers are moved verbatim so the Settings tooltip is byte-identical to before.
  • Wrapped each picker row in ModelSelector.tsx with a Radix Tooltip (delayDuration={0}, portaled TooltipContent on side="right" with collisionPadding={12} so it flips at the viewport edge). Pricing is looked up inline with the existing pure, renderer-local getModelStats(model) — no IPC, no prop threading, no async loading.
  • Pre-existing intra-row tooltips on the Eye and Star buttons are untouched and continue to take precedence when the cursor is over them.
  • When getModelStats returns null (e.g. Ollama, custom providers with no metadata) the shared component renders the existing "No pricing data available" copy.

Net product LoC: roughly +25 (most of the new file is text moved from ModelRow.tsx).

Validation

  • make typecheck — clean on both project configs.
  • make lintESLint checks passed!.
  • bun test src/browser/features/Settings/Sections/ — 65 pass / 0 fail (covers ModelRow and the suites that mock ModelSelector).
  • bun test src/common/utils/tokens/modelStats.test.ts — 19 pass (pricing data layer untouched, sanity check).
  • Local sandbox: confirmed the tooltip appears on hover, flips sides near the viewport edge, falls back to "No pricing data available", and the Settings → Models info popover renders identically to before the refactor.

Risks

Low. The Settings tooltip is the same JSX with the same classes, just imported from a new module; the new picker tooltip is additive and uses the same Radix primitive already in use inside this scrollable list for the Eye/Star buttons. If anything goes wrong the visible blast radius is "tooltip doesn't appear" rather than anything affecting model selection.


Generated with mux • Model: anthropic:claude-opus-4-7 • Thinking: high • Cost: $4.36

Hovering a row in the chat-input model selector now shows a tooltip with the model's pricing (input/output/cache-read/cache-write per 1M tokens), context window, and max output. The pricing body is extracted into a shared ModelPricingTooltip component reused by Settings → Models so the two views stay visually identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant