"use client"; import Card from "./Card"; // Only show fields user actually cares about const FIELD_SCHEMA = { mode: { label: "Mode", format: (v) => v }, defaultModel: { label: "Model", format: (v) => v, mono: true }, baseUrl: { label: "Endpoint", format: (v) => v, isLink: true, mono: true }, costPerQuery: { label: "Cost / call", format: (v) => v === 0 ? "Free" : `$${v.toFixed(4)}` }, pricingUrl: { label: "Pricing", format: () => "View pricing", isLink: true }, freeTier: { label: "Free tier", format: (v) => v }, freeMonthlyQuota: { label: "Free quota", format: (v) => v === 0 ? "—" : v >= 999999 ? "Unlimited" : `${v.toLocaleString()} / mo` }, searchTypes: { label: "Types", format: (v) => v.join(", ") }, formats: { label: "Formats", format: (v) => v.join(", ") }, maxMaxResults: { label: "Max results", format: (v) => v }, maxCharacters: { label: "Max chars", format: (v) => v.toLocaleString() }, }; export default function ProviderInfoCard({ config, provider, title = "Provider Info" }) { if (!config) return null; const rows = Object.entries(FIELD_SCHEMA) .filter(([key]) => config[key] !== undefined && config[key] !== null && config[key] !== "") .map(([key, schema]) => ({ key, label: schema.label, value: schema.format(config[key]), isLink: schema.isLink, mono: schema.mono, raw: config[key], })); const signupUrl = provider?.notice?.apiKeyUrl || provider?.website; const noticeText = provider?.notice?.text; return (

{title}

{signupUrl && ( open_in_new Get API Key )}
{rows.map((r) => (
{r.label} {r.isLink ? ( {r.value} ) : ( {r.value} )}
))} {noticeText && (
Notice {noticeText}
)}
); }