The intelligent AI gateway for the enterprise. Intercept. Scrub. Route. Audit. Save.
ModelToll sits at the network level between your employees and every AI provider they use. It enforces data security policies, routes requests to approved cheaper models, and tracks every dollar saved — all without disrupting anyone's workflow.
Every enterprise today has the same invisible crisis:
| Who | What's happening |
|---|---|
| Developers | Pasting proprietary code into ChatGPT |
| Designers | Subscribed to 3 different AI image tools on the company card |
| Product managers | Uploading customer data to AI summarizers |
| Finance | No idea what's being spent or where |
| Security | No visibility into what data left the building |
| Legal | Panic after the fact |
Shadow AI is a $100B compliance and cost problem hiding in plain sight.
Employee → [ChatGPT / Claude / Copilot / Any AI]
↓
ModelToll Gateway
┌──────────────────────────┐
│ 1. Intercept the request │
│ 2. Detect sensitive data │
│ 3. Scrub PII / secrets │
│ 4. Route to approved, │
│ cheaper model │
│ 5. Log for audit │
│ 6. Track cost savings │
└──────────────────────────┘
↓
Approved LLM (cheaper)
↓
Response → Employee
(they see no difference)
modeltoll/
├── src/
│ ├── config/ # Pydantic settings (env-driven)
│ ├── scrubber/ # PII + secrets detection engine (Presidio + regex)
│ ├── router/ # Model routing + cost arbitrage
│ ├── audit/ # Async PostgreSQL audit logger
│ ├── proxy/ # FastAPI gateway + route handlers
│ └── dashboard/ # Admin REST API (cost, logs, analytics)
├── config/
│ ├── model_routing.json # Source → target model map + cost data
│ └── custom_patterns.json # Enterprise regex patterns (keys, CPF, CNPJ, …)
├── tests/
│ ├── unit/ # Scrubber, router, gateway unit tests
│ └── integration/ # End-to-end proxy flow tests
└── docker/
└── Dockerfile
git clone <repo>
cd ModelToll
cp .env.example .env
# Edit .env with your settingsdocker compose up -dThis starts:
- ModelToll gateway on port
8080 - PostgreSQL on port
5432 - Redis on port
6379
Instead of https://api.openai.com, use http://localhost:8080.
from openai import OpenAI
client = OpenAI(
api_key="your-openai-key",
base_url="http://localhost:8080/v1", # ← ModelToll
)
response = client.chat.completions.create(
model="gpt-4o", # ModelToll reroutes to gpt-4o-mini automatically
messages=[{"role": "user", "content": "Hello!"}],
)curl -H "X-Admin-Api-Key: your-admin-key" \
http://localhost:8080/dashboard/summary?tenant_id=default&days=30| Layer | What it catches |
|---|---|
| Custom regex | AWS keys, GitHub tokens, DB URLs, CNPJ, CPF, internal codes |
| Presidio NLP | Names, emails, phones, credit cards, SSNs, IPs, dates, locations |
All patterns are configurable in config/custom_patterns.json.
Automatic routing based on config/model_routing.json:
| Requested | Routed to | Savings |
|---|---|---|
gpt-4o |
gpt-4o-mini |
~97% |
gpt-4-turbo |
gpt-4o-mini |
~98% |
claude-opus |
claude-haiku |
~95% |
gemini-1.5-pro |
gemini-1.5-flash |
~98% |
ModelToll tracks every dollar saved and takes 20% of the savings:
Company was spending: $500,000/month
With ModelToll: $300,000/month
Savings: $200,000/month
ModelToll fee (20%): $40,000/month
Company net gain: $160,000/month
Every intercepted request is logged with:
- User identity, IP, session
- Original model requested
- Scrubber findings (entity types, count)
- Routed model + provider
- Token counts
- Cost delta and savings
- Response latency + status
| Endpoint | Description |
|---|---|
GET /health |
Liveness probe |
GET /dashboard/summary |
KPI overview (costs, savings, requests) |
GET /dashboard/logs |
Paginated audit log with filters |
GET /dashboard/top-models |
Most-used source models |
GET /dashboard/savings |
Daily cost savings time-series |
GET /metrics |
Prometheus metrics |
All dashboard endpoints require X-Admin-Api-Key header.
# Install dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check src/ tests/
# Type check
mypy src/
# Run locally (dev mode)
uvicorn src.main:app --reload --port 8080ModelToll's business model is compute arbitrage:
- Deploy ModelToll inside an enterprise
- Measure their current AI spend (shadow + authorized)
- Reroute to optimized models
- Bill 20% of the monthly savings
This means ModelToll's revenue scales directly with the value it delivers — zero risk for the customer.
- Browser extension for client-side interception
- VPN mode (network-level MITM for all traffic)
- Fine-grained per-user/per-team policies
- Multi-tenant SaaS dashboard
- Slack / Teams bot integration
- Real-time cost alert webhooks
- SOC 2 Type II compliance package
Proprietary — ModelToll © 2026