import { useSearchParams } from "@remix-run/react"; import { typedjson, useTypedLoaderData } from "remix-typedjson"; import { z } from "zod"; import { LinkButton } from "~/components/primitives/Buttons"; import { Paragraph } from "~/components/primitives/Paragraph"; import { Table, TableBlankRow, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow, } from "~/components/primitives/Table"; import { dashboardLoader } from "~/services/routeBuilders/dashboardBuilder"; import { getMissingLlmModels } from "~/services/admin/missingLlmModels.server"; const LOOKBACK_OPTIONS = [ { label: "1 hour", value: 1 }, { label: "6 hours", value: 6 }, { label: "24 hours", value: 24 }, { label: "7 days", value: 168 }, { label: "30 days", value: 720 }, ]; const _SearchParams = z.object({ lookbackHours: z.coerce.number().optional(), }); export const loader = dashboardLoader( { authorization: { requireSuper: true } }, async ({ request }) => { const url = new URL(request.url); const lookbackHours = parseInt(url.searchParams.get("lookbackHours") ?? "24", 10); let models: Awaited> = []; let error: string | undefined; try { models = await getMissingLlmModels({ lookbackHours }); } catch (e) { error = e instanceof Error ? e.message : "Failed to query ClickHouse"; } return typedjson({ models, lookbackHours, error }); } ); export default function AdminLlmModelsMissingRoute() { const { models, lookbackHours, error } = useTypedLoaderData(); const [_searchParams, _setSearchParams] = useSearchParams(); return (

Missing LLM Models

Back to models
Models appearing in spans without cost enrichment. These models need pricing data added. {/* Lookback selector */}
Lookback: {LOOKBACK_OPTIONS.map((opt) => ( {opt.label} ))}
{error && (
{error}
)} {models.length} unpriced model{models.length !== 1 ? "s" : ""} found in the last{" "} {lookbackHours < 24 ? `${lookbackHours}h` : lookbackHours < 168 ? `${lookbackHours / 24}d` : `${Math.round(lookbackHours / 24)}d`} Model Name Provider Span Count Actions {models.length === 0 ? ( All models have pricing data ) : ( models.map((m) => ) )}
); } // --------------------------------------------------------------------------- // Row component with link to detail page // --------------------------------------------------------------------------- function MissingModelRow({ model: m, }: { model: { model: string; system: string; count: number }; }) { return ( {m.model} {m.system || "-"} {m.count.toLocaleString()} Details ); }