S SwapToSaaS

Client work · SaaS platform build

A production API gateway, forked and wired to Stripe inside a delivery cycle

llmrelay.dev is an OpenAI-compatible API gateway. Prepaid credit. No subscription. Every major model available — Claude, GPT, Gemini — priced at roughly 50% off Anthropic list.

This one isn't a marketing site. It's a real SaaS product with live payments, a running database, live customer traffic, and margins the operator can actually reconcile. The whole thing was built inside a normal AgentValet delivery cycle.

Public artefact: llmrelay.dev/pricing — the operator hasn't published a full behind-the-scenes page for this one yet; below is the AgentValet side.

What "SaaS platform, delivered" looked like

  • 1. Fork the base. QuantumNous/new-api on GitHub, Go + React (TanStack Router). Clean fork on a 2 vCPU / 4 GB VPS. Docker Compose stack: new-api + postgres:16-alpine + redis:7-alpine behind Caddy TLS.
  • 2. Patch the hidden-prompt exploit. The upstream relay was silently injecting a 5,968-token system prompt on every request, double-billing customers. We wrote a fork-level neutraliser at service/llmrelay_hidden_prompt.go that rewrites usage.prompt_tokens and kills the sunk-cost double-count.
  • 3. First-topup affiliate commission. Added a users.has_first_topup column via GORM AutoMigrate, wired an awardFirstTopUpCommission helper into all five recharge paths (Stripe, Creem, Waffo, WaffoPancake, Manual). Retry-safe SELECT ... FOR UPDATE. Commissions expressed in permyriad (basis points × 10) so 5%, 7.5%, 15% all work without a schema change.
  • 4. Paid-user-only invite gate. Modified GetUserIdByAffCode so unfunded accounts' affiliate links silently no-op. Prevents freeloader referral chains before they start.
  • 5. Live payment stack. Stripe live keys, webhook signature verified against a real $5 test payment. Resend SMTP for verification emails from [email protected].
  • 6. Marketing site. Separate Astro build on Cloudflare Pages at llmrelay.dev — pricing, docs, signup, embed guide, FAQ, legal.

Why this is a case study, not just a project

Standing up a real payments-bearing SaaS — forked codebase, database migrations, five payment paths, affiliate module, live TLS, marketing site — is traditionally a 6-figure engineering engagement. Frontend dev + backend dev + DevOps + designer + copywriter — even at freelance rates, ~$40–60k and 3–6 months.

This one shipped inside an AgentValet delivery cycle. The engineering was AI-executed, human-supervised. Every code path was reviewed against the operator's business rules before it went live — hidden-prompt handling, affiliate awards, and the pricing verification math all got a same-day audit trail the operator can still read in the memory file today.

What runs it today

host        2 vCPU / 4 GB VPS (single node)
api         api.llmrelay.dev  ← Caddy → 127.0.0.1:3000
db          llmrelay-postgres (16-alpine)
cache       llmrelay-redis (7-alpine)
image       llmrelay/new-api:llmrelay-hidden-prompt
payments    Stripe live + Resend SMTP
site        llmrelay.dev (Astro on CF Pages)

Want to launch a real product?

If you have a codebase to fork, a business model to wire up, and a payments processor to connect — AgentValet is the pattern.

See AgentValet plans →