Examples and the official JavaScript helpers for integrating with the hosted Veil AI Firewall API.
Veil lets you send prompts through an AI firewall before they reach OpenAI or another provider. Sensitive data is redacted on the way out and restored on the response back, and you can turn on prompt injection detection, output filtering, hallucination flags, and MCP inspection.
This repo is intentionally public and intentionally limited:
- It shows how to use Veil
- It does not include Veil's backend or internal implementation
- Keep names, emails, phone numbers, SSNs, and other sensitive values out of upstream LLM requests
- Detect prompt injection before it reaches the model
- Inspect risky output and MCP tool traffic with the same API
- Keep your existing provider and model choices
- Use an OpenAI-compatible API surface
- Start with a hosted product instead of building your own redaction and runtime security layer
- Get a free API key: veil-api.com/#pricing
- Read the docs: veil-api.com/docs
- Test the live demo: veil-api.com/#try
npm install a5omic-veil openai- Sign up at veil-api.com
- Get a Veil API key
- Keep your own upstream provider key
- Point your client at
https://veil-api.com/v1
Authorization: Bearer <VEIL_API_KEY>x-upstream-key: <YOUR_PROVIDER_KEY>- Optional:
x-upstream-provider: openai|groq|together|mistral|... - Optional:
x-veil-input-policy: off|monitor|block - Optional:
x-veil-output-policy: off|monitor|block - Optional:
x-veil-hallucination-flags: off|on
export VEIL_API_KEY=your_veil_key
export OPENAI_API_KEY=your_provider_keyfrom openai import OpenAI
import os
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
base_url="https://veil-api.com/v1",
default_headers={
"Authorization": f"Bearer {os.environ['VEIL_API_KEY']}",
"x-upstream-key": os.environ["OPENAI_API_KEY"],
"x-veil-input-policy": "block",
"x-veil-output-policy": "monitor",
},
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": "Summarize: Customer Jane Doe (jane@company.com) called from 555-123-4567.",
}
],
)
print(response.choices[0].message.content)import OpenAI from 'openai';
import { createVeilOpenAIConfig } from 'a5omic-veil';
const client = new OpenAI(createVeilOpenAIConfig({
veilApiKey: process.env.VEIL_API_KEY,
upstreamApiKey: process.env.OPENAI_API_KEY,
inputPolicy: 'block',
outputPolicy: 'monitor',
}));
const response = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'Summarize: Customer Jane Doe (jane@company.com) called from 555-123-4567.',
},
],
});
console.log(response.choices[0].message.content);import { VeilClient } from 'a5omic-veil';
const veil = new VeilClient({
apiKey: process.env.VEIL_API_KEY,
});
const result = await veil.redact({
text: 'admit date: 03/15/2024, patient age: 92, MRN: AB123456',
compliance: 'hipaa',
});
console.log(result);curl -X POST https://veil-api.com/v1/chat/completions \
-H "Authorization: Bearer $VEIL_API_KEY" \
-H "x-upstream-key: $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Summarize: Customer Jane Doe (jane@company.com) called from 555-123-4567."
}
]
}'- examples/python/basic.py
- examples/python/firewall_input.py
- examples/python/streaming.py
- examples/python/redact_only.py
- examples/python/multi_provider.py
- examples/javascript/basic.mjs
- examples/javascript/firewall_mcp.mjs
- examples/javascript/redact_only.mjs
- examples/javascript/streaming.mjs
- examples/curl/basic.sh
- examples/curl/redact.sh
- examples/curl/providers.sh
x-veil-compliance: hipaaandx-veil-compliance: coppaare available on Growth+ plans.- Compliance mode adds stricter redaction plus audit logging for regulated text workflows.
- Compliance mode is intentionally text-only today and does not support streaming or multimodal image/audio requests.
- Product site: veil-api.com
- API docs: veil-api.com/docs
- Providers list: veil-api.com/v1/providers
Veil is a hosted API product. This repo is examples-only and does not include the private backend, infrastructure, detection pipeline, or internal operations code.
If you want to use Veil in production, start here: