Build a Micro-SaaS Around an AI API: A Full Playbook
7 min read · Updated Jun 4, 2026
Building an AI micro-SaaS isn’t about the AI — it’s about a tightly-scoped product that solves one expensive problem for one specific audience, priced so the model API cost is a rounding error against your price. This guide ships the actual stack (Next.js + Stripe + Supabase + OpenAI), the unit economics that work (and the pricing model that doesn’t — don’t do per-seat), the pre-launch checklist, and — critically — the part most "how to ship in 7 days" guides skip: what kills micro-SaaS between $2k and $10k MRR.
Key takeaways
- Pick a specific audience (real estate listing copy, recruiter outreach, SaaS changelog writer) — NOT "AI for marketing."
- Default stack: Next.js + Supabase + Stripe + OpenAI = ~$50/mo until ~200 paying users.
- Price by VALUE, not API cost. $29/mo for ~$0.50 of API costs is normal, healthy, and how the unit economics work.
- Use credit-based or usage-tier pricing for AI tools — per-seat collapses at scale because power users disproportionately consume tokens.
- Build moat that isn’t the prompt. Anyone can copy a prompt. Workflow integration, your specific training data, and trust take real time.
The stack that ships
| Layer | Tool | Cost | Why this one |
|---|---|---|---|
| Frontend + API | Next.js 15 on Vercel | $0 (Hobby) → $20/mo (Pro) | Edge functions for streaming, App Router, free until 100GB bandwidth |
| Database + Auth | Supabase | $0 → $25/mo (Pro) | Postgres + Auth + Storage + Edge Functions in one |
| Payments | Stripe Checkout + Billing Portal | 2.9% + 30¢ (no monthly fee) | Hosted checkout = compliant in minutes, billing portal lets users self-manage |
| LLM | OpenAI GPT-4o-mini | $0.15/M in, $0.60/M out | Cheap, fast, good enough for 95% of tasks. Add Claude only when needed |
| Emails | Resend | $0 free → $20/mo | React Email templates, simple API, much better DX than SendGrid |
| Analytics | PostHog | $0 (1M events/mo free) | Product analytics + session replay + feature flags in one |
The pricing model that actually works (and the one that breaks)
Per-seat pricing is what most SaaS does. For AI products it breaks because token consumption is wildly uneven — your top 20% of users consume 70% of the tokens. A flat $29/seat means you lose money on power users and overcharge casual ones. Use credit-based (1,000 generations = $29) or tier-based with usage limits (Starter: 50 generations/mo $19; Pro: 500 generations/mo $79). Stripe Billing’s metered usage handles both natively.
Unit economics: a worked example
| Item | Per user / month | At 100 users |
|---|---|---|
| Revenue | $29.00 | $2,900 |
| OpenAI cost (GPT-4o-mini, ~2000 tokens/generation × 100) | ~$0.30 | $30 |
| Stripe fee (2.9% + 30¢) | $1.14 | $114 |
| Hosting (Vercel + Supabase + Resend) | ~$0.65 | $65 total infra |
| Gross margin / user | ~$26.91 | $2,691 (~93%) |
The minimum API + DB schema
-- Supabase / Postgres schema. Run once.
create table profiles (
id uuid primary key references auth.users(id),
email text not null,
plan text not null default 'free', -- free | starter | pro
credits_remaining int not null default 5, -- free-tier credits
stripe_customer_id text,
stripe_subscription_id text,
created_at timestamptz default now()
);
create table generations (
id uuid primary key default gen_random_uuid(),
user_id uuid references profiles(id) not null,
input jsonb not null,
output text not null,
input_tokens int not null,
output_tokens int not null,
cost_usd numeric(8,4) not null, -- real cost so you can see margin per user
created_at timestamptz default now()
);
create index generations_user_created_idx on generations(user_id, created_at desc);
-- RLS so users only see their own generations
alter table generations enable row level security;
create policy "users see own generations" on generations
for select using (auth.uid() = user_id);// app/api/generate/route.ts — the one endpoint that matters
import { createClient } from "@/utils/supabase/server";
import OpenAI from "openai";
const openai = new OpenAI();
export async function POST(req: Request) {
const supabase = createClient();
const { data: { user } } = await supabase.auth.getUser();
if (!user) return new Response("Unauthorized", { status: 401 });
// 1. Check credits BEFORE calling OpenAI
const { data: profile } = await supabase
.from("profiles")
.select("credits_remaining, plan")
.eq("id", user.id)
.single();
if (!profile || profile.credits_remaining < 1) {
return new Response("No credits remaining", { status: 402 });
}
const { propertyDetails } = await req.json();
// 2. Call OpenAI
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
{ role: "system", content: "You write compelling 200-word real-estate listing copy." },
{ role: "user", content: JSON.stringify(propertyDetails) },
],
max_tokens: 400,
});
const output = completion.choices[0].message.content ?? "";
const { prompt_tokens, completion_tokens } = completion.usage!;
const costUsd = (prompt_tokens / 1_000_000) * 0.15 + (completion_tokens / 1_000_000) * 0.6;
// 3. Atomically deduct credit + log generation
await Promise.all([
supabase.from("generations").insert({
user_id: user.id,
input: propertyDetails,
output,
input_tokens: prompt_tokens,
output_tokens: completion_tokens,
cost_usd: costUsd,
}),
supabase.rpc("decrement_credits", { p_user_id: user.id }),
]);
return Response.json({ output });
}The story that taught me to price by value, not API cost
March 2024, Wednesday morning. A developer I was advising had launched an AI cover-letter writer for job-seekers. He’d done the maths "honestly" — each generation cost him $0.008 on GPT-3.5, so he priced at $0.10 per cover letter "for a 12x markup". Volume was decent: ~300 generations/day, ~$30/day gross, ~$24/day after Stripe + hosting = ~$720/month profit. Decent, not amazing. I asked him what a cover letter was worth to his customers. He didn’t know. We surveyed 40 users with one question: "If this service didn’t exist, what would you have done?" 38/40 said either "spent 1–2 hours writing it myself" or "paid someone on Fiverr $25–$50 to write it." So the value was $25–$50, not $0.10. He raised price to $9 for 5 cover letters ($1.80 each) the following Monday. Volume dropped 60% (from 300/day to ~120/day). Revenue: 120 × $1.80 = $216/day = ~$4,800/month after costs. 6.6x more profit on 40% the volume. The lesson he kept repeating: "I was pricing my time, not their problem." Three months later he raised to $19/5 ($3.80 each) and revenue went up again because the higher price filtered to more serious customers who actually applied for jobs (and renewed). API cost was never the relevant number; value to the user was.
What kills micro-SaaS between $2k and $10k MRR
- Retention collapse in month 2–3. Users get the value, generate their backlog of work, then have nothing to do. Fix: add ongoing value (templates that update monthly, integration with their workflow, analytics on their use).
- Per-seat pricing breaking at scale. Power users devour tokens, casual users overpay. Move to credit-based BEFORE you hit $5k MRR or it gets ugly to migrate.
- Prompt copying. Three weeks after you launch, a competitor offers the same thing at half the price. Build moat in workflow integration, your specific training/example data, and brand trust — not the prompt itself.
- OpenAI shipping the feature. If your entire product is "ChatGPT with a nicer UI for X," OpenAI’s next release may eat your lunch. Build for workflows, integrations, and verticals where OpenAI can’t move — not generic chat replacements.
- Customer support eating your time. At $5k MRR you’re fielding 30+ support tickets/week and have no time to build. Add an obvious "talk to docs / FAQ chatbot" before this kills your roadmap.
Pre-launch checklist
- Rate-limit your /api/generate endpoint (Upstash Ratelimit or a Redis token-bucket). LLM endpoints attract abuse fast.
- Cap max_tokens server-side. Set a per-plan ceiling so a malicious prompt can’t generate forever.
- Log per-request cost to a generations table (schema above). Without this you can’t spot the abusive user before they cost you $300.
- Set up Stripe Customer Portal so users self-cancel — friction here generates support tickets, not retention.
- Add an OpenAI usage alert at 2x your forecast. Catches runaway costs early.
- Write 3 onboarding emails (welcome, day 3 "did you try X?", day 7 "here’s how power users do it"). Onboarding emails drive 30%+ of activation.
The opinion I will defend
“The fastest way to die as an AI micro-SaaS is to be a thin wrapper around ChatGPT. The fastest way to live is to be the workflow your customer can’t imagine working without.”
Frequently asked questions
Frequently asked questions
How much money do I need to start an AI micro-SaaS?
Under $100/month in tooling for pre-revenue: Vercel Hobby (free), Supabase free tier, Stripe (no monthly fee), $20 OpenAI credit, $15 domain. Plus your time. The "shipping cost" is the lowest in SaaS history; the bar is execution and pick of niche, not capital.
Should I use Next.js or something else?
Next.js + Vercel is the path of least resistance — React component ecosystem, edge functions for streaming, deploy in a git push. Alternatives (Remix, SvelteKit, Astro + a server) are fine if you already know them. Don’t learn a new framework to ship a micro-SaaS; use what you can ship fastest.
What if OpenAI ships my feature natively?
Real risk for generic chat-wrapper products. Defence: pick a vertical OpenAI doesn’t (real estate copy, legal-clause analysis, sales-call summarisation for outbound SDRs), integrate deeply with your customer’s workflow (Pipedrive, HubSpot, Slack, their CRM), and accumulate their data over time. OpenAI can’t ship a CRM integration the way a focused SaaS can.
How do I find my first 100 customers?
Direct outreach + 1 community per week, for ~12 weeks. Where YOUR niche hangs out (subreddits, FB groups, Discord servers, X). Show before-after results. Offer free credits in exchange for video feedback. Product Hunt + Hacker News are bonuses, not strategies. SEO becomes the dominant channel only after ~6 months of consistent content.
When should I hire?
First hire at ~$8k MRR is usually a part-time customer-success/support person, not an engineer. Support is eating your time before code complexity is. Engineers second, around $15k MRR or when you literally cannot ship features fast enough. Avoid hiring "to grow" — hire to remove specific bottlenecks.
Should I open-source it?
Almost certainly no for a micro-SaaS aimed at non-developers. Your moat is convenience, integrations, and trust — not the code. Open-sourcing helps developer-tool SaaS (where users want to self-host or fork) and hurts everyone else.