Command Palette

Search for a command to run...

AI Elements / Chat/AI Model Selector

AI Model Selector

A functional AI model selector with provider logos and popular models from Vercel AI Gateway. Features searchable combobox, provider icons, and model grouping.

Open in v0Open in

Overview

A fully functional AI model selector with 22+ popular models from OpenAI, Anthropic, Google, xAI, DeepSeek, Mistral, Groq, Cohere, and Meta. Returns provider/model-id format compatible with Vercel AI SDK.

Installation

bunx shadcn@latest add @elements/model-selector

Usage

import { ModelSelector } from "@/components/elements/ai-elements/chat/model-selector";
import { useState } from "react";

export function ModelPicker() {
  const [model, setModel] = useState("");

  return (
    <ModelSelector
      value={model}
      onValueChange={setModel}
      placeholder="Select a model..."
    />
  );
}

Props

PropTypeDefaultDescription
valuestring-Controlled value
onValueChange(value: string) => void-Callback when value changes
modelsModel[]DEFAULT_MODELSCustom model list
placeholderstring"Select a model..."Placeholder text
classNamestring-Additional CSS classes
disabledbooleanfalseDisable the selector

Custom Models

import { ModelSelector, type Model } from "@/components/elements/ai-elements/chat/model-selector";

const customModels: Model[] = [
  { id: "openai/gpt-4o", name: "GPT-4o", provider: "openai", description: "Multimodal" },
  { id: "anthropic/claude-sonnet-4", name: "Claude Sonnet 4", provider: "anthropic" },
];

export function CustomSelector() {
  return <ModelSelector models={customModels} />;
}

Features

  • Searchable combobox with fuzzy matching
  • Provider logos from Elements registry
  • Model grouping by provider
  • Returns provider/model-id format
  • Controlled and uncontrolled modes
  • Keyboard navigation support