Chapter 9

Capstone: Workshop Co. AI Plan

FAQ bot scope, API choice, token budget, hosting decision.

Capstone objectives

  • Document scope, architecture, and token budget for an FAQ assistant
  • Choose deployment model with Canadian privacy rationale
  • Deliver system prompt + sample API payload

The brief

Workshop Co. — FAQ assistant v1

Users
Website visitors, ~200 chats/month peak
Data
Public class schedule only in v1 — no login
Budget
$30 CAD/month all-in (API + hosting)
Must not
Hallucinate dates; leak staff credentials; store chats > 30 days

Part 1 — architecture (one paragraph)

Describe: widget → your backend → schedule API/JSON → LLM API → response. Where do tokens get counted?

Model answer

Browser widget POSTs user message to https://workshopco.ca/api/faq (Nginx → small Node/PHP service). Backend loads cached classes.json (refreshed hourly from DB), builds messages array (system + schedule snippet + user), POSTs to LLM API. Token usage read from API response headers/body; logged daily. No direct browser → LLM call (hides API key).

Part 2 — token budget table

Fill monthly estimate: 200 chats, 600 input + 250 output tokens average.

Calculation
Input:  200 × 600  = 120,000 tokens/month
Output: 200 × 250  =  50,000 tokens/month

Illustrative API cost: well under $1
Remaining budget: VM share, monitoring, Marcus time

Part 3 — sample API payload

Model JSON (OpenAI-style chat)
POST /v1/chat/completions
{
  "model": "gpt-4o-mini",
  "max_tokens": 300,
  "messages": [
    {"role": "system", "content": "You are Workshop Co. FAQ..."},
    {"role": "user", "content": "CLASS_DATA: [{\"date\":\"2026-03-14\",...}]\n\nQuestion: beginner class in March?"},
  ]
}

Part 4 — go / no-go checklist

  • System prompt reviewed for injection resistance
  • Rate limit: 20 messages/IP/hour
  • Privacy notice linked under widget
  • Fallback to email if API down
  • Owner sign-off on cloud vs Canadian self-host

Book 8 complete

You connect infrastructure to the AI layer: APIs for automation, tokens for budgeting, context for reliability, and prompts for safety. The full Swift Host series now spans DNS → cloud → AI literacy.

Refine as you read

These chapters are living docs — tell us which sections to expand (RAG setup, Ollama on Proxmox, specific vendor comparisons).

Send feedback