Automating credit decisions for unbanked small businesses in 90 seconds
Features โข Quick Start โข Architecture โข API โข Demo
380 million Indians lack access to formal credit. Traditional banks require:
- ๐ 3+ years of ITR filings
- ๐๏ธ GST registration
- ๐ณ Credit history (CIBIL score)
Kirana stores and small retailers operate informally with:
- WhatsApp payment confirmations
- UPI transaction screenshots
- Handwritten ledgers (Khata books)
- No formal documentation
Shadow Credit bridges this gap by extracting financial signals from informal documents and generating bank-grade credit assessments.
| Agent | Function |
|---|---|
| Agent 00 | Google Maps verification โ validates business existence, ratings, reviews |
| Agent 01 | OCR extraction โ processes bills, UPI screenshots with Hindi support |
| Agent 02 | WhatsApp parser โ classifies financial transactions from Hinglish chats |
| Agent 03 | Khata Book โ parses handwritten ledger entries |
| Agent 04 | Credit Warmth Score โ ML-based scoring using 7 financial signals |
| Agent 05 | Forensic Reconciliation โ detects gaps, generates RBI-compliant hypotheses |
| Agent 06 | Compliance โ RBI MSME checklist verification |
| Agent 07 | Credit Report โ generates professional PDF memos |
- Supervisor Agent coordinates all agents with dynamic execution
- Human-in-the-loop โ pipeline pauses for clarification, resumes automatically
- Real-time WebSocket streaming shows live agent progress
- Auto-decision engine: AUTO_ACCEPT / CLARIFY / FALLBACK based on confidence
- AES-256-GCM encryption for all sensitive data
- DPDP Act 2023 compliant โ consent tracking, right-to-erasure
- Immutable audit log โ database triggers prevent tampering
- No unencrypted PII stored
- Python 3.11+
- Node.js 18+
- Docker (optional)
git clone https://github.com/pranavpanchal1326/shadow-credit.git
cd shadow-credit
# Backend
cp backend/.env.example backend/.env
# Edit backend/.env with your API keys# Required
MASTER_ENCRYPTION_KEY=<generate: python -c "import secrets; print(secrets.token_hex(32))">
GROQ_API_KEY=<get free key from console.groq.com>
# Optional
GOOGLE_MAPS_API_KEY=<for business verification>cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run devhttp://localhost:3000/apply
docker-compose upโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FRONTEND (Next.js 15) โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Apply โ โProcessingโ โ Result โ โ Dashboard โ โ
โ โ Form โ โ Stream โ โ Display โ โ (RM View) โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ WebSocket + REST
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BACKEND (FastAPI) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SUPERVISOR AGENT โ โ
โ โ Orchestrates pipeline โข Decision engine โข Clarification โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโผโโโโโโโโโฌโโโโโโโโโฌโโโโโโโโโฌโโโโโโ โ
โ โAgent 00โAgent 01โAgent 02โAgent 03โAgent 04โAgent 05โ 06 โ โ
โ โ Maps โ OCR โWhatsAppโ Khata โWarmth โForensicโComplโ โ
โ โโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโโโโดโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Agent 07 โ Credit Report Generator โ โ
โ โ (ReportLab PDF + QR Code) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EXTERNAL SERVICES โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Groq โ โ Google โ โ EasyOCR โ โ SQLite โ โ
โ โ LLM โ โ Maps โ โ (Local) โ โ (Encrypted) โ โ
โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/sessions |
Create new session (requires consent) |
GET |
/api/v1/sessions/{id} |
Fetch session status |
POST |
/api/v1/sessions/{id}/analyze |
Trigger analysis pipeline |
POST |
/api/v1/sessions/{id}/clarify |
Answer clarification question |
POST |
/api/v1/sessions/{id}/export |
Download PDF report |
DELETE |
/api/v1/sessions/{id} |
Right-to-erasure (DPDP) |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/ingest/whatsapp/{id} |
Upload WhatsApp chat |
POST |
/api/v1/ingest/upi/{id} |
Upload UPI screenshot |
POST |
/api/v1/ingest/bill/{id} |
Upload utility bill |
POST |
/api/v1/ingest/khata/{id} |
Upload ledger photo |
| Protocol | Endpoint | Description |
|---|---|---|
WebSocket |
/ws/{session_id} |
Live agent progress stream |
Three pre-configured personas for testing:
| Persona | Scenario | Duration |
|---|---|---|
| Suresh | Clean approval โ straightforward case | ~45 sec |
| Meena | Discrepancy detected โ triggers clarification modal | ~60 sec |
| Raju | Seasonal pattern โ requires analysis | ~48 sec |
# Create demo session
curl -X POST http://localhost:8000/api/v1/sessions \
-H "Content-Type: application/json" \
-d '{"demo_mode": true, "consent_given": true}'
# Trigger analysis with persona
curl -X POST "http://localhost:8000/api/v1/sessions/{session_id}/analyze?persona_id=persona02_discrepancy"XGBoost-based ML model with 7 weighted signals:
| Signal | Weight | Description |
|---|---|---|
| Income Regularity | 26.6% | Consistency of monthly inflows |
| Inflow-Claim Consistency | 20.9% | WhatsApp claims vs. UPI verification |
| Business Continuity | 19.0% | Google Maps presence, reviews, tenure |
| Seasonal Patterns | 14.25% | Revenue fluctuation analysis |
| Network Reliability | 9.5% | Repeat customer transactions |
| Data Source Diversity | 4.75% | Multiple verification sources |
| Behavioral Consistency | 5.0% | Transaction timing patterns |
Credit Grade Scale:
- A+: โฅ0.85 โ Auto-approve
- A: โฅ0.75 โ High confidence
- B+: โฅ0.65 โ Moderate confidence
- B: โฅ0.55 โ Clarification needed
- C: <0.55 โ Manual review
- FastAPI โ async Python web framework
- Groq โ LLaMA 3.3 70B for reasoning
- XGBoost + SHAP โ ML scoring with explainability
- EasyOCR โ offline OCR with Hindi support
- SQLite โ encrypted database with WAL mode
- ReportLab โ PDF generation
- Next.js 15 โ React framework
- Tailwind CSS โ styling
- Radix UI โ accessible components
- Zustand โ state management
- React Query โ data fetching
- Recharts โ visualizations
shadow-credit/
โโโ backend/
โ โโโ agents/ # 7 AI agents + supervisor
โ โโโ api/ # REST endpoints
โ โโโ core/ # Security, events, AI client
โ โโโ db/ # Database schema & queries
โ โโโ main.py # FastAPI application
โโโ frontend/
โ โโโ app/ # Next.js pages
โ โโโ components/ # React components
โ โโโ hooks/ # Custom hooks
โโโ docker-compose.yml # Container orchestration
| Service | Cost |
|---|---|
| Groq API | Free (500+ calls/day) |
| EasyOCR | Free (local) |
| Google Maps | ~$0.50 (on $200 free credit) |
| Total | $0.00 |
MIT License โ see LICENSE for details.
Built for Indian MSMEs ๐ฎ๐ณ
Democratizing credit access through AI