Skip to content

LiteLLM integration

Add PII masking to your LiteLLM proxy with one guardrail

Already running LiteLLM? Add the Maskflare guardrail to mask personal data and secrets before every model call and restore them in the response, without changing your routing.
What Maskflare covers
  • Every request LiteLLM routes, whichever provider it goes to
  • Messages, system prompts and tool-call arguments
  • Responses, with masked values restored in post_call mode
  • A fail_policy setting so you decide whether a masking failure blocks or passes the request

LiteLLM is a popular way to put one API in front of many model providers. It handles routing, keys, budgets and fallbacks well. Masking personal data is a separate job, and LiteLLM leaves room for it through guardrails.

The Maskflare guardrail plugs into that slot. In pre_call mode it masks the request with your Maskflare rules before LiteLLM forwards it; in post_call mode it restores real values in the response. You keep LiteLLM for routing and get Maskflare's 574 detectors, Exact Data Match and audit trail on top.

Set up LiteLLM with Maskflare

Maskflare runs as a guardrail inside your existing LiteLLM proxy, before and after each model call. Your LiteLLM routing, keys and budgets stay as they are.

LiteLLM proxy config (config.yaml)
# pip install "maskflare[litellm]"
guardrails:
  - guardrail_name: maskflare
    litellm_params:
      guardrail: maskflare.integrations.litellm.MaskflareGuardrail
      mode: [pre_call, post_call]
      default_on: true
      api_key: os.environ/MASKFLARE_API_KEY   # a Redaction-purpose key
      fail_policy: closed

What gets masked

Good to know

Frequently asked questions

Do I need the Maskflare gateway if I use LiteLLM?

No. The guardrail calls Maskflare's mask and unmask API directly, and LiteLLM keeps routing to your providers.

How do I install it?

Install the Python SDK with the LiteLLM extra (pip install "maskflare[litellm]") and add the guardrail block to your LiteLLM config.

Does it restore values in the response?

Yes, when the guardrail runs in post_call mode as well as pre_call.

How is this different from LiteLLM's Presidio integration?

Presidio uses an NER model plus patterns; Maskflare uses deterministic rules with checksum validation, 47 country packs, 232 credential formats and Exact Data Match, plus a local named-entity layer. Our Presidio comparison covers the trade-offs.

Other integrations

See it on your own data

Try Maskflare free.
Bring your hardest prompts.

28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.