Pipeline
- Docsusage, props, keywords
- Demosrc/demo.tsx
- Buildshadcn add → vite
- Capturelight, dark, motion
- IndexBM25 + vectors
Public log. Prompts, raw model errors and costs stay on the admin side.
Log
Demo source
src/demo.tsx · from an earlier run
import { TokenSplitBar, formatTokens, formatUsd, getCacheHitRate, getCacheSavings, getTokenCost } from '@/components/dashboardblocks/ai-usage'import { Card, CardContent } from '@/components/ui/card'export default function AiUsageDemo() { const tokens = { input: 12000, cached: 4000, output: 3000 } const prices = { input: 3, cached: 0.3, output: 15 } const total = tokens.input + tokens.cached + tokens.output const cost = getTokenCost(tokens, prices) const savings = getCacheSavings(tokens.cached, prices) const hitRate = getCacheHitRate(tokens) return ( <Card className='w-full max-w-sm'> <CardContent className='grid gap-4'> <div className='flex items-baseline justify-between'> <span className='text-2xl font-semibold'>{formatUsd(cost)}</span> <span className='text-muted-foreground text-sm'>{formatTokens(total)} tokens</span> </div> <TokenSplitBar tokens={tokens} /> <div className='grid grid-cols-3 gap-2 text-sm'> <div> <div className='text-muted-foreground'>Input</div> <div className='font-medium'>{formatTokens(tokens.input)}</div> </div> <div> <div className='text-muted-foreground'>Cached</div> <div className='font-medium'>{formatTokens(tokens.cached)}</div> </div> <div> <div className='text-muted-foreground'>Output</div> <div className='font-medium'>{formatTokens(tokens.output)}</div> </div> </div> <div className='text-muted-foreground flex justify-between text-sm'> <span>Cache hit rate {Math.round(hitRate * 100)}%</span> <span>Saved {formatUsd(savings)}</span> </div> </CardContent> </Card> )}