Extracts line items from bills/invoices using Google Gemini 1.5 Flash Vision.
- Create virtual environment:
python -m venv venv
venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Create
.envfile with your Google AI Studio API key:
GOOGLE_API_KEY=your_key_here
- Run the server:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000POST /extract-bill-data
{
"document": "https://example.com/invoice.pdf"
}{
"is_success": true,
"token_usage": {
"total_tokens": 1234,
"input_tokens": 1000,
"output_tokens": 234
},
"data": {
"pagewise_line_items": [...],
"total_item_count": 10
}
}- Push code to GitHub
- Go to render.com → New Web Service
- Connect your GitHub repo
- Settings:
- Build Command:
pip install -r requirements.txt - Start Command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT - Environment Variables: Add
GOOGLE_API_KEY=your_key_here
- Build Command:
- Deploy!
- Push code to GitHub
- Go to railway.app → New Project → Deploy from GitHub
- Add environment variable:
GOOGLE_API_KEY - Railway auto-detects FastAPI and deploys
- Install flyctl:
iwr https://fly.io/install.ps1 -useb | iex - Login:
fly auth login - Initialize:
fly launch(in project directory) - Set secret:
fly secrets set GOOGLE_API_KEY=your_key_here - Deploy:
fly deploy
- Install Vercel CLI:
npm i -g vercel - Create
vercel.json:
{
"version": 2,
"builds": [{"src": "app/main.py", "use": "@vercel/python"}],
"routes": [{"src": "/(.*)", "dest": "app/main.py"}]
}- Deploy:
vercel - Set env var:
vercel env add GOOGLE_API_KEY
Note: For all platforms, make sure to set the GOOGLE_API_KEY environment variable in the platform's dashboard.