The challenge
The founders needed an always-available, emotionally careful AI companion that users could reach by text or by WhatsApp voice note, monetized through subscriptions and cheap enough to run around the clock.
A long, safety-critical system prompt made every message expensive, and the voice channel added latency at every hop.
whisper → “Tonight is hard. Can we talk for a minute?”
I’m here. Let’s take it one step at a time. What’s on your mind?
prompt cache · input tokens≈90% saved
Architecture · 5 stages
- 01
Channels
Web chat and WhatsApp via Twilio
- 02
Transcribe
Whisper speech-to-text
- 03
Converse
Claude with prompt caching and guardrails
- 04
Respond
Text or synthesized voice reply
- 05
Bill
Stripe subscriptions and webhooks
The solution
I built the Node.js/Express backend around Claude with a cache-first prompt structure: stable instructions first, conversation history next, the new turn last. That brought input-token costs down by about 90%, and I logged cache-hit rate as a first-class metric so savings could not silently disappear.
Stripe handles subscriptions, trials and webhook-driven lifecycle events. A WhatsApp voice pipeline receives voice notes through Twilio, transcribes them with Whisper, generates a reply with Claude and returns synthesized speech.
A 12-category automated test suite covers chat logic, sessions, webhooks and security boundaries separately from the audio hops, so a regression in conversation quality cannot hide behind a working audio path.
Engineering highlights
- Prompt caching cut LLM input costs by about 90%
- WhatsApp voice notes in, synthesized voice replies out
- Stripe subscriptions with trials and webhooks
- Safety guardrails in a 24/7 conversational product
- 12-category automated test suite, including security
Technology
- Node.js
- Express
- Claude API
- Stripe
- Twilio
- WhatsApp Business API
- OpenAI Whisper
Related services
Building something similar?
Get a candid view of the architecture, risks and timeline on a free 30-minute call, or ask the AI assistant how this approach would map to your project.