This site is not affiliated with or endorsed by Vercel, Inc. Read the docs, then deploy or run each experiment yourself.
Platform

Usage Meter Lab

Per-session API metering with soft and hard limits backed by Redis/memory counters.

Run this experiment yourself

Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.

Local development

cd apps/experiments/usage-meter-lab
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects.

Usage Meter Lab is a Wave 3 Batch H composition lab. Pure helpers live in logic.ts; missing providers or stores degrade honestly (never fabricate AI output).

Features

  • Soft + hard limits
  • Per-session counters
  • Redis/memory store

API Reference

POST /api/meter · GET /api/meter

{ "sessionId": "demo-1" }
StatusCause
200Allowed / soft warning
429Hard limit
400Missing session

Implementation Details

Validate

Inputs are length-capped in logic.ts; APIs return 400 for missing fields.

Run

Route Handlers compose AI SDK, Redis/Neon, or ImageResponse as documented. Fallbacks include honest notes.

Limitations

  • Not billing-grade metering.
  • No stripe invoices.
  • Demo caps only.

Use in your project

Copy the Route Handler(s) and logic.ts from apps/experiments/usage-meter-lab/.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/usage-meter-lab
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
UPSTASH_REDIS_REST_*NoDurable counters

Next Steps

On this page