Skip to content

catamitez0-maker/MaxwellFilter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maxwell Filter

A token-saving firewall for LLM APIs.

Maxwell Filter sits in front of OpenAI-compatible APIs, Ollama, vLLM, or other LLM backends. It blocks junk, repeated, low-signal, risky, or abusive requests before they spend expensive inference tokens.

This project is the practical filtering half of Maxwell. It does not handle compute pricing, receipts, settlement, P2P markets, or token economics. Those belong in Maxwell Meter.

Core Features

  • HMAC API key authentication
  • Per-client token bucket rate limits
  • Bloom-filter blacklist checks
  • Regex prompt-injection and secret-leak rules
  • Shannon entropy gate for spam/junk detection
  • Repetition and idle-loop detection
  • Circuit breaker under load
  • Streaming backend proxy for Ollama or simulated backends
  • Health, stats, dashboard, and WebSocket stats endpoints

Install From Source

pip install -e ".[dev]"

Run Tests

pytest -q

Configuration Rules

{
  "blacklist": ["admin_login", "DROP TABLE"],
  "patterns": ["(?i)ignore\\s+previous\\s+instructions"]
}

regex_rules is also accepted for backward compatibility.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors