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.
- Go to https://aistudio.google.com/app/apikey
- Sign in with your Google account
- Click "Create API Key"
- Copy the key
Free tier limits (no credit card needed):
- 15 requests per minute
- 1,500 requests per day
- 1 million tokens per minute
Open .env.local and replace the placeholder:
GEMINI_API_KEY=your_actual_key_here
npm installnpm run devhttp://localhost:3000
npm run build
npm startThe 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.
- 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:
gemini-1.5-flash(fastest, free tier) - Temperature: 0.4 (precise, low variability)
- Max output tokens: 1024
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