How It Works
AIGuard intercepts your outgoing prompt, replaces PII with tokens, and safely restores the PII when the LLM responds.
┌─────────────────────────────────────────────────────────────────┐
│ YOUR APPLICATION │
│ │
│ User sends prompt with PII: │
│ "My email is john@example.com and my phone is 555-123-4567" │
│ │
└─────────────────────────────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ AIGUARD BLINDFOLD PROXY │
│ │
│ Step 1: DETECT PII │
│ ✅ Email: john@example.com │
│ ✅ Phone: 555-123-4567 │
│ │
│ Step 2: MASK PII │
│ ✅ [EMAIL_001] instead of john@example.com │
│ ✅ [PHONE_001] instead of 555-123-4567 │
│ │
│ Step 3: FORWARD TO LLM │
│ "My email is [EMAIL_001] and my phone is [PHONE_001]" │
│ │
│ Step 4: RESTORE PII │
│ ✅ [EMAIL_001] → john@example.com │
│ ✅ [PHONE_001] → 555-123-4567 │
│ │
└─────────────────────────────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────┐
│ YOUR APPLICATION │
│ │
│ Response with PII restored: │
│ "Your email is john@example.com and your phone is 555-123-4567" │
│ │
└─────────────────────────────────────────────────────────────────┘
Prerequisites
Before integrating AIGuard, you need to generate your API key.
| Requirement | Description |
|---|---|
| AIGuard Account | Sign up at app.aiguard.solutions |
| API Key | Generate from your dashboard (Settings → API Keys) |
| LLM Provider | OpenAI, Anthropic, or Google Gemini API key |
Supported PII Types
AIGuard detects and masks 16 types of sensitive data:
| PII Type | Example | Masked As |
|---|---|---|
| john@example.com | [EMAIL_001] | |
| Phone (US) | 555-123-4567 | [PHONE_US_001] |
| Phone (Intl) | +33 6 12 34 56 78 | [PHONE_INTERNATIONAL_001] |
| SSN | 123-45-6789 | [SSN_001] |
| Credit Card | 4111-1111-1111-1111 | [CREDIT_CARD_001] |
| IP Address (v4) | 192.168.1.1 | [IP_V4_001] |
| API Key | api_key=sk-abc123... | [API_KEY_001] |
| AWS Key | AKIAIOSFODNN7EXAMPLE | [AWS_KEY_001] |
| Private Key | -----BEGIN RSA... | [PRIVATE_KEY_001] |
| Name | John Doe | [NAME_001] |
Code Examples
Replace your direct LLM calls with AIGuard calls by updating your base URL.
Python / Direct HTTP
python
import requests
import os
AIGUARD_API_KEY = os.getenv("AIGUARD_API_KEY")
def anonymize_prompt(prompt: str, provider: str = "gemini") -> str:
"""Send prompt through AIGuard for PII anonymization"""
response = requests.post(
"https://api.aiguard.solutions/api/v1/blindfold/anonymize",
headers={
"X-API-Key": AIGUARD_API_KEY,
"Content-Type": "application/json"
},
json={
"prompt": prompt,
"provider": provider,
"masking_mode": "full"
}
)
if response.status_code == 200:
data = response.json()
return data["response"]
else:
raise Exception(f"AIGuard error: {response.text}")
Node.js / Express
javascript
const axios = require('axios');
const AIGUARD_API_KEY = process.env.AIGUARD_API_KEY;
const AIGUARD_BASE_URL = 'https://api.aiguard.solutions/api';
async function anonymizePrompt(prompt, provider = 'gemini') {
try {
const response = await axios.post(
`${AIGUARD_BASE_URL}/v1/blindfold/anonymize`,
{
prompt: prompt,
provider: provider,
masking_mode: 'full'
},
{
headers: {
'X-API-Key': AIGUARD_API_KEY,
'Content-Type': 'application/json'
}
}
);
return response.data.response;
} catch (error) {
console.error('AIGuard error:', error.message);
throw error;
}
}
cURL
bash
curl -X POST https://api.aiguard.solutions/api/v1/blindfold/anonymize \
-H "X-API-Key: ag_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Customer John Doe (john@example.com) requested a refund.",
"provider": "gemini",
"masking_mode": "full"
}'
Troubleshooting
"Invalid API Key"
- Verify your API key is correct.
- Check if the key is active in your dashboard.
- Ensure you're using the right header (
X-API-Key).
"Monthly Limit Exceeded"
- Check your plan limits in the dashboard.
- Upgrade to a higher tier to increase your quota limit.
"Tokens Not Preserved"
- Check the LLM response for token mutations.
- Use a lower temperature (0.1 recommended) in your LLM request.
AIGuard