Context
was shipping side projects and every new LLM provider meant another dashboard, another invoice, another SDK. The idea: what if it all looked like OpenAI from the client's perspective, and the routing happened somewhere else?
What I built
A Next.js edge-runtime proxy that speaks the OpenAI `v1/chat/completions` dialect and translates, per request, to whatever provider the user selects. Streaming works end-to-end (SSE tunnelled through edge functions). Every request is logged to Postgres with token counts, latency, and cost; users get a live dashboard of spend. Prepaid billing runs on Stripe — top up any amount, pay cents per 1K tokens, no lock-in.
Decisions worth calling out
Edge runtime keeps latency under 150ms added overhead globally. The provider adapter layer is a thin set of TypeScript modules — adding a new model takes ~30 lines. Fallback chains are expressed declaratively ("prefer GPT-5, fall back to Sonnet 4.6 on error") and execute in-memory so a single user request never hits us twice. Rate limiting runs on Upstash Redis with per-key sliding windows.
Outcome
PixCode runs in production serving indie developers, agencies, and a handful of Chinese teams that can't reach OpenAI directly. Breaking even on infrastructure month two; SDK compatibility means onboarding a new customer is one `baseURL` change in their existing code.
