Skip to main content
There are two ways to integrate. The official SDK wraps the scan API and the reverse‑proxy configuration behind a typed client. Or, because the LLM vendor SDKs already accept base_url and default_headers, you can point them at the firewall with no extra dependency at all. The snippets below cover both.

Official SDK

TypeScript / Node.js

@blindsight/security, available now on npm.

Python

blindsight-security, coming soon.

TypeScript / Node.js

Node.js 18+ (or any runtime with a global fetch), zero runtime dependencies. Scan the prompt before the model, and the response before the user:
The client exposes scanInput, scanOutput, scanFile, scanToolCall, and scanBatch. Every result carries uuid, verdict, injection, pii, redactedText, blockedReason, latencyMs, and textLength, plus the boolean flags allowed / flagged / redacted / blocked and the convenience accessors safeText, injectionScore, piiCategories, and raw (the full JSON response). assertNotBlocked(result) throws ContentBlockedError on a block verdict. Files and agent tool‑calls use the same client:
To route a vendor client through the reverse proxy without writing explicit scan calls, spread a proxy helper into the client options:
rs.proxy.gemini(), rs.proxy.vertex(), rs.proxy.bedrock(), and rs.proxy.openaiCompatible({ provider: "groq" }) cover the rest. Each returns { baseURL, defaultHeaders }, ready to spread. All exceptions derive from BlindsightError: BlindsightApiError (with .statusCode and .code, specialised as BlindsightAuthError on 401/403 and BlindsightQuotaError on 402/429), BlindsightConnectionError, and ContentBlockedError.

Python

The Python SDK (blindsight-security) is coming soon. Its surface mirrors the TypeScript client with snake‑case names (rs.scan_input(...), verdict.blocked, verdict.safe_text). Until it ships, use the dependency‑free httpx pattern below, which is functionally identical.

Python: explicit scan calls (no SDK)

The portable pattern: scan input, call your model, scan output.

Node: reverse proxy (no SDK)

The shortest integration possible: swap one URL.

curl: agent tool‑call gate

The minimal one‑liner before a tool dispatch.

LangChain

LangChain’s ChatOpenAI is a thin wrapper over the OpenAI Python SDK and forwards base_url and default_headers. Point those at the Blindsight reverse proxy and every LangChain call, chains, retrievers, agent LLM steps, flows through Runtime Security.
init_chat_model("openai:gpt-4o", base_url=..., default_headers=...) works the same way for projects that use the model‑string indirection. For Anthropic, swap to ChatAnthropic from langchain-anthropic, point base_url at /api/runtime-security/proxy/anthropic, and pass the Blindsight key on X-Blindsight-Key (Anthropic reserves x-api-key for the upstream provider).
Want event metadata tagged with LangChain run_id? Add a small BaseCallbackHandler that posts to /scan/input from on_llm_start with metadata={"langchain_run_id": str(run_id)}. The handler can’t rewrite the prompt (observability‑only) but the events show up in the dashboard joined to your LangChain traces.

LlamaIndex

LlamaIndex’s OpenAI LLM accepts api_base and default_headers:
To apply this globally across query engines, retrievers, and agents:
For Anthropic, from llama_index.llms.anthropic import Anthropic with api_base="/api/runtime-security/proxy/anthropic" and the Blindsight key on X-Blindsight-Key.
Agent tool calls. The proxy sees LLM traffic but not the agent runtime’s execution of a tool. If you need scan/tool-call coverage on FunctionCallingAgent or ReActAgent tool dispatches, wrap your FunctionTool so its fn posts to /api/runtime-security/scan/tool-call before invoking the real function. Same pattern works for LangChain AgentExecutor’s BaseTool.

Picking a pattern

Reverse proxy (Python or Node). One config change, full coverage.
Scan API. Two HTTP calls per request, full control over what you do with each verdict.
Reverse proxy for the LLM, plus tool‑call scan wrapping every tool dispatch. The two combine to cover the whole loop.
Scan API /scan/batch. Up to 32 items per call, one license unit per item, much cheaper HTTP overhead.