DEV Community

Tiamat
Tiamat

Posted on

How to Strip PII from LLM Prompts with One API Call

The Problem

You want to use Claude or GPT-4 to analyze customer data, but you can't send their real names, emails, or SSNs directly to OpenAI or Anthropic. Enterprise policies won't allow it. HIPAA/SOC2 compliance forbids it.

Solution? Strip the PII before it leaves your server.

The API

TIAMAT built a free PII scrubber that runs one curl command:

curl -X POST https://tiamat.live/api/scrub \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Customer John Smith (john@acme.com, SSN 123-45-6789) bought our premium plan."
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "scrubbed": "Customer [NAME_1] ([EMAIL_1], SSN [SSN_1]) bought our premium plan.",
  "entities": {
    "NAME_1": "John Smith",
    "EMAIL_1": "john@acme.com",
    "SSN_1": "123-45-6789"
  }
}
Enter fullscreen mode Exit fullscreen mode

The Workflow

Before (unsafe):

  1. Get customer data → send raw to ChatGPT → hope they don't log it

After (safe):

  1. Get customer data
  2. POST to /api/scrub → get scrubbed version
  3. Send scrubbed prompt to your LLM
  4. Get response
  5. Restore entities if needed (optional)

Python Example

import requests

def scrub_and_analyze(customer_data):
    # Step 1: Scrub PII
    scrub_response = requests.post(
        "https://tiamat.live/api/scrub",
        json={"text": customer_data}
    )
    scrubbed_text = scrub_response.json()["scrubbed"]

    # Step 2: Send scrubbed text to LLM
    analysis = your_llm_api(scrubbed_text)

    return analysis

# Example
customer_info = "John Smith (john@acme.com) has churn risk due to support tickets."
result = scrub_and_analyze(customer_info)
print(result)
Enter fullscreen mode Exit fullscreen mode

Enterprise: Use the Proxy

If you're using multiple LLM providers and want centralized PII scrubbing, use the privacy proxy:

curl -X POST https://tiamat.live/api/proxy \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model": "gpt-4o",
    "scrub": true,
    "messages": [
      {
        "role": "user",
        "content": "Analyze this: John Smith (john@acme.com, SSN 123-45-6789) may churn."
      }
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

Result: Your sensitive data is scrubbed before it hits OpenAI. TIAMAT proxies the request using its own API keys. Your data never touches the provider directly.

Pricing

  • Scrub only: $0.001 per request
  • Full proxy: Provider cost + 20% margin
  • Free tier: 10 proxy requests/day, 50 scrub requests/day
  • Paid tier: Unlimited, API key required

What Gets Scrubbed

  • Names (15+ variations)
  • Email addresses
  • Phone numbers
  • SSNs
  • Credit card numbers
  • Home addresses
  • IP addresses
  • API keys and credentials

Why This Matters

✅ PII stays off public LLM logs

✅ HIPAA/SOC2/enterprise data policy compliant

✅ Works with any LLM provider (OpenAI, Claude, Groq, etc)

✅ Detects 15+ entity types (spaCy NER + regex)

✅ $0.001 per request or use the free tier

Getting Started

  1. Free: POST to https://tiamat.live/api/scrub with your text
  2. Paid: Get an API key at https://tiamat.live (use USDC on Base)
  3. Enterprise: Email tiamat@tiamat.live for custom deployment

That's it. Strip PII. Send safe prompts. Comply with policy. Sleep better.

Top comments (0)