Skip to main content
A one-command, OpenAI-compatible compliance proxy. Point any existing app’s OpenAI base_url at it and instantly get PII redaction, budget enforcement, and an audit trail — with zero code changes to your app.

60-second quickstart

  1. Start the proxy (requires pip install 'multimind-sdk[gateway]'):
Fully local, no API key at all:
  1. Change one line in your existing app:
That request reaches the upstream as "... my SSN is [SSN]" (or is rejected with a 400 if ssn is in --block-on), spend is metered against the budget, and audit.jsonl records what was detected — types, counts, and hash tags only, never the raw values.

What it exposes

Error bodies follow the OpenAI {"error": {"message", "type", "code", ...}} shape:
  • 400 type compliance_violation, code pii_blocked — a --block-on PII type was found in the request (includes blocked_types).
  • 429 type/code budget_exceeded — the session budget is spent (includes spent and max_cost).
  • 502 type upstream_error, code upstream_unreachable — the upstream could not be reached. Upstream 4xx/5xx responses are passed through unchanged. On a streaming request these errors arrive as an SSE error event (code upstream_unreachable or upstream_error) followed by [DONE], since headers have already been sent.

Configuration

Every option is available as a CLI flag and an environment variable; explicit flags win. Programmatic use:

docker-compose

The proxy is a plain uvicorn app, so it drops into the existing compose setup:

Honest limitations

  • Latency: every request takes one extra local hop plus regex scanning. Overhead is small (milliseconds) but not zero.
  • Streaming is slightly buffered: to catch PII split across SSE chunks, the proxy holds back a 64-character overlap window before emitting each chunk. Output arrives marginally behind the upstream, and chunk boundaries are re-segmented (total content is preserved).
  • Regex-based detection: the built-in PIIDetector covers common structured PII (emails, SSNs, cards, keys, …). It is not an NLP entity recognizer and will not catch free-form PII like names or addresses.
  • Budget accuracy: costs use real token usage when the upstream reports it and a chars/4 estimate otherwise (always for streams). Models outside the built-in OpenAI pricing table are recorded as unpriced ($0) unless you set MULTIMIND_PROXY_COST_PER_TOKEN, so the budget cannot bite there. The budget is per-process (“session”) and resets on restart.
  • Chat surface: string content and {"type": "text"} multimodal parts are scanned; image/audio parts pass through unscanned. Tool-call arguments in responses are not currently scanned.
  • Not authentication: the proxy does not authenticate its own callers; bind it to localhost or put it behind your own auth in production.