Return to AIPromptShield Platform
APS Gateway Documentation
APS Gateway Integration Guide
APS Gateway is a zero-latency in-memory reverse proxy compatible with OpenAI, Anthropic, Google Gemini, and open-weight models. Protect applications from prompt injections, mask sensitive PII, and quarantine rogue agent actions in 2 lines of code.
The 2-Line Drop-In Replacement< 14ms Mean Pipeline Latency
Line 1: Target Endpoint
baseURL = "https://gateway.aipromptshield.com/v1"Reroutes OpenAI/Anthropic SDK calls to your nearest in-memory APS Edge cluster.
Line 2: Security Policy
headers = { "X-APS-Policy": "strict-defense" }Activates heuristic classifiers, Presidio PII redaction, and vector anomaly isolation.
Python (OpenAI SDK v1.0+)
import os
from openai import OpenAI
# 2-Line Drop-In Proxy Integration:
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
base_url="https://gateway.aipromptshield.com/v1", # <-- Line 1: Reroute to APS Edge Proxy
default_headers={"X-APS-Policy": "strict-defense"} # <-- Line 2: Enforce zero-day guardrails
)
# Prompts & RAG contexts are scanned, PII masked, and validated in-flight (<40ms)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Analyze customer database record..."}]
)
print(response.choices[0].message.content)Node.js / TypeScript
import OpenAI from 'openai';
// 2-Line Drop-In Proxy Integration:
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'https://gateway.aipromptshield.com/v1', // <-- Line 1: APS Edge Proxy
defaultHeaders: { 'X-APS-Policy': 'strict-defense' }, // <-- Line 2: Security Policy
});
// Outbound calls are protected with Presidio PII masking and agent sandboxing
const response = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Process customer refund request...' }],
});
console.log(response.choices[0].message.content);LangChain & LangGraph
from langchain_openai import ChatOpenAI
# Drop-in LangChain / LangGraph Gateway integration
llm = ChatOpenAI(
model="gpt-4o",
temperature=0.2,
base_url="https://gateway.aipromptshield.com/v1",
default_headers={
"X-APS-Policy": "strict-defense",
"X-APS-PII-Masking": "presidio-strict",
"X-APS-Agent-Sandbox": "ephemeral-microvm"
}
)
# Multi-agent swarms execute with verified authority boundaries (OWASP ASI-01)
chain = prompt | llm
result = chain.invoke({"query": "Execute database summary"})APS Gateway HTTP Policy Headers Reference
| Header Name | Values | Description |
|---|---|---|
| X-APS-Policy | strict-defense | audit-only | Controls whether attacks are blocked (403) or flagged for telemetry without dropping the query. |
| X-APS-PII-Masking | presidio-strict | off | Enables Microsoft Presidio NER entity scrubbing (SSN, credit cards, emails, secret tokens). |
| X-APS-Agent-Sandbox | ephemeral-microvm | standard | Isolates autonomous agent tool calls (SQL, shell, webhooks) inside ephemeral Firecracker MicroVM containers. |
| X-APS-Evidence-Chain | eu-article12-sha256 | Attaches cryptographic SHA-256 hash provenance receipts to HTTP response headers. |