Skip to main content
PromptGuard has two SDKs, for Python and for Node.js. Both do the same two things: init() patches the LLM provider SDKs you already use so every call is scanned before it is sent (auto-instrumentation), and a Guard client calls the Guard API directly when you want to scan text yourself. Both are open source on GitHub.

Get started

Quickstart

Get an API key, install the SDK and see a request blocked, in about five minutes.

How-to guides

Python SDK

Install, initialise, the Guard client, error handling and retries.

Node.js SDK

The same for Node.js, plus the Vercel AI SDK middleware.

Frameworks

LangChain, LangGraph, LlamaIndex, CrewAI, FastAPI and the Vercel AI SDK.

Migrate from OpenAI

Move an OpenAI integration onto the proxy instead of the SDK.

Reference

Python SDK reference

Every public class, function and method, generated from the published package.

Node.js SDK reference

The same for the npm package.

Auto-instrumentation

Which provider calls init() patches, which it does not, and how to check.

Error handling

Every error code the API returns, and how to handle each one.

Upgrading

Upgrade to SDK and CLI 2.0

What 2.0.0 removed, what to use instead, and how to find the calls.

Versioning and support

How long each SDK major version gets fixes.

Troubleshooting

Troubleshooting

Authentication, connection, blocked-request and streaming problems, with the fix for each.
Last modified on October 31, 2026