laguagu/claude-code-nextjs-skills / skills/ai-elements
ai-elements
VerifiedMaintains AI chat UI built from elements.ai-sdk.dev AI Elements components already copied into the project. Use when changing or debugging those components (conversations, messages, prompt inputs, attachments, reasoning, tool output, sources). New chat UI uses the shadcn/ui AI Elements patterns (`shadcn` skill).
scripts/model-selector.tsx
View on GitHub"use client";
import {
ModelSelector,
ModelSelectorContent,
ModelSelectorEmpty,
ModelSelectorGroup,
ModelSelectorInput,
ModelSelectorItem,
ModelSelectorList,
ModelSelectorLogo,
ModelSelectorLogoGroup,
ModelSelectorName,
ModelSelectorTrigger,
} from "@/components/ai-elements/model-selector";
import { Button } from "@/components/ui/button";
import { CheckIcon } from "lucide-react";
import { memo, useCallback, useState } from "react";
const models = [
{
chef: "OpenAI",
chefSlug: "openai",
id: "gpt-6.1-sol",
name: "GPT-6.1 Sol",
providers: ["openai", "azure"],
},
{
chef: "OpenAI",
chefSlug: "openai",
id: "gpt-6-luna",
name: "GPT-6 Luna",
providers: ["openai", "azure"],
},
{
chef: "OpenAI",
chefSlug: "openai",
id: "o3",
name: "o3",
providers: ["openai", "azure"],
},
{
chef: "OpenAI",
chefSlug: "openai",
id: "o3-mini",
name: "o3 Mini",
providers: ["openai", "azure"],
},
{
chef: "Anthropic",
chefSlug: "anthropic",
id: "claude-opus-5",
name: "Claude Opus 5",
providers: ["anthropic", "azure", "google-vertex", "amazon-bedrock"],
},
{
chef: "Anthropic",
chefSlug: "anthropic",
id: "claude-sonnet-5",
name: "Claude Sonnet 5",
providers: ["anthropic", "azure", "google-vertex", "amazon-bedrock"],
},
{
chef: "Anthropic",
chefSlug: "anthropic",
id: "claude-haiku-4-5",
name: "Claude Haiku 4.5",
providers: ["anthropic", "azure", "google-vertex", "amazon-bedrock"],
},
{
chef: "Google",
chefSlug: "google",
id: "gemini-2.0-flash-exp",
name: "Gemini 2.0 Flash",
providers: ["google", "google-vertex"],
},
{
chef: "Google",
chefSlug: "google",
id: "gemini-1.5-pro",
name: "Gemini 1.5 Pro",
providers: ["google", "google-vertex"],
},
{
chef: "Google",
chefSlug: "google",
id: "gemini-1.5-flash",
name: "Gemini 1.5 Flash",
providers: ["google", "google-vertex"],
},
{
chef: "Meta",
chefSlug: "llama",
id: "llama-3.3-70b",
name: "Llama 3.3 70B",
providers: ["groq", "togetherai", "amazon-bedrock"],
},
{
chef: "Meta",
chefSlug: "llama",
id: "llama-3.1-405b",
name: "Llama 3.1 405B",
providers: ["togetherai", "amazon-bedrock"],
},
{
chef: "Meta",
chefSlug: "llama",
id: "llama-3.1-70b",
name: "Llama 3.1 70B",
providers: ["groq", "togetherai", "amazon-bedrock"],
},
{
chef: "Meta",
chefSlug: "llama",
id: "llama-3.1-8b",
name: "Llama 3.1 8B",
providers: ["groq", "togetherai"],
},
{
chef: "DeepSeek",
chefSlug: "deepseek",
id: "deepseek-r1",
name: "DeepSeek R1",
providers: ["deepseek", "openrouter"],
},
{
chef: "DeepSeek",
chefSlug: "deepseek",
id: "deepseek-v3",
name: "DeepSeek V3",
providers: ["deepseek", "openrouter"],
},
{
chef: "DeepSeek",
chefSlug: "deepseek",
id: "deepseek-coder-v2",
name: "DeepSeek Coder V2",
providers: ["deepseek", "openrouter"],
},
{
chef: "Mistral AI",
chefSlug: "mistral",
id: "mistral-large",
name: "Mistral Large",
providers: ["mistral", "azure"],
},
{
chef: "Mistral AI",
chefSlug: "mistral",
id: "mistral-small",
name: "Mistral Small",
providers: ["mistral", "azure"],
},
{
chef: "Mistral AI",
chefSlug: "mistral",
id: "codestral",
name: "Codestral",
providers: ["mistral"],
},
{
chef: "Alibaba",
chefSlug: "alibaba",
id: "qwen-2.5-72b",
name: "Qwen 2.5 72B",
providers: ["alibaba", "openrouter"],
},
{
chef: "Alibaba",
chefSlug: "alibaba",
id: "qwen-2.5-coder-32b",
name: "Qwen 2.5 Coder 32B",
providers: ["alibaba", "openrouter"],
},
{
chef: "Alibaba",
chefSlug: "alibaba",
id: "qwen-max",
name: "Qwen Max",
providers: ["alibaba"],
},
{
chef: "Cohere",
chefSlug: "cohere",
id: "command-r-plus",
name: "Command R+",
providers: ["cohere", "azure", "amazon-bedrock"],
},
{
chef: "Cohere",
chefSlug: "cohere",
id: "command-r",
name: "Command R",
providers: ["cohere", "azure", "amazon-bedrock"],
},
{
chef: "xAI",
chefSlug: "xai",
id: "grok-3",
name: "Grok 3",
providers: ["xai"],
},
{
chef: "xAI",
chefSlug: "xai",
id: "grok-2-1212",
name: "Grok 2 1212",
providers: ["xai"],
},
{
chef: "xAI",
chefSlug: "xai",
id: "grok-vision",
name: "Grok Vision",
providers: ["xai"],
},
{
chef: "Moonshot AI",
chefSlug: "moonshotai",
id: "moonshot-v1-128k",
name: "Moonshot v1 128K",
providers: ["moonshotai"],
},
{
chef: "Moonshot AI",
chefSlug: "moonshotai",
id: "moonshot-v1-32k",
name: "Moonshot v1 32K",
providers: ["moonshotai"],
},
{
chef: "Perplexity",
chefSlug: "perplexity",
id: "sonar-pro",
name: "Sonar Pro",
providers: ["perplexity"],
},
{
chef: "Perplexity",
chefSlug: "perplexity",
id: "sonar",
name: "Sonar",
providers: ["perplexity"],
},
{
chef: "Vercel",
chefSlug: "v0",
id: "v0-chat",
name: "v0 Chat",
providers: ["vercel"],
},
{
chef: "Amazon",
chefSlug: "amazon-bedrock",
id: "nova-pro",
name: "Nova Pro",
providers: ["amazon-bedrock"],
},
{
chef: "Amazon",
chefSlug: "amazon-bedrock",
id: "nova-lite",
name: "Nova Lite",
providers: ["amazon-bedrock"],
},
{
chef: "Amazon",
chefSlug: "amazon-bedrock",
id: "nova-micro",
name: "Nova Micro",
providers: ["amazon-bedrock"],
},
];
interface ModelItemProps {
model: (typeof models)[0];
selectedModel: string;
onSelect: (id: string) => void;
}
const ModelItem = memo(({ model, selectedModel, onSelect }: ModelItemProps) => {
const handleSelect = useCallback(
() => onSelect(model.id),
[onSelect, model.id]
);
return (
<ModelSelectorItem key={model.id} onSelect={handleSelect} value={model.id}>
<ModelSelectorLogo provider={model.chefSlug} />
<ModelSelectorName>{model.name}</ModelSelectorName>
<ModelSelectorLogoGroup>
{model.providers.map((provider) => (
<ModelSelectorLogo key={provider} provider={provider} />
))}
</ModelSelectorLogoGroup>
{selectedModel === model.id ? (
<CheckIcon className="ml-auto size-4" />
) : (
<div className="ml-auto size-4" />
)}
</ModelSelectorItem>
);
});
ModelItem.displayName = "ModelItem";
const Example = () => {
const [open, setOpen] = useState(false);
const [selectedModel, setSelectedModel] = useState<string>("gpt-6.1-sol");
const handleModelSelect = useCallback((id: string) => {
setSelectedModel(id);
setOpen(false);
}, []);
const selectedModelData = models.find((model) => model.id === selectedModel);
// Get unique chefs in order of appearance
const chefs = [...new Set(models.map((model) => model.chef))];
return (
<div className="flex size-full items-center justify-center p-8">
<ModelSelector onOpenChange={setOpen} open={open}>
<ModelSelectorTrigger asChild>
<Button className="w-[200px] justify-between" variant="outline">
{selectedModelData?.chefSlug && (
<ModelSelectorLogo provider={selectedModelData.chefSlug} />
)}
{selectedModelData?.name && (
<ModelSelectorName>{selectedModelData.name}</ModelSelectorName>
)}
</Button>
</ModelSelectorTrigger>
<ModelSelectorContent>
<ModelSelectorInput placeholder="Search models..." />
<ModelSelectorList>
<ModelSelectorEmpty>No models found.</ModelSelectorEmpty>
{chefs.map((chef) => (
<ModelSelectorGroup heading={chef} key={chef}>
{models
.filter((model) => model.chef === chef)
.map((model) => (
<ModelItem
key={model.id}
model={model}
onSelect={handleModelSelect}
selectedModel={selectedModel}
/>
))}
</ModelSelectorGroup>
))}
</ModelSelectorList>
</ModelSelectorContent>
</ModelSelector>
</div>
);
};
export default Example;
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |