Model Picker
The model menu of an AI chat, with the cost of the next reply for this chat.
PROGet Model Picker and 168 other Pro components with pro lifetime — Get Pro
- Category
- AI Agent
- Access
- ProPro · unlocked
- Source
- 661 lines · one file
- States
- 5 drawn
- Added
- 21 Oct 2026
The decision inside it
Price for this conversation, not per million tokens
"$3 / M input" means nothing to the person choosing. Pass the size of the chat and the tray says "≈ $0.04 for the next reply". A model whose context window cannot hold the chat is disabled and says so in numbers.
When to use it
Use Model Picker in a chat composer or agent settings to choose a model with its speed, quality and the cost of the next reply for this conversation. Pass contextTokens so models that cannot hold the chat are disabled.
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 Picker for this.
Install it: npx shadcn@latest add @liro/model-picker
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/model-picker.
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
"use client";
import * as React from "react";
import { ModelPicker, type ModelOption } from "@/components/ui/model-picker";
const models: ModelOption[] = [
{ id: "swift", name: "Swift", provider: "Madgixs AI", speed: 5, quality: 3, inputPrice: 0.8, outputPrice: 4, contextWindow: 200_000, firstTokenMs: 300, recommended: true },
{ id: "deep", name: "Deep", provider: "Madgixs AI", speed: 2, quality: 5, inputPrice: 15, outputPrice: 75, contextWindow: 200_000, firstTokenMs: 1200, thinking: true },
];
export function ChatModel({ tokens }: { tokens: number }) {
const [model, setModel] = React.useState("swift");
return <ModelPicker models={models} value={model} onChange={setModel} contextTokens={tokens} side="top" />;
}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 | ||
|---|---|---|---|
models | ModelOption[] | Yes | – |
value | string | No | The chosen model id. Leave out to let the picker keep its own. |
defaultValue | string | No | – |
onChange | (id: string) => void | No | – |
thinking | ThinkingState | No | Controlled thinking. |
defaultThinking | ThinkingState | No | – |
onThinkingChange | (t: ThinkingState) => void | No | – |
contextTokens | number | No | Tokens in the conversation so far. Drives the estimate and which models fit. |
expectedOutputTokens | number | No | Tokens a typical reply runs to. Default 800. |
thinkingBudget | Record<Effort, number> | No | Extra output tokens per effort level. Default 1k / 4k / 16k. |
open | boolean | No | Controlled open state. |
defaultOpen | boolean | No | – |
onOpenChange | (open: boolean) => void | No | – |
side | "top" | "bottom" | No | Where the menu opens. Default `bottom`. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Closed
- Open
- Thinking on
- Too small for this chat
- Searching
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