import { RangeBar, distDomain } from '@/components/intelligence/bits'; import { DataStrip, type StripItem } from '@/components/layout/terminal'; import { fmtInt, fmtSigned, num } from '@/lib/format'; import type { ProviderIntelRow } from '@/lib/types'; /** * Provider aggregates as a `DataStrip` (provider page header): models served · organizations covered · input / output price * distributions (range bars) · price changes 30 d · models added / removed 30 d. `domain` lets the caller share the log axis * with a table of every provider; alone, the provider's own extent is used. */ export function ProviderStrip({ p, note, domainIn, domainOut }: { p: ProviderIntelRow; note?: string | null; domainIn?: [number, number]; domainOut?: [number, number] }) { const din = domainIn ?? distDomain([p.input_price_distribution]); const dout = domainOut ?? distDomain([p.output_price_distribution]); const items: StripItem[] = [ { label: 'Models served', value: fmtInt(p.model_count), definition: 'Canonical models with at least one current offer at this provider.' }, { label: 'Organizations covered', value: fmtInt(p.organizations_covered), definition: 'Distinct organizations behind the models this provider currently lists.' }, { label: 'Input price', value: , definition: note ?? 'min · p25 · median · p75 · max of live input prices (USD / 1M tokens) over current offers with a positive price.' }, { label: 'Output price', value: , definition: 'min · p25 · median · p75 · max of live output prices over current offers with a positive price.' }, { label: 'Price changes · 30 d', value: fmtInt(p.price_changes_30d), definition: 'PRICE_CHANGED events (not back-filled) in the last 30 days on models this provider currently lists.' }, { label: 'Added / removed · 30 d', value: {fmtSigned(p.models_added_30d)} / {num(p.models_removed_30d) ? `−${fmtInt(p.models_removed_30d)}` : '0'}, definition: 'Model listings first opened / last closed at this provider in the last 30 days.' }, ]; return ; }