Model Comparison
One prompt, several models, answers side by side with time, tokens and cost.
PROGet Model Comparison and 168 other Pro components with pro lifetime — Get Pro
- Category
- RAG & Evals
- Access
- ProPro · unlocked
- Source
- 361 lines · one file
- States
- 6 drawn
- Added
- 12 Oct 2026
The decision inside it
Missing numbers are not zeros
A self-hosted model with no price says "Not reported", never $0.00, and it cannot win Cheapest. A comparison is only fair when like is compared with like, so different settings are flagged.
When to use it
Use Model Comparison to run one prompt on several models side by side: each output with time, tokens and cost, copy, a rating, and per-model rerun. Pass your own logos through each result's logo.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Model Comparison for this.
Install it: npx shadcn@latest add @liro/model-comparison
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/model-comparison.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { ModelComparison, type ModelComparisonResult } from "@/components/ui/model-comparison";
const results: ModelComparisonResult[] = [
{ id: "a", model: "Model A", provider: "Provider one", status: "completed", output: "Your invoice INV-2041 is 45 days overdue…", durationMs: 1800, outputTokens: 120 },
{ id: "b", model: "Model B", provider: "Provider two", status: "running" },
];
export function CompareModels() {
return <ModelComparison prompt="Write a payment reminder." results={results} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
prompt | React.ReactNode | Yes | The prompt every model was given. |
results | ModelComparisonResult[] | Yes | – |
onRunModel | (result: ModelComparisonResult) => void | Promise<void> | No | Adds Retry to failed columns and "Run again" to finished ones. May return a promise. |
selectedId | string | null | No | The chosen answer. Controlled. |
onSelectResult | (result: ModelComparisonResult | null) => void | No | – |
onCopyResult | (result: ModelComparisonResult) => void | No | – |
onRateResult | (result: ModelComparisonResult, rating: "up" | "down") => void | No | Adds thumbs up and down. |
ratings | Record<string, "up" | "down"> | No | Ratings to show, by result id. |
clampLines | number | No | Lines of output before "Show all". Default 8. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themebadgebuttonstateStates
All of them are drawn by the component. None is left for you to design.
- Queued
- Streaming
- Done
- Failed
- Chosen
- Different settings
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances