SPB Git forge

spb/ai-atlas

Public
41commits 1branches 0releases
4.6 MBsize
maindefault branch
12 days agolast push
HTML 77.2% TypeScript 10.5% Python 9.6% JavaScript 2.5%
1.2 KB · 25 lines tsx
Raw Blame History
1import { ImageResponse } from 'next/og';2import { Wallpaper } from '@/components/brand/og';3import { intel, safe } from '@/lib/api';4import { fmtInt, fmtUsdPerM, num } from '@/lib/format';5import { SITE_NAME } from '@/lib/site';67export const runtime = 'nodejs';8export const alt = `AI Price Index on ${SITE_NAME}`;9export const size = { width: 1200, height: 630 };10export const contentType = 'image/png';1112export default async function PricesOgImage() {13  const idx = await safe(intel.priceIndex(30));14  const latest = (idx?.series ?? []).filter((p) => num(p.median_input) !== null || num(p.median_output) !== null).at(-1);15  const counters: [string, string][] = latest16    ? [17        ['Median input / 1M', fmtUsdPerM(latest.median_input)],18        ['Median output / 1M', fmtUsdPerM(latest.median_output)],19        ['Models priced', fmtInt(latest.models)],20        ['Current offers', fmtInt(latest.offers)],21      ]22    : [];23  return new ImageResponse(<Wallpaper eyebrow="Price history terminal" title="AI Price Index" subtitle="USD per 1M tokens, day by day, across every provider offer — medians, distribution, movers, listings and every offer with its history." counters={counters} footer="www.ai-atlas.co/prices" markPx={240} />, { ...size });24}25