Skip to content

AkashB29/finbot

Repository files navigation

FinAdvisor — Personal Finance Chatbot

A domain-specific LLM chatbot powered by Google Gemini 1.5 Flash (free tier). It answers only personal finance and budgeting questions — all other topics are refused by the system prompt.


Getting your free Gemini API key

  1. Go to https://aistudio.google.com/app/apikey
  2. Sign in with your Google account
  3. Click "Create API Key"
  4. Copy the key

Free tier limits (no credit card needed):

  • 15 requests per minute
  • 1,500 requests per day
  • 1 million tokens per minute

Setup

1. Add your API key

Open .env.local and replace the placeholder:

GEMINI_API_KEY=your_actual_key_here

2. Install dependencies

npm install

3. Run the development server

npm run dev

4. Open in browser

http://localhost:3000

Build for production

npm run build
npm start

How it works

Domain restriction

The system prompt sent to Gemini strictly defines the allowed topics:

  • Budgeting and expense tracking
  • Saving strategies and emergency funds
  • Debt management (avalanche, snowball methods)
  • Investing basics (index funds, ETFs, retirement accounts)
  • Credit scores and credit health
  • Financial planning (net worth, FIRE, insurance basics)
  • Tax basics as they relate to personal finance

If a user asks anything outside this domain, the system prompt instructs Gemini to respond with a fixed redirect message and nothing else.

API architecture

  • The Gemini API call happens in a Next.js API route (app/api/chat/route.ts) — server-side only
  • The API key is never exposed to the browser
  • Full conversation history is sent on each request so Gemini maintains context

Model settings

  • Model: gemini-1.5-flash (fastest, free tier)
  • Temperature: 0.4 (precise, low variability)
  • Max output tokens: 1024

Project structure

finbot/
  app/
    page.tsx              ← frontend UI
    layout.tsx            ← root layout
    globals.css           ← base styles
    api/
      chat/
        route.ts          ← Gemini API call + system prompt
  .env.local              ← your API key goes here (never commit this)
  package.json
  next.config.js
  tsconfig.json
  tailwind.config.js
  postcss.config.js
  .gitignore
  README.md

About

LLM-Based Personal Finance Chatbot – An intelligent finance assistant built with Next.js and Groq LLM API that provides structured guidance on budgeting, saving, debt management, and basic investing within a restricted domain.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors