PYTHON SDK · v1.0.5 STABLE

PrivoNest AI Privacy Gateway SDK

Install one Python package for two developer workflows: protect textual LLM inputs with Guard(), and scan supported Python/JavaScript/TypeScript project code with API Security Preflight v1.0.5. Both use the same PrivoNest API key and credit wallet.

from openai import OpenAI
from privonest_guardrail import Guard

guard = Guard()
client = guard.wrap(OpenAI())
01

App prompt

Your backend receives normal user text.

02

PrivoNest detect

The SDK asks your PrivoNest API for detected spans.

03

Protected LLM call

The model can receive [PN_NAME_1] instead of the raw name.

04

Restore

Exact placeholders can be restored using short-lived application-side memory.

Document & Data Boundary

File protection stays in the PrivoNest REST API

The current Guard().wrap(...) SDK automatically protects textual LLM inputs. PDF, DOCX, XLSX, CSV, images, email, DICOM and transcript processing are handled by the existing POST /v1/hide multipart/document API rather than being silently intercepted as provider file uploads.

POST /v1/hide
X-API-Key: YOUR_KEY
Content-Type: multipart/form-data

file = customer.pdf
strategy = redact
country = PK

This separation keeps the SDK's automatic LLM interception behavior explicit and avoids claiming provider-specific binary upload transformation that the current Guard wrapper does not implement.

API Security Preflight · v1.0.5

Scan the project before you deploy it

The same SDK includes a stable API-security client and CLI. It collects supported project source/dependency files, authenticates with your PrivoNest key, and returns findings from the private PrivoNest API Security Engine.

62 detector categories
Python AST + cross-file graph
Root-cause triage + reachability
Private npm/PyPI intelligence
Baseline / policy / SARIF
# scan current project
privonest .

# release gate: only new high+ findings
privonest . \
  --baseline baseline.json \
  --new-only \
  --fail-on high

# export SARIF
privonest . --sarif privonest.sarif
Source-code privacy: v1.0.5 scans run in PrivoNest's own API Security Engine. Source code is not forwarded to Qwen or another external AI, and customer package names are not queried live against npm/PyPI during the scan.

Where do I deploy the SDK?

You do not deploy it as a separate website. Install it into the Python backend that already calls OpenAI, Claude, Gemini, Ollama or a framework LLM.

Keep both the PrivoNest API key and the LLM provider key on the server side. Do not put them into frontend JavaScript.
# after extracting the SDK
pip install ./privonest_guardrail_sdk

# Linux/macOS
export PRIVONEST_API_KEY="YOUR_KEY"

# PowerShell
$env:PRIVONEST_API_KEY="YOUR_KEY"
Bring your own AI

OpenAI Is an Adapter, Not a Dependency

PrivoNest does the privacy work. The customer's chosen model provider does the AI work. A customer can keep OpenAI today and switch to Claude, Gemini or a local Ollama client later without changing the purpose of PrivoNest.

1. Application receives the original prompt
2. Guard asks PrivoNest for sensitive spans
3. Guard replaces exact spans with scoped aliases
4. Protected prompt goes to the selected AI provider
5. Matching aliases in the response are restored
Customer owns:
  PRIVONEST_API_KEY
  + provider API key

PrivoNest handles:
  detect → alias → restore

Provider handles:
  reasoning / generation

Provider can be changed by the app.

Adapter examples

OPENAI
Guard().wrap(OpenAI())
CLAUDE
Guard().wrap(Anthropic())
GEMINI
Guard().wrap(genai.Client())
OLLAMA
Guard().wrap(ollama.Client())
LANGCHAIN
Guard().wrap(ChatOpenAI(...))
LLAMAINDEX
Guard().wrap(OpenAI(...))

The PrivoNest SDK package is v1.0.5 stable. Provider adapters still depend on third-party SDK method shapes, so integration-test the exact provider/library versions used by your application. Need help? Open the private SDK support form