đź§ Automating Firefly III Categorization with Node-RED and Lightweight AI
Managing personal or business finances in Firefly III can get tedious when every new transaction requires a manual category and budget. What if your finance app could intelligently tag these for you - instantly and without setting up an automation for each one?
That’s exactly what this guide will show you: how to use Node-RED and a lightweight AI model (like Phi-3 Mini or Mistral 7B) to automatically assign categories and budgets to new Firefly III transactions.
⚙️ The Goal
We’ll build a real-time automation that:
- Listens to Firefly III webhook events
- Checks if the transaction is a withdrawal
- Uses a small, OpenAI-compatible LLM to suggest a category and budget
- Updates Firefly III with those values
- Tags the transaction as
ai-assisted
No heavy cloud models or GPU power needed — this can run on a Raspberry Pi or home server.
đź§© Tech Stack
- Firefly III (self-hosted finance manager)
- Node-RED (flow-based automation)
- Lightweight LLM (Phi-3 Mini, Mistral, or LLaMA 3.1 8B)
- OpenAI-compatible endpoint (local Ollama or LM Studio)
🔌 The Flow
Here’s the overview:
- Firefly III Webhook → triggers on new or updated transactions.
- Node-RED HTTP In node receives the webhook payload.
- Logic function checks for missing category/budget.
- Fetch categories and budgets from Firefly III API.
- Send transaction details to the AI model using OpenAI
/v1/chat/completionsformat. - Update Firefly III with the AI’s suggested category, budget, and an
ai-assistedtag.
đź§ Why Use a Lightweight Model?
Most classification tasks — like deciding whether “Starbucks” belongs under Coffee or Dining Out — don’t require large LLMs.
A compact model like Phi-3 Mini or Mistral 7B Instruct is perfect: small, fast, and locally deployable.
Example compatible engines:
| Model | Strength | Memory | API-Compatible |
|---|---|---|---|
| Phi-3 Mini | Lightweight, CPU-friendly | <2GB | âś… |
| Mistral 7B Instruct | Stronger reasoning | ~6GB | âś… |
| LLaMA 3.1 8B | Accurate, GPU recommended | ~8GB | âś… |
🚀 Node-RED Flow
You can import this JSON flow directly into Node-RED.
It listens for new Firefly transactions and enriches them automatically.
👉 View the complete flow on GitHub
Each time a transaction webhook arrives:
- Node-RED gets category & budget lists via the Firefly API.
- Builds a classification prompt.
- Calls your AI endpoint using an OpenAI-compatible API.
- Updates the transaction with the model’s suggestions.
All updated records are tagged ai-assisted for transparency and potentially future review.
đź§° Setup Instructions
- Import the Flow in Node-RED → Menu → Import → Clipboard.
- Replace placeholders:
YOUR_FIREFLY_URLYOUR_FIREFLY_TOKENYOUR_LLM_API(e.g.http://localhost:11434/v1)YOUR_LLM_TOKENif needed
- In Firefly III, create a webhook:
- URL:
http://your-node-red-host:1880/firefly/webhook - Events:
transaction_journal_created,transaction_journal_updated
- URL:
- On your ollama node, run the model via the command
ollama run phi3:instruct
Altenatively to the web hooks in firefly iii, if you have already followed this tutorial, you can simply add a "link out" from the existing webhooks, and a "link in" to the start of the new flow.
That’s it — Firefly III now has an AI-powered assistant classifying your spending.
🪶 Example Prompt
Transaction: Starbucks Coffee
Amount: 5.20
Notes: morning latte
Available Categories: Dining, Groceries, Coffee, Utilities
Available Budgets: Food, Entertainment, Essentials
Return ONLY:
Category: Coffee | Budget: Foodđź§© Optional Upgrade: Model Selection
You can easily add a decision node in Node-RED to select the best model based on system resources:
- Use
phi-3-miniwhen memory is limited - Switch to
mistral-7borllama-3.1-8bwhen GPU power is available
This makes your automation flexible across environments.
đź”’ Privacy & Control
All AI processing stays within your environment — no cloud dependencies required.
You decide where your data goes and how it’s processed.
âś… Final Thoughts
This small automation bridges self-hosted finance with local AI intelligence.
It saves time, maintains privacy, and adapts to your system’s capabilities.
If you’re already using Node-RED and Firefly III, adding this AI layer takes your setup from organized to intelligent.
Have questions or improvements? Drop a comment below or reach out to me on any of my socials.
About the author
Tim Wilkes is a UK-based security architect with over 15 years of experience in electronics, Linux, and Unix systems administration. Since 2021, he's been designing secure systems for a telecom company while indulging his passions for programming, automation, and 3D printing. Tim shares his projects, tinkering adventures, and tech insights here - partly as a personal log, and partly in the hopes that others will find them useful.
Want to connect or follow along?
LinkedIn: [phpsytems]
Twitter / X: [@timmehwimmy]
Mastodon: [@timmehwimmy@infosec.exchange]
If you've found a post helpful, consider supporting the blog - it's a part-time passion that your support helps keep alive.
⚠️ Disclaimer
This post may contain affiliate links. If you choose to purchase through them, I may earn a small commission at no extra cost to you. I only recommend items and services I’ve personally read or used and found valuable.
As an Amazon Associate I earn from qualifying purchases.