@a5omic/veil
v0.1.0
Published
Official JavaScript helpers for the hosted Veil API
Maintainers
Readme
Veil Examples
Examples and the official JavaScript helpers for integrating with the hosted Veil API.
Veil lets you send prompts through a privacy layer before they reach OpenAI or another provider. Sensitive data is redacted on the way out and restored on the response back.
This repo is intentionally public and intentionally limited:
- It shows how to use Veil
- It does not include Veil's backend or internal implementation
Why Veil
- Keep names, emails, phone numbers, SSNs, and other sensitive values out of upstream LLM requests
- Keep your existing provider and model choices
- Use an OpenAI-compatible API surface
- Start with a hosted product instead of building your own redaction layer
Start Free
- Get a free API key: veil-api.com/#pricing
- Read the docs: veil-api.com/docs
- Test the live demo: veil-api.com/#try
Install the JS Package
npm install @a5omic/veil openaiGet Started
- 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
Required Headers
Authorization: Bearer <VEIL_API_KEY>x-upstream-key: <YOUR_PROVIDER_KEY>- Optional:
x-upstream-provider: openai|groq|together|mistral|...
Environment Variables
export VEIL_API_KEY=your_veil_key
export OPENAI_API_KEY=your_provider_keyQuick Example: Python
from 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"],
},
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": "Summarize: Customer Jane Doe ([email protected]) called from 555-123-4567.",
}
],
)
print(response.choices[0].message.content)Quick Example: JavaScript
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,
}));
const response = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'Summarize: Customer Jane Doe ([email protected]) called from 555-123-4567.',
},
],
});
console.log(response.choices[0].message.content);Redact-Only Example: JavaScript
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);Quick Example: cURL
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 ([email protected]) called from 555-123-4567."
}
]
}'Example Files
- examples/python/basic.py
- examples/python/streaming.py
- examples/python/redact_only.py
- examples/python/multi_provider.py
- examples/javascript/basic.mjs
- examples/javascript/redact_only.mjs
- examples/javascript/streaming.mjs
- examples/curl/basic.sh
- examples/curl/redact.sh
- examples/curl/providers.sh
Compliance Modes
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.
Docs
- Product site: veil-api.com
- API docs: veil-api.com/docs
- Providers list: veil-api.com/v1/providers
Hosted Product
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:
