MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / PricingSourceCard

Function PricingSourceCard

dashboard/savings/src/ModelsPanel.tsx:17–47  ·  view source on GitHub ↗
({ pricing }: { pricing: PricingResponse | null })

Source from the content-addressed store, hash-verified

15import type { ModelsResponse, PricingResponse } from "./types";
16
17function PricingSourceCard({ pricing }: { pricing: PricingResponse | null }) {
18 if (!pricing) return null;
19 const sourceLabel =
20 pricing.source === "cache"
21 ? "OpenRouter (cached fetch)"
22 : "bundled snapshot (offline fallback)";
23 return (
24 <Card>
25 <CardHeader>
26 <CardTitle>Model pricing source</CardTitle>
27 </CardHeader>
28 <CardContent>
29 <div className="tss-meta-strip">
30 <Badge>{sourceLabel}</Badge>
31 <Badge>{fmtTokens(pricing.model_count)} models</Badge>
32 {pricing.fetched_at && <Badge>fetched {timeAgo(pricing.fetched_at)}</Badge>}
33 {pricing.offline && <Badge>TRACEDECAY_OFFLINE=1 — network disabled</Badge>}
34 </div>
35 <p className="tss-chart-hint">
36 Prices come from OpenRouter’s public model list, cached at{" "}
37 <code>{pricing.cache_path || "~/.tracedecay/model-prices.json"}</code>{" "}
38 and refreshed in the background at most once per day. When the cache
39 is missing and the network is unavailable, a snapshot bundled with
40 the binary keeps this tab working. Transcript model ids are
41 fuzzy-matched to OpenRouter slugs; unmatched models show{" "}
42 <em>no price data</em>.
43 </p>
44 </CardContent>
45 </Card>
46 );
47}
48
49export default function ModelsPanel({
50 data,

Callers

nothing calls this directly

Calls 2

fmtTokensFunction · 0.90
timeAgoFunction · 0.90

Tested by

no test coverage detected