Inspiration

The average American carries over $104,000 in debt. I watched friends and family juggle credit cards, student loans, and medical bills with no real plan, just minimum payments and stress. Existing tools either oversimplify or gatekeep. I wanted to build something that combines real financial math with AI-powered coaching. Free, personalized, and accessible to anyone with a browser.

What it does

DebtFree is an AI financial freedom agent that takes your full debt picture and builds a personalized path out. It:

  • Compares 4 payoff strategies (avalanche, snowball, cash flow index, hybrid) using exact amortization math
  • Runs Monte Carlo simulations (500+ scenarios) to forecast your payoff timeline under real-world uncertainty: income variability, unexpected expenses, missed payments
  • Generates creditor negotiation letters tailored to your specific debts for lowering rates, settling balances, requesting hardship accommodations, waiving fees, or removing negative marks
  • Creates a 6-month action plan with monthly milestones and exports it as a styled PDF
  • Offers an AI voice coach you can talk to about your finances using natural speech
  • Simulates what-if scenarios — "What if I pay an extra $200/month?" or "What if I get a $5,000 bonus?"

How I built it

Backend: Python/Flask with 6 AI agent modules and 4 pure-Python financial calculators. The math engines have zero LLM dependency they use exact formulas:

$$ M = P \cdot \frac{r(1+r)^n}{(1+r)^n - 1} $$

where \( P \) is principal, \( r \) is monthly rate, and \( n \) is total payments. Strategies run month-by-month simulations with freed-minimum cascading (when a debt is paid off, its minimum payment rolls into the next target).

Monte Carlo forecasting perturbs each simulation with:

  • Income variability: \( \pm 15\% \) random fluctuation
  • Unexpected expenses: \( 5\% \) monthly probability
  • Missed payments: \( 3\% \) chance per month
  • Rate changes: \( 2\% \) chance of \( \pm 1\text{-}3\% \) APR shift

AI Layer: OpenAI GPT-4o powers the coaching, strategy explanations, action plans, and negotiation letters. Whisper handles speech-to-text and TTS provides voice responses. Every LLM feature has a pure-Python fallback the app works fully offline without an API key.

Frontend: Tailwind CSS with a custom design system (glass cards, ambient orbs, animated freedom ring), Chart.js for interactive visualizations, and vanilla JavaScript.

Database: SQLite with session-based storage.

Challenges I faced

  • Math precision vs. AI hallucination: Early on, GPT-4o would confidently give wrong payoff timelines. I solved this by separating concerns. Pure Python handles all calculations, and the LLM only explains results it didn't compute. The AI never does math.
  • Monte Carlo performance: Running 500+ full debt simulations in a web request was slow. I optimized by pre-computing strategy sort orders and minimizing deep copies.
  • Voice latency: The Whisper → GPT-4o → TTS pipeline added noticeable delay. I added streaming indicators and kept responses concise to minimize perceived wait time.
  • Fallback architecture: Making every feature work with AND without an API key meant building two implementations for each agent. The template-based fallbacks had to feel useful, not broken.

What I learned

  • Separation of concerns matters: Keeping financial math in pure Python and AI in separate agents made debugging dramatically easier and eliminated hallucinated numbers
  • Demo profiles save demos: Pre-built personas meant I could show the full product in seconds without manual data entry
  • Fallbacks aren't optional: API rate limits hit at the worst times. Having offline-capable math engines meant the core product always worked
  • Design sells the tech: The same calculations feel completely different when presented with confidence bands and animated charts versus raw numbers in a table

Built With

Share this project:

Updates