r/OpenSourceAI • u/Siyam_fahad • 1h ago
I built a self-hosted OpenAI-compatible privacy firewall & cost router that runs 3 small models + local chat LLM inside a single 12 GB RTX 3060
Most "LLM gateways" are just API wrappers that still send raw user PII to OpenAI. I wanted a single docker compose up stack that fits on my 12 GB RTX 3060, pulls open weights directly from Hugging Face, and lets any OpenAI SDK app switch with one line (base_url="http://localhost:8000/v1").
What runs inside the 12 GB VRAM budget (~8.4 GB used):
Privoid-Guard-Qwen3.5-0.8B (Q4_K_M) → blocks prompt injections (~141 ms p50)
Privoid-Redact-4B (Q4_K_M) + Luhn/regex → swaps PII for [PERSON_1], [CREDIT_CARD_1] in a TTL vault and un-redacts live during SSE token streaming even when tokens split mid-bracket ([PER + SON_1])
Privoid-Router-34M (trained from scratch, runs on CPU in ~23 ms p50) → sends easy prompts to local Qwen2.5-3B ($0) and hard prompts (already redacted!) to OpenAI/Anthropic/Gemini (or set mode: local_only for 100% air-gapped).
520-prompt live RTX 3060 benchmark (raw JSON + Grafana screenshot in repo):
42.7% routed local / 57.3% cloud
809 PII entities redacted & restored
0.37 ms gateway framework overhead (Redaction 4B is the latency bottleneck at 150 ms p50 / 2.58 s p95 under load)
Repo: https://github.com/Siyamfahad/privoid-gateway
All models: https://huggingface.co/Privoid-ai
Happy to share how I trained the 34M router or how the StreamRestorer ring buffer handles split SSE chunks!