EdgeMask Logo
Docs
Quick Start

The 1-Line Integration

EdgeMask is a drop-in replacement for any OpenAI-compatible SDK. No new libraries. No complex configuration. Just change one line.

How It Works

01

Change your base URL

Point your OpenAI SDK to EdgeMask's global edge network instead of OpenAI directly. All requests are proxied securely.

02

Keep your OpenAI key

Your API key is forwarded securely through the gateway and is never stored or logged. Zero-retention policy.

03

Add your EdgeMask key

Authenticate with your EdgeMask API key via the X-EdgeMask-Key header for access control and billing.

Node.js / TypeScript Example

Complete integration example using the official OpenAI SDK.

app/api/chat.ts
TypeScript
import OpenAI from 'openai';
const openai = new OpenAI({
// 1. Route through EdgeMask Global Edge Nodes
baseURL: 'https://api.edgemask.pro/v1',
// 2. Your OpenAI Key (Forwarded securely, never stored)
apiKey: process.env.OPENAI_API_KEY,
// 3. Authenticate with your EdgeMask Key
defaultHeaders: {
'X-EdgeMask-Key': process.env.EDGEMASK_API_KEY,
},
});
// Use the SDK as usual. EdgeMask handles the rest.
const response = await openai.chat.completions.create({
model: 'gpt-4o',
messages: [
{
role: 'user',
content: 'Patient John Doe (SSN: 123-45-6789) is ready for discharge.',
},
],
});

What Happens Behind the Scenes

  • Your prompt is intercepted at the nearest edge node
  • PII/PHI entities are detected and masked in real-time
  • Semantic cache is checked for similar previous queries
  • Sanitized prompt is forwarded to OpenAI (or served from cache)
  • Response is returned to your app — clean and cost-optimized