Technical Stuff
A transparent look at the systems, safeguards, and choices behind your experience.
The Inner Workings
Hey traveler.
Before you dive in, let's be honest: some of what follows gets a bit technical. Not intimidating… just the kind of behind-the-scenes detail most people never see. But if you're trusting us with your questions, your reflections, your late-night wonderings, then you deserve to know exactly how this place works.
Think of it like walking into the engine room of a ship: quiet hums, clear purpose, nothing to hide. We simply want you to feel grounded and informed as you explore—how tokens work, how data is handled, how Speakers generate responses, and what happens each time you ask a question or save a journal entry.
Skim it or dig in deeply. Either way, a little understanding goes a long way in helping you feel confident inside this space.
Let's look under the hood together.
Contents
Contents
- Frontend: Multi-page app using our in-house design system, consistent layout framework, and markdown-powered documentation.
- Backend: Python/Flask app with REST endpoints, session auth, and energy‑aware middleware.
- Auth & DB: Supabase Postgres for account storage; Flask-managed sessions and password verification with row‑level access controls.
- Inference: Language models via Groq for low‑latency generation.
- Storage: Supabase buckets for user exports and static assets; ephemeral caches for short‑term memory features.
- Observability: Structured logs, request IDs, and rate‑limit events; lightweight usage telemetry (no ad trackers).
- Environments: Local → Staging → Production with environment‑scoped API keys/secrets.
- Inference provider: Groq for all chat completions.
- Default model: Llama 3.1 8B Instant (
llama-3.1-8b-instant)—the everyday workhorse, used as the fallback wherever a request does not specify a model. - Currently available chat models:
llama-3.1-8b-instant— Llama 3.1 8B Instant (short id8b, default)llama-3.3-70b-versatile— Llama 3.3 70B Versatile (short id70b)openai/gpt-oss-120b— GPT‑OSS 120B (short id120b)openai/gpt-oss-20b— GPT‑OSS 20B (short id20b)- Context window: 128k tokens for current Llama tiers, with the same intelligent context management used across all models.
- Where each model shows up: greetings, anonymous welcome chat, summaries, and reflection generation are pinned to Llama 3.1 8B Instant for low latency and cost. Collection analysis (and admin/test flows) can opt into the larger models above.
- Per-speaker tuning: Each persona's
personas/<Name>/config.jsoncarries amodel_settingsblock (e.g. temperature, max tokens, and optionalmodeloverride) so individual Speakers can be tuned without touching app code. - Energy weighting: Different models cost different amounts of conversation energy per raw token, normalized against Llama 3.1 8B Instant (=1.0). Larger / more capable models consume more energy per token from your daily allowance and any prepaid balance.
- Voice (TTS): AI replies can be spoken aloud through the Azure Speech SDK (
/tts/synthesize), with per-speaker neural voice mapping pulled from each persona's voice config. Requires Azure Speech credentials to be configured server-side. - Voice (STT): Voice input uses your browser's built-in Web Speech API where supported—no audio is sent to DiF for transcription.
- Persona Layer: Speaker "voices" are prompt-scoped templates with guardrails and a custom RAG implementation that's constantly under development.
- Determinism: Temperature, max tokens, and stop words are persona-configurable; defaults favor clarity over flair.
We are not affiliated with Groq, OpenAI, Meta, or Microsoft beyond API integration. See Legal Stuff → AI Model Disclosures for details.
DiF uses a token‑metered conversation energy system. Tokens represent real compute usage (input + output). All features and all Speakers are available to everyone—only compute usage is metered.
Daily Free Conversation Energy
Registered users receive a daily free allowance of conversation energy that resets at midnight UTC. Standard non-admin roles currently share the same cap: 250,000 tokens per UTC day. Admin is unlimited; Suspended is 0.
This daily energy supports generous dialogue without requiring a purchase. Prepaid Energy Buckets are optional add-ons when you need more in a day.
Prepaid Energy Buckets
One-time purchases add prepaid tokens. Current SKUs (display names may appear in checkout):
What "1 token" of energy means in DiF
Both your daily allowance and prepaid bucket balances are denominated in Llama 3.1 8B Instant equivalents:
- On the default model (Llama 3.1 8B Instant), 1 prepaid DiF token = 1 raw input/output token at Groq. So a $1 Light Spark covers roughly 1,000,000 raw 8B tokens, a $10 Grand Reserve covers roughly 20,000,000, and so on.
- On other models, each raw model token costs more than 1 DiF token. Roughly speaking: GPT-OSS 20B is a few times the per-token cost of 8B, while Llama 3.3 70B Versatile and GPT-OSS 120B run several times higher per token.
- Practical effect: the same $1 Light Spark stretches much further on 8B than on the larger models. Your Energy Meter / profile view shows the live per-model multiplier so you can see how each choice draws from the same pool.
Prepaid balances persist until consumed; they do not reset on the daily UTC schedule.
When you engage with Speakers, create journal entries, or analyze collections, tokens are deducted first from your daily free allowance, then from prepaid balance.
Energy Meter & Progressive Reminders
The Energy Meter provides real-time tracking of your conversation energy usage across both daily free energy and any active Energy Buckets.
You'll receive gentle reminders as you approach your current energy limit:
- At ~75%: "You've been in deep reflection today 🙏"
- At ~90%: "Today's spiritual dialogue is reaching its close..."
- At ~100%: "Let this be a moment of rest. Return tomorrow with renewed energy."
Reflection Grace
When you reach your conversation energy limit, Reflection Grace allows one final exchange to complete your thought.
We never want to cut off a meaningful conversation mid-reflection.
-
Energy Meter Service
Centralized utilities to read/update usage, check bucket feasibility, and compute progressive messages. -
Energy Bucket Management
Handles prepaid bucket allocation and tracking; integrates with Stripe one-time checkout for token products. -
Energy Gate
A light helper for checking remaining energy before initiating costly calls, ensuring users stay within their bucket limits. -
Guest / welcome chat
Database-backed anonymous sessions (not in-memory only); shared daily guest token budget per visitor (50,000 tokens per UTC day across all active Speakers) and IP-scoped rate limits on welcome endpoints to control abuse and cost.
- Markdown Docs Pipeline: Several pages render from Markdown sources so non‑devs can update copy without code changes.
- Energy Meter Component: Shows percentage used and friendly messages; degrades gracefully if the usage endpoint is not available.
- Collections & Journaling: Client orchestrates multi‑step requests; long‑running work is chunked to avoid timeouts.
- Transport & Storage: TLS in transit; Postgres encryption at rest via Supabase.
- Auth: Supabase Auth sessions + server‑side verification; CSRF tokens for state‑changing requests.
- Headers: Strict HTTP security headers (CSP/HSTS/Frameguard/Referrer‑Policy/Permissions‑Policy) appropriate to our stack.
- Rate Limiting: IP/user scoped; stricter in anonymous routes.
- Audit & Logs: Token operations and admin actions are logged.
- Least Privilege: Admin Supabase client is used only for security‑critical token updates.
For a deeper dive, see the dedicated Security page.
- Journals & Collections: Stored in Supabase; not end‑to‑end encrypted. Exports are user‑initiated.
- Short‑Term Memory: Conversation context persists per session only; no long‑term vectorization without explicit user action.
- PII Handling: Keep sensitive data out of journals. We do not sell or broker user data.
- Configuration: Environment variables control model endpoints, rate limits, and persona defaults.
- Secrets: Managed per‑environment; never checked into source control.
- Health: Startup checks validate DB and inference endpoints; degraded mode disables non‑critical features.
- Impersonation (Test Mode): Admins can simulate different energy bucket configurations for QA with explicit banners and watermarks.
- Feature Flags: Safe rollout for high‑risk features (e.g., new model, new memory mode).
- Incident Response: Basic runbooks for rate‑limit spikes, inference brownouts, and DB hot spots.
- Further purchase options or packaging as the product evolves.
- Speaker APIs for safer external integrations (read-only speaker catalog, capabilities metadata, and versioned persona descriptors).
- Improved analytics for usage forecasting and anomaly detection.
- Optional per‑persona memory vaults with explicit consent.
- Caching and retry strategies for bursty group chats.
- Energy Buckets & Conversation Energy — bucket sizes, energy tracking, API and management services.
See: energy meter, progressive messages, and/api/user/token-usage. - Platform Philosophy — "no artificial paywalls", all features available to everyone, and UI copy conventions.
Infra questions or bug reports: dialogsinfaith@gmail.com