Skip to content

Atomics-hub/veil-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Veil AI Firewall Examples

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

Why Veil

  • 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

Start Free

Install the JS Package

npm install a5omic-veil openai

Get Started

  1. Sign up at veil-api.com
  2. Get a Veil API key
  3. Keep your own upstream provider key
  4. 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|...
  • Optional: x-veil-input-policy: off|monitor|block
  • Optional: x-veil-output-policy: off|monitor|block
  • Optional: x-veil-hallucination-flags: off|on

Environment Variables

export VEIL_API_KEY=your_veil_key
export OPENAI_API_KEY=your_provider_key

Quick 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"],
        "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)

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,
  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);

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 (jane@company.com) called from 555-123-4567."
      }
    ]
  }'

Example Files

Compliance Modes

  • x-veil-compliance: hipaa and x-veil-compliance: coppa are 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

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:

Releases

No releases published

Packages

 
 
 

Contributors