ModelGate

The API Gateway That Cuts LLM Costs by 40-70%

The Problem

Companies using LLMs face an uncomfortable reality: cost is out of control and invisible.

Today: A team uses GPT-4, Claude, and Gemini in production. They have no idea:
  • Which endpoints/features are expensive
  • Which requests are wasting money (repeated prompts, oversized models, errors)
  • How much they're spending per provider, per model, per feature

Without visibility, waste accumulates invisibly. Teams can't optimize what they can't measure. Costs drift from $100/month to $10K/month in months.

The Solution: ModelGate

ModelGate is a drop-in API gateway that sits between your application and LLM providers. It proxies every request, measures everything, detects waste, and generates actionable optimization recommendationsβ€”automatically.

What It Does

  1. Proxies all requests (drop-in replacement for provider SDKs)
  2. Logs usage & cost with exact precision (not estimates)
  3. Detects waste patterns in real-time
  4. Recommends optimizations (model downgrade, cache, etc.)
  5. Optionally enforces optimizations automatically

How It Works: The Request Flow

Your App β†’ ModelGate API Gateway β†’ Provider (OpenAI/Anthropic/Gemini/Azure) ↓ (intercept) 1. Authenticate API key 2. Load customer project config 3. Normalize request & prompt 4. Generate cryptographic hashes (for deduplication) 5. Check spending limits & quotas 6. Cache lookup (if enabled) 7. Routing decision (smart model selection) 8. Execute provider request 9. Extract usage (tokens) 10. Calculate exact cost 11. Analyze for waste patterns 12. Log with full metadata 13. Return response to app 14. Trigger async recommendation engine

Key design principle: Every step is deterministic, logged, and reversible. Optimizations never happen without reason and never crash your app.

Core Features & Capabilities

1. Cost Visibility

Exact cost calculation for every request (not estimates). Prices pulled from provider APIs and stored in the gateway. Tracks spend by:
  • Provider (OpenAI, Anthropic, Gemini, Azure)
  • Model (GPT-4o vs. GPT-4o-mini vs. Claude Sonnet, etc.)
  • Feature/endpoint (your app's logical groupings)
  • Time (daily, weekly, monthly trends)

2. Waste Detection Engine

Automatic waste analysis flags cost anomalies:
  • Repeated Prompts: Same prompt sent twice = waste (enable cache)
  • Expensive Model on Small Request: Using GPT-4 to classify text (downgrade to GPT-4o-mini)
  • Error Waste: Failed requests that still incur cost
  • Large Context: Unnecessary history or attachments
  • Low Output/Input Ratio: Paying for tokens not using the response

3. Recommendation Engine (Async Worker)

Runs continuously to generate actionable recommendations:

πŸ”„ CACHE_CANDIDATE
Enable exact-match cache for repeated prompts. Saves 100% of duplicate request cost.
πŸ“‰ MODEL_DOWNGRADE
Downgrade model (e.g., GPT-4 β†’ GPT-4o-mini) for small requests. Saves 80-95% per request.
βœ‚οΈ PROMPT_COMPRESSION
Remove redundant instructions or context. Saves tokens immediately.
πŸ›‘ ERROR_WASTE
Fix failing requests. Reduces waste with zero cost increase.
🎯 MAX_TOKENS_REDUCTION
Lower max_tokens limit. Stops overallocation of output space.
πŸ” FAILOVER
Route to cheaper provider (e.g., Gemini Flash) when quality criteria allow.

4. Smart Routing

Automatic model selection (optional). When enabled, automatically downgrades expensive models to cheaper alternatives for non-critical tasks (respects your safety guardrails).
  • Configurable downgrades: GPT-4o β†’ GPT-4o-mini, Claude Sonnet β†’ Claude Haiku, etc.
  • Locked categories: Never downgrade legal, medical, financial, or security-critical requests

5. Exact-Match Caching

Deterministic cache: Identical prompts (same model, temperature, format) return cached response. Saves 100% of cost. TTL configurable (default 24h).

6. Multi-Provider Support

Unified API across OpenAI, Anthropic, Gemini, and Azure OpenAI. Switch providers in config without changing app code.

7. Spending Controls

Per-project monthly spend cap: Enforce a hard limit. Requests rejected (HTTP 402) once over budget, protecting from runaway costs.

8. Dashboard & Analytics

Real-time web dashboard showing:
  • Total spend, provider breakdown, model breakdown
  • Cost trends (daily, weekly, monthly)
  • Request volume by endpoint/feature
  • Active recommendations (savings potential)
  • Recommendation impact tracking (savings claimed)

System Architecture

Three-service design (all in one repo, deployed together):

🌐 API Gateway (Fastify)
- Handles all incoming requests
- Proxies to providers
- Enforces auth, rate limits, spending caps
- Serves dashboard API
βš™οΈ Async Recommendation Worker
- Polls for new request logs
- Analyzes patterns
- Creates/updates recommendations
- Calculates savings estimates
🎨 Web Dashboard (Next.js)
- Real-time cost visualization
- Recommendation management (accept/dismiss)
- Settings & config control
- Authentication (Supabase)

Data Storage: Supabase (PostgreSQL) + Prisma ORM. Prices are stored in DB; provider API keys are encrypted at rest.

Deployment: Railway (single dashboard, 3 services). Auto-scaling, managed Postgres, custom domains included.

Business Model

Managed Keys Model (SaaS Revenue)

ModelGate holds the provider API keys. Users don't need their own.

Revenue Levers:
  1. Per-Project Subscription: $29–$299/month based on request volume tier
  2. Savings Revenue Share: (Optional) 10–15% of documented savings claimed
  3. Premium Features: Advanced routing, multi-team, audit logs ($500+/mo)

Why managed keys? Users trust us with their budget, not their credentials. We control access, enforce quotas, and guarantee no overspend. That's the value prop.

40–70%
Typical cost reduction
1–2 min
Time to integrate
0% App
Code change required

Current Status & Launch Timeline

βœ“ DONE Phase 1: Core API & Cost Engine
All three providers integrated, exact cost calculation verified, e2e bugs flushed.
βœ“ DONE Phase 2: Auth & Spending Control
Supabase auth, API key auth, dual-mode login, monthly spend caps, CORS.
βœ“ DONE Phase 3: Full Dashboard & E2E Tests
Complete UI rebuild, all 8 dashboard pages, Playwright e2e suite (free + real-provider smoke test).
β†’ PENDING Phase 4: Deploy to Production
Railway setup + custom domain (modelgatehq.com). ~1–2 weeks.
β†’ PENDING Phase 5: Payment Integration
PayPal Checkout. ~1 week.
β†’ PENDING Phase 6: Public Launch
Docs, marketing, first customers. Ready for demo.

Technical Maturity: Production-ready. Three-service architecture is deployed, tested, and running real traffic in dev. Database migrations, auth, cost calculation, and recommendation engine are all deterministic and well-tested.

Competitive Edge

Why ModelGate Wins

  • No credential management burden on users: We hold keys, users control quotas. That's new.
  • Exact cost (not estimates): Every request logged with precise provider billing. No guesswork.
  • Automated recommendations: Waste detection + optimization suggestions run 24/7. No manual analysis.
  • Multi-provider unified: OpenAI + Anthropic + Gemini + Azure in one dashboard. Switch anytime.
  • Fast to integrate: Drop-in API gateway. App code doesn't change (OpenAI SDK compatibility).
  • Built for safety: Every optimization is logged, reversible, and respects your guardrails (no legal/medical downgrade without consent).

For Buyers: What ModelGate Solves

🎯 If you're spending $X/month on LLMs:
ModelGate cuts that by 40–70% through automated waste elimination (caching, model downgrade, error fixing). And you sleep better knowing exactly where every dollar goes.
πŸ” If cost is your main blocker to LLM adoption:
ModelGate removes that blocker. Predictable spend, hard caps, intelligent routing = LLM features without runaway costs.
πŸ“Š If you're flying blind on LLM spend:
ModelGate gives you the dashboard and tooling to make informed decisions. See which features cost what, which are profitable, which need work.

Get started: Sign up at modelgatehq.com, create a project, get an API key (managed for you), and drop it in your app. First 1000 requests free. Then pay per tier.