$git clone https://github.com/CollieAi/llm-firewallYou're building with GPT-4, Claude, Gemini — but every API call is a potential data leak. Users paste credit cards into chat. Attackers inject malicious prompts. Sensitive data flows to third-party models without any filtering.
| 1 | <p align="center"> |
| 2 | <a href="https://collieai.io"> |
| 3 | <img src="https://collieai.io/logo-1.svg" alt="CollieAi" width="80" /> |
| 4 | </a> |
| 5 | </p> |
| 6 | |
| 7 | <h1 align="center">LLM Firewall — AI Security Proxy & Guardrails for GPT, Claude, Gemini</h1> |
| 8 | |
| 9 | <h4 align="center"> |
| 10 | Drop-in, provider-agnostic AI guardrails proxy that masks PII, blocks prompt injection & jailbreaks, and logs every LLM call. |
| 11 | One line change. Works with OpenAI, Anthropic Claude, Google Gemini, Azure OpenAI, AWS Bedrock, and self-hosted models. |
| 12 | </h4> |
| 13 | |
| 14 | <p align="center"> |
| 15 | <a href="https://collieai.io"><img src="https://img.shields.io/badge/website-collieai.io-blue" alt="CollieAi Website" /></a> |
| 16 | <a href="https://docs.collieai.io"><img src="https://img.shields.io/badge/docs-docs.collieai.io-green" alt="Documentation" /></a> |
| 17 | <a href="https://app.collieai.io"><img src="https://img.shields.io/badge/free_tier-20K_calls/month-brightgreen" alt="Free Tier" /></a> |
| 18 | </p> |
| 19 | |
| 20 | <p align="center"> |
| 21 | <a href="https://docs.collieai.io/getting-started/quick-start">Quick Start</a> · <a href="https://docs.collieai.io">Docs</a> · <a href="https://docs.collieai.io/api-reference">API Reference</a> · <a href="https://app.collieai.io">Try Free</a> · <a href="https://docs.collieai.io/self-hosting">Self-Host</a> |
| 22 | </p> |
| 23 | |
| 24 | ## Why LLM Firewall? |
| 25 | |
| 26 | You're building with GPT-4, Claude, Gemini — but every API call is a potential data leak. Users paste credit cards into chat. Attackers inject malicious prompts. Sensitive data flows to third-party models without any filtering. |
| 27 | |
| 28 | **LLM Firewall** by [CollieAi](https://collieai.io) is a **drop-in security proxy** that sits between your application and the LLM provider. It inspects, masks, and blocks — in real time, with zero code changes beyond swapping the base URL. |
| 29 | |
| 30 | <!-- GIF: dashboard, policy engine, real-time logs --> |
| 31 | |
| 32 | <img width="1000" height="561" alt="CollieAi LLM firewall blocking a prompt injection attack in real time — demo" src="https://github.com/user-attachments/assets/de356d6e-6483-4d30-aa80-d8c36482816e" /> |
| 33 | |
| 34 | |
| 35 | |
| 36 | ## Key Features |
| 37 | |
| 38 | - **Drop-in OpenAI-compatible proxy** — change `base_url`, keep your SDK. Python, Node.js, Go, curl — anything that speaks OpenAI works with CollieAi |
| 39 | - **PII detection & masking** — regex patterns, structured ID validation (Luhn, MOD-97), and dictionary matching via Aho-Corasick |
| 40 | - **Prompt injection protection** — ML classifier (10-50 ms) plus optional LLM-based analysis for sophisticated attacks |
| 41 | - **Flexible policy engine** — 6 configurable rule categories, each with monitor (log only) or enforce (mask/block) mode. Custom regex, dictionaries, thresholds — tune everything per project |
| 42 | - **Input + output filtering** — scan both user prompts and model responses with independent policies |
| 43 | - **User satisfaction tracking** — detect negative sentiment, monitor dissatisfaction metrics, get alerts when something goes wrong |
| 44 | - **Full audit trail** — every request logged with triggered rules, latency, and token counts. Filter by project, time range, or rule type |
| 45 | - **Dashboard** — create projects, configure rules, add provider tokens, review logs. No config files, no deployments |
| 46 | |
| 47 | > **Works with:** OpenAI · Claude · deepseek · Gemini · Azure OpenAI · AWS Bedrock · any OpenAI-compatible endpoint |
| 48 | |
| 49 | ## Quick Start — 3 Steps |
| 50 | |
| 51 | <table> |
| 52 | <tr> |
| 53 | <td width="40%"> |
| 54 | |
| 55 | **1. Point your client at CollieAi** |
| 56 | |
| 57 | Sign up for a free API key and change your `base_url`. No SDK required, no architecture changes. |
| 58 | |
| 59 | </td> |
| 60 | <td width="60%"> |
| 61 | |
| 62 | ```python |
| 63 | # Change two config values |
| 64 | base_url = "https://app.collieai.io/v1" |
| 65 | api_key = "clai_your_project_key" |
| 66 | |
| 67 | # Free: 20,000 calls/month |
| 68 | ``` |
| 69 | |
| 70 | </td> |
| 71 | </tr> |
| 72 | <tr> |
| 73 | <td width="40%"> |
| 74 | |
| 75 | **2. Your code stays the same** |
| 76 | |
| 77 | CollieAi is a transparent proxy. Use the standard OpenAI SDK — every request is filtered by your policy rules automatically. |
| 78 | |
| 79 | </td> |
| 80 | <td width="60%"> |
| 81 | |
| 82 | ```python |
| 83 | from openai import OpenAI |
| 84 | |
| 85 | client = OpenAI( |
| 86 | base_url="https://app.collieai.io/v1", |
| 87 | api_key="clai_...", |
| 88 | ) |
| 89 | client.chat.completions.create(...) |
| 90 | ``` |
| 91 | |
| 92 | </td> |
| 93 | </tr> |
| 94 | <tr> |
| 95 | <td |