Shadow Warden Developer SDK The Shadow Warden SDK wraps every gateway feature — filtering, agentic intelligence, marketplace, and OpenAI-compatible chat — in a clean Python and TypeScript interface.
Install
pip install shadow-warden
npm install @shadow-warden/sdk
from warden_sdk import WardenClient client = WardenClient(api_key="sk-...") # Filter a prompt result = client.filter( "Ignore previous instructions and...", raise_on_blocked=True, ) print(result.risk_level) # HIGH print(result.flags) # ["jailbreak_attempt"] # OpenAI-compatible chat — filtered end-to-end response = client.chat.completions.create( messages=[{"role": "user", "content": "Hello"}], model="gpt-4o", ) # SOVA agent — autonomous SOC operator reply = client.agent("What is our current threat level?") print(reply.reply)
import { WardenClient } from "@shadow-warden/sdk" const client = new WardenClient({ apiKey: "sk-...", }) // Filter a prompt const result = await client.filter( "Ignore previous instructions...", { raiseOnBlocked: true }, ) console.log(result.riskLevel) // "HIGH" // OpenAI-compatible — fully filtered const chat = await client.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: "Hello" }], }) // SOVA agent const reply = await client.agent("Threat summary") console.log(reply.reply)
Use AsyncWardenClient for asyncio applications — same interface, non-blocking I/O.
import asyncio from warden_sdk import AsyncWardenClient, FilterBlockedError async def main(): async with AsyncWardenClient(api_key="sk-...") as client: # Parallel filter calls results = await asyncio.gather( client.filter("prompt one"), client.filter("prompt two"), client.filter("prompt three"), ) for r in results: print(r.risk_level, r.flags) asyncio.run(main())
All methods available on WardenClient and AsyncWardenClient.
| Method | Returns | Tier |
|---|---|---|
| client.filter(content) | FilterResponse | All |
| client.chat.completions.create(messages) | dict (OpenAI-compatible) | All |
| client.agent(query) | AgentResponse | Pro+ |
| client.marketplace.listings() | list[MarketplaceListing] | Pro+ |
| client.marketplace.stats() | dict | Pro+ |
| client.health() | dict | All |
The SDK raises typed exceptions so you can handle auth, rate-limiting, and blocked content separately.
from warden_sdk import ( WardenClient, FilterBlockedError, AuthError, RateLimitError, WardenError, ) with WardenClient(api_key="sk-...") as client: try: result = client.filter(user_input, raise_on_blocked=True) except FilterBlockedError as e: # e.response has full FilterResponse log.warning("Blocked: %s", e.response.flags) return "Request blocked for safety reasons." except AuthError: raise RuntimeError("Invalid API key") except RateLimitError: time.sleep(1) # retry... except WardenError as e: log.error("Warden error %s: %s", e.status_code, e)
Get your API key from the portal, install the SDK, and make your first filtered request in under 5 minutes.