Taco Tuesday — AI Gateway Course Demo

The ordering assistant for a taco truck that went viral and now spends real money on every request. This is the shared demo app for every lesson in Using AI Gateway in Production.

Two AI features, on purpose (they have different cost profiles, which several lessons compare):

  • Order chat — POST /api/order, streaming, cheap fast model, the full menu rides along as instructions on every request. High volume, latency-sensitive. The production workhorse.
  • Daily special generator — pnpm describe-special, pricier creative model, runs occasionally. The contrast feature for spend tracking and provider routing.

Deploy

No environment variables needed on Vercel: AI Gateway authenticates deployments with OIDC automatically. The API key below is only for local development.

Local development

pnpm install
cp .env.example .env.local   # add your AI Gateway API key (local only)
pnpm dev                     # order window at localhost:3000

The per-lesson scripts load .env.local automatically (they run through node --env-file-if-exists), so the same key covers the app and every pnpm <script> command below.

Per-lesson scripts

ScriptLesson
pnpm one-key1.1 why AI Gateway
pnpm existing-stack1.2 works with your stack (OpenAI SDK)
pnpm switch-models1.3 switch models fast
pnpm outage-drill1.4 survive an outage
pnpm migrated-stack1.5 migrate from OpenAI SDK
pnpm latency-guard1.6 fail over on latency
pnpm pin-provider1.7 pin a provider
pnpm cost-check2.1 How Is AI Gateway Priced?
pnpm route-cheapest2.2 route to the cheapest provider
pnpm cache-check2.3 cut costs with caching
pnpm whose-key2.6 bring your own keys
pnpm private-prompts3.2 keep prompts private
pnpm tag-orders3.5 spend per feature/user
pnpm describe-special3.5 spend per feature (the truck's second feature)