Live + historical pricing for every major LLM and subscription plan.
- Web app: TanStack Start SSR running as a Cloudflare Worker.
- Daily scraper Worker pulls 300+ models from OpenRouter into D1.
- Fixed-plans Worker pre-computes the effective
$/Mvalue of subscription plans (Claude Max, ChatGPT Pro, Gemini Advanced, …) at four usage profiles. - Wayback backfill fills
priceswith monthly snapshots back to 2023.
src/ TanStack Start app (UI + server functions + JSON API)
src/server/db Drizzle schema + D1 client + KV cache helpers
src/server/fn Server functions consumed by route loaders
src/server/backfill Wayback Machine one-time backfill
workers/scraper Cron Worker — OpenRouter → D1
workers/fixed-plans Cron Worker — recalculates plan_values nightly
migrations/ 0001_init.sql + seed.sql (generated by scripts/seed.ts)
scripts/seed.ts Generates an idempotent seed.sql from seed-data.ts
sst.config.ts SST Ion infra (D1 + KV + Workers + cron + custom domain)
pnpm install
# 1. Provision D1 + KV (one-time)
pnpm wrangler d1 create llm-prices-db
pnpm wrangler kv namespace create CACHE
# → copy each printed id into wrangler.jsonc and the two workers/*/wrangler.jsonc
# 2. Apply schema
pnpm wrangler d1 execute llm-prices-db --local --file=migrations/0001_init.sql
pnpm wrangler d1 execute llm-prices-db --remote --file=migrations/0001_init.sql
# 3. Generate + apply seed
pnpm db:seed
pnpm db:seed:apply:local
pnpm db:seed:apply:remotepnpm dev # TanStack Start + local D1/KV via Miniflare
pnpm typecheck# Set secrets once (SST Ion reads these via `sst.Secret`)
pnpm sst secret set AnthropicApiKey sk-ant-...
pnpm sst secret set BraveApiKey BSA...
pnpm sst secret set AdminSecret $(openssl rand -hex 32)
# Deploys the SSR Worker, both cron Workers, D1, KV, and DNS
pnpm deployAfter the first deploy:
curl -X POST https://llmprices.davidbroza.dev/api/admin/backfill \
-H "X-Admin-Secret: $ADMIN_SECRET" \
-H "Content-Type: application/json" \
-d '{"fromDate":"20230601"}'GET /api/modelsGET /api/models/:id/history?months=24GET /api/runs
CORS: open. Cached at the edge for 5 minutes.
Edit workers/fixed-plans/plans.ts. Both the calculator UI and the nightly
cron read from the same source, so changes take effect on the next run (or
immediately on pnpm dev).