← Portfolio Case Study

AI Consultation System — two-tier sales funnel

Klient: Internal project Czas: 1 day
Astro Claude AI Stripe Supabase Resend Vercel TypeScript

Before

  • Classic contact form — zero qualification
  • Client sent email and waited for response
  • No filtering — low-budget inquiries consumed time
  • No client data before first conversation

After

  • AI qualifies leads 24/7 — BANT + education
  • Client gets immediate bot conversation
  • Premium at 200 PLN — only serious clients pay
  • Before the call Artur has full JSON summary + transcript

Starting point

A portfolio site with a contact form. Standard flow: client fills out the form, waits for a reply, gets an email in 24-48h. The problem — 80% of inquiries were either low-budget projects or vague briefs with no specifics. Time spent on manual qualification is time lost on delivery.

The idea

Replace the form with an AI conversation that gathers data, qualifies the client, and generates a structured summary. Two tiers:

  • Free conversation (Haiku): 16 exchanges, BANT qualification for B2B or education needs analysis. Cost per session: pennies.
  • Premium consultation (Opus): 25 exchanges for 200 PLN, in-depth technical analysis with architectural frameworks. The 200 PLN is deducted from the project quote.

Architecture

The system consists of 6 API endpoints (Astro SSR on Vercel Functions), 2 Claude models, a Supabase database (sessions + messages), and Stripe + Resend integrations.

Free session flow

Client clicks "Start conversation" — the system generates a UUID session, creates a record in Supabase, and launches Claude Haiku. The bot runs qualification in 16 exchanges. After completion, a contact form appears (email + phone). Once submitted: Artur receives the full transcript + JSON summary, the client gets a formatted summary with key data + a thank-you note.

Upgrade to premium

Clients can go premium directly from the landing page or after a free conversation. The system stores free_session_id in Stripe Checkout metadata. After payment, the webhook creates a premium session in Supabase with the link. Opus receives the free conversation summary in the system prompt — it won't re-ask things the client already described.

Early finish

Premium clients can click "Finish and generate summary" at any point. The system generates JSON based on the conversation so far and sends emails.

Prompt engineering

The biggest challenge wasn't code — it was the prompts. Key rules that required iteration:

  • Identity: The bot must refer to Artur in third person. Without this, Claude naturally switches to "I" and impersonates Artur.
  • Language: Pure Polish (or English) — no mixing. Technical English terms only if the client uses them first.
  • Don't guess: The bot never quotes prices or timelines. It says "Artur will assess after analysis" rather than risking a commitment to low margins or tech debt.
  • Formatting: Plain text, no markdown. Bold and italic render as raw asterisks in the chat UI.

Economics

Free session (Haiku): pennies per conversation. Premium (Opus): worst case at 25 exchanges with 4096 tokens each is ~$34 cost from $50 revenue. Realistically: ~$10 cost, yielding 80%+ margin. Rate limit of 2 free sessions per IP per day prevents abuse.

Stack

  • Astro 6.0: SSG for static pages + SSR for API. Zero unnecessary JS on the frontend.
  • Claude Haiku 4.5: Free qualification. 512 tokens/response, 16 messages.
  • Claude Opus 4.6: Premium analysis. 4096 tokens/response, 50 messages, full history.
  • Stripe Checkout: 200 PLN payment, webhook for session creation.
  • Supabase: PostgreSQL with RLS. Tables: sessions + messages.
  • Resend: Transactional emails — summaries, transcripts, thank-yous.
  • Vercel: Hosting + Functions. Deploys in seconds.

Result

The system runs 24/7. Clients get an immediate conversation instead of a form. Artur receives a qualified lead with full context — problem, technologies, budget, timeline, scale. Premium clients pay 200 PLN for in-depth analysis, deducted from the project quote. The entire system was built in 1 day.

Technical article

How I built a two-tier AI consultation system in 1 day

Read article →

Have a similar problem?

Describe it to AI — it gathers technical context, Artur delivers a quote in 48h.

Start diagnostics