How It Works

From user input to fraud verdict in 6 steps. Complete analysis in under 2 seconds.

1

User Submits Data

User uploads a PDF, receipt photo, or DICOM study — or fills the form by hand

Technical Implementation:
POST /api/extract sniffs magic bytes, runs forensics + pHash, then OpenRouter vision (non-medical). Medical films stay on local MedGemma-4B — pixels never leave the Mini. Values land on the form for review before POST /api/detect.
Example Inputs:
banking: Wire confirmation PDF autofills amount, countries, KYC, and IP
medical: DICOM X-ray: matching Monteggia ORIF = LOW; hip screws billed as humerus CPT 23615 = HIGH; tibia plate billed as knee arthroscopy = CRITICAL
ecommerce: Photographed marketplace receipt → seller age, gift cards, ship-to country
supply_chain: Receiving packet: hardware photo + packing list (BE-4 / GPU racks) — supplier fields out
2

LangGraph Routes Request

Intelligent orchestration layer analyzes sector and routes to optimal LLM

Technical Implementation:
LangGraph maps the sector to its specialist model, retrieves MCP context, and prepares RAG
Process Flow:
  • Parse input sector (banking/medical/ecommerce/supply_chain)
  • Map sector to specialized LLM
  • Initialize workflow state
  • Retrieve external context via MCP (blockchain, credentials, reputation)
  • Prepare context for RAG retrieval
3

RAG + document fingerprints

Pinecone matches similar fraud patterns — and recycled documents via perceptual hash

Technical Implementation:
rag namespace: fraud pattern vectors. dochash namespace: 64-bit pHash of every upload, Hamming-matched so a re-compressed X-ray or invoice cannot be billed twice.
RAG Process:
  • Convert input to embedding vector
  • Query Pinecone index for sector
  • Retrieve top 5 similar patterns by cosine similarity
  • pHash the upload into the dochash namespace (duplicate catch)
  • Enrich LLM prompt with fraud pattern examples
4

AI Analyzes Fraud

Cost-optimized fraud-specialized LLM with RAG-enhanced context

Technical Implementation:
HF Inference and OpenRouter models with cost-optimized FREE fallback chains
banking
Qwen3-32B (HF Inference) analyzes amount, location, device, timing, account age
medical
Two-Stage: MedGemma-4B-Local → Nemotron-Super validates clinical legitimacy then billing fraud patterns
ecommerce
Nemotron-Ultra-550B (OpenRouter) evaluates seller age, pricing, reviews, shipping
supply_chain
Nemotron-Ultra-550B (OpenRouter) examines supplier age, price variance, payment terms, documentation
5

Generate Score & Explanation

Returns 0-100% fraud probability with human-readable reasoning

Technical Implementation:
Converts risk factors into score, maps to risk level, generates natural language explanation
{
  "fraud_score": 87,
  "risk_level": "high",
  "explanation": "Analysis identifies high risk. Red flags: high amount, OFAC high-risk country, new device, odd hour, young account.",
  "model_used": "Qwen3-32B (HF Inference)",
  "processing_time_ms": 1847,
  "similar_patterns": 5
}
6

Display Results

Frontend receives response and displays interactive fraud report

Technical Implementation:
React component renders score gauge, risk badge, explanation, and similar patterns
UI Components:
  • Animated circular progress for fraud score
  • Color-coded risk level badge
  • Detailed explanation with bullet points
  • Model attribution
  • Processing time metrics

Technical Architecture Flow

Browser
Next.js Frontend
React SSR
Next.js
Cloud Run
HTTPS POST
Cloud Run
FastAPI
Uvicorn
FastAPI
LangGraph
Workflow Engine
LangGraph
Pinecone
Vector Search
LangGraph
MCP
External Context
MCP
LangGraph
Tool Results
LangGraph
LLM
Sector Model
LLM
LangGraph
Fraud Score
LangGraph
FastAPI
Response
FastAPI
Frontend
JSON

Key Technologies Explained

LangGraph

Workflow orchestration framework that manages multi-step AI processes. Routes requests, coordinates MCP context retrieval, RAG retrieval, and handles model selection.

Why it matters: Makes the system intelligent and adaptable with external context integration

Pinecone

Cloud vector database for semantic search. Stores fraud pattern embeddings and enables fast similarity matching with scalable infrastructure.

Why it matters: Provides context awareness to AI models with cloud scalability

MCP Server

Model Context Protocol tool stage for external context (wallets, credentials, seller reputation). Demo ships a free deterministic MCP server so the decision trace shows live tool calls.

Why it matters: Makes external enrichment a first-class, auditable pipeline step

Performance Metrics

1.8s
Avg Response Time
3-4s
Cold Start
+38-62%
Detection Gain
-20-45%
False Positives

See It In Action