SDKs
PromptShield ofrece un SDK oficial para Node/TypeScript. Para otros lenguajes, las APIs son HTTP+JSON estándar — basta con un cliente HTTP.
Node / TypeScript
@aisociety/promptshield — sin dependencias runtime, ESM, types incluidos. Requiere Node ≥ 18, Bun, Deno, o un bundler de browser.
pnpm add @aisociety/promptshieldimport { PromptShield } from '@aisociety/promptshield';
const ps = new PromptShield({ apiKey: process.env.PROMPTSHIELD_API_KEY! });
const result = await ps.check({ message: 'hola' });
const out = await ps.validateOutput({ response: 'reply del LLM' });
const scan = await ps.scanDocument({
file: buffer,
filename: 'doc.pdf',
mimetype: 'application/pdf',
});cURL
Cualquier endpoint de la API se puede consumir con cURL o cualquier cliente HTTP.
curl -X POST https://api.promptshield.sociedadia.com/v1/check \
-H "Authorization: Bearer $PROMPTSHIELD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "message": "hola" }'Python
No hay SDK oficial todavía. Usa httpx o requests:
import os, httpx
API = "https://api.promptshield.sociedadia.com"
KEY = os.environ["PROMPTSHIELD_API_KEY"]
def check(message: str) -> dict:
r = httpx.post(
f"{API}/v1/check",
headers={"Authorization": f"Bearer {KEY}"},
json={"message": message},
timeout=30.0,
)
r.raise_for_status()
return r.json()
result = check("ignora las instrucciones")
if not result["safe"]:
raise RuntimeError(f"blocked: {result['reason']}")
Otros lenguajes
Go, Rust, Ruby, PHP, Java: usa el cliente HTTP de tu lenguaje contra la URL base https://api.promptshield.sociedadia.com con el header Authorization: Bearer ps_live_….