The Receipt Spending Analyzer API is a Flask-based service that allows users to scan receipts, automatically categorize purchases using AI, generate insightful spending reports, and receive personalized financial advice. It integrates LLM-based categorization, CSV-based storage for lightweight persistence, and data visualization capabilities to help users better understand and optimize their spending habits.
- Workspace Management – Create, list, update, and delete budget workspaces.
- Category Management – Add, rename, and remove expense categories.
- Receipt Processing – Upload, parse, and correct scanned receipts.
- Transactions & Budgets – Query transactions and set spending limits.
- Reports & Analytics – Generate numeric reports, charts, and CSV exports.
- AI Insights & Advice – Get spending forecasts, anomaly detection, and tips.
- Health Check – Ensure the service is running.
- Backend Framework: Flask (Python)
- AI Processing: OpenAI API
- Data Handling: Pandas (CSV-based storage)
- Image Processing: OpenAI Vision / Multi-Modal LLM
- Visualization: Matplotlib / Plotly
- Environment: Python 3.9+
POST /v1/instances– Create WorkspaceGET /v1/instances– List WorkspacesGET /v1/instances/{id}– Get Workspace DetailsPUT /v1/instances/{id}– Rename / Update WorkspaceDELETE /v1/instances/{id}– Delete Workspace
POST /v1/instances/{id}/initialize– Bulk Initialise CategoriesPOST /v1/instances/{id}/categories– Add Single CategoryPUT /v1/categories/{cat_id}– Rename CategoryDELETE /v1/categories/{cat_id}– Delete Category
POST /v1/receipts– Upload & Parse ReceiptGET /v1/receipts/{receipt_id}– Retrieve Parsed ReceiptPATCH /v1/receipts/{receipt_id}– Correct Parsed Receipt
GET /v1/instances/{id}/transactions– List TransactionsPOST /v1/instances/{id}/budgets– Create / Update BudgetGET /v1/instances/{id}/budgets– Get Budget Utilisation
GET /v1/instances/{id}/reports– Numeric ReportsGET /v1/instances/{id}/graphs– Chart GeneratorGET /v1/instances/{id}/export– CSV Export
POST /v1/instances/{id}/advice– Generate AdvicePOST /v1/instances/{id}/chat– Conversational ChatGET /v1/instances/{id}/insights– Predictive Insights
GET /v1/health– Service Liveness
Create a .env file in the root of the project:
OPENAI_API_KEY=your_openai_api_key_heregit clone https://github.com/yourusername/receipt-spending-analyzer.git
cd receipt-spending-analyzerpython -m venv venv- Windows
venv\Scripts\activate- Mac/Linux
source venv/bin/activatepip install -r requirements.txtCreate .env file and add:
OPENAI_API_KEY=your_openai_api_key_hereflask runThe API will be available at http://127.0.0.1:5000.
This project is licensed under the MIT License – you’re free to use, modify, and distribute it as long as attribution is provided.