AutoInvoice AI is an agentic automation tool built with AI to generate, customize, and send invoices automatically — in just ~35 seconds per client. It pulls data from forms, Google Sheets, or Excel files, creates PDF invoices, and emails them directly to clients.
Ideal for marketing agencies, e-commerce, SaaS, and software houses looking to save hours on manual billing.
- 🧠 AI-Powered Automation: Uses OpenAI Agents SDK with GPT-4o-mini and 3 specialized agents (Validation → Template → Delivery) for end-to-end invoice processing
- 📊 Multiple Data Sources: Input via web form, Google Sheets, or Excel upload
- 🧾 PDF Generation: Creates styled invoices using Jinja2 templates and pdfkit
- 📧 Email Delivery: Sends invoices via Gmail SMTP with attachments
- ⚙️ Scalable MVP: Handles 2–5 clients in demo mode (~35 sec/invoice)
- 🖥️ Real-Time Progress: Streamlit UI shows live status — Fetching → Generating → Sending
- 📦 Download Options: Download individual PDFs or all invoices as a ZIP
- 🛡️ Robust Error Handling: Graceful fallbacks for template loading, JSON parsing, and email sending
| Layer | Technology |
|---|---|
| Backend | FastAPI, OpenAI Agents SDK, Python 3.12+ |
| Frontend | Streamlit |
| AI Model | OpenAI GPT-4o-mini via OpenAI Agents SDK |
| Templates | Jinja2 |
| PDF Generation | pdfkit + wkhtmltopdf |
| smtplib (Gmail SMTP + MIME) | |
| Data Processing | Pandas, Requests |
| Automation Workflow | n8n |
- Python 3.12+
- Git
- Gmail account with App Password (for email sending)
git clone https://github.com/Shahzain-Ali/agentic-invoice-generator.git
cd agentic-invoice-generatoruv syncwkhtmltopdf converts HTML to PDF. Required by pdfkit.
- Download from wkhtmltopdf.org/downloads.html
- Select: Windows (MSVC 2015) →
wkhtmltox-0.12.6-1.msvc2015-win64.exe
- Select: Windows (MSVC 2015) →
- Run the
.exeas Administrator - Tick "Modify PATH" → Install
- Verify installation:
wkhtmltopdf --version
- Install via Homebrew:
brew install wkhtmltopdf
- Verify installation:
wkhtmltopdf --version
Don't have Homebrew? Install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Copy the example environment file:
cp .env.example .env
-
Open
.envand fill in your actual values:OPENAI_API_KEY=your_openai_api_key GMAIL_EMAIL=your_email@gmail.com GMAIL_APP_PASSWORD=your_16_digit_app_password GOOGLE_SHEET_ID=your_google_sheet_id GOOGLE_CREDENTIALS_PATH=credentials.json WKHTMLTOPDF_PATH=C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe API_URL=http://localhost:8000
How to get Gmail App Password: Google Account → Security → 2-Step Verification → App Passwords → Generate
uvicorn backend.api.main:app --reload --port 8000streamlit run frontend/userInterface.py- Fill the form or connect to Google Sheets or upload an Excel file
- Click "Process & Deliver Invoices"
- Watch live progress (Fetching → Generating → Sending)
- Download PDFs individually or all invoices as a ZIP
Project Demo Video (Coming Soon) — Coming Soon
This project is licensed under the MIT License. © 2025 Shahzain Ali
- 💻 GitHub: Shahzain Ali
- 📧 Email: alishahzain604@gmail.com