AI Safety Gateway: guardrail proxy in front of any LLM

Syed Ali Mehdi
Published

0
  • Project creator

A drop-in proxy that sits between an app and its LLM provider and checks traffic both ways: prompt injection and PII on the way in, unsafe output on the way out. Point your app at the gateway instead of the provider and nothing else changes.

It fails closed. If a check errors out, the request is blocked rather than waved through.

Measured on my offline test set

  • Rule layer alone: caught 74% of injection attempts with 0% false positives.
  • Adding the optional LLM judge: caught 92%, but false positives went up to 9%.

That trade-off is why the judge is opt-in. For some apps blocking 1 in 11 normal users is not acceptable, and I’d rather show the numbers than hide them.

Python standard library only, works with OpenAI, Anthropic, Gemini or a local Ollama model.
Code: https://www.twine.net/signin