@privedge/sdk@0.2.0 — shipped ·

Privacy on
the edge.

An AI inference proxy that detects sensitive data in your prompts and routes it to edge models — so PII never leaves the node closest to your user.

Drop-in OpenAI SDK replacement 200+ edge nodes HIPAA · GDPR · PCI
How it works

One proxy.
Two destinations.

Privedge sits between your app and the AI API. Every prompt is inspected at the edge — sensitive data is answered locally, everything else continues to the cloud.

CLIENTPRIVEDGE PROXYAI MODEL APIYour appai.chat.completionsPrivedge ProxyPII scan · edge runtimedetect()PII →clean →
EDGE · LOCAL
PII →
Local AI Model on the edge · 1B
200+ nodes~130 mson-deviceHIPAA-safe
CLOUD · REMOTE
clean →
OpenAI · Anthropic
gpt-4claudepass-throughaudited
01Inspect

Each prompt is scanned for PII before a single token is sent anywhere.

02Route

Sensitive prompts go to the edge model. The data never leaves the node.

03Return

Clean prompts hit OpenAI or Anthropic as usual — zero added latency.

Live · try it

Watch a prompt get routed.

Detection runs on every keystroke, exactly like the worker at the edge. Add an email or an SSN and watch the route flip.

ROUTED → EDGE
prompt
7 matches · regex detector v1
ROUTED TO
Edge model

7 sensitive entities detected. This prompt stays on the local node — nothing reaches a third-party API.

Medical term ×4ES DNIEmailPhone
res.json()
{
  "routed_to": "edge",
  "model": "@cf/meta/llama-3.2-1b",
  "pii_matches": 7,
  "latency_ms": 179
}
What we detect

Sensitive data, caught
before it leaves.

v1 ships a fast regex detector. v2 adds a named-entity model on Workers AI.

US SSN
123-45-6789
ES DNI / NIF
53412987Z
IBAN
ES91 2100 0418 45••
Email
maria@clinic.es
Phone
+1 555 203 9981
Card number
4716 •••• •••• 9012
Medical terms
diagnosis · dosage
Custom rules
your own regex →
Drop-in SDK

Change one import.
Keep your whole stack.

@privedge/sdk mirrors the OpenAI client one-to-one. Swap the import, point at your worker, and routing happens transparently.

ESM + CJSships both module formats, fully typed.
Zero added latencyclean prompts pass straight through.
routed_to on every responseaudit exactly where each request went.
import Privedge from '@privedge/sdk'

// Same surface as the OpenAI SDK — change one import.
const ai = new Privedge({
  apiKey: 'YOUR_OPENAI_KEY',
  workerUrl: 'https://privedge.workers.dev',
  compliance: 'hipaa',
})

const res = await ai.chat.completions.create({
  model: 'gpt-4',
  messages: [{ role: 'user', content: prompt }],
})

console.log(res.routed_to) // 'edge' | 'cloud'

Built for compliance from request one.

HIPAA

US health data — PHI never reaches a third-party API.

GDPR

EU personal data stays within the processing region.

PCI DSS

Card numbers are detected and kept off the cloud path.