Official SDKs
Prompt Inspector provides official SDKs for the most popular server-side languages. Each SDK wraps the Detection API with a convenient, idiomatic interface and built-in error handling.Python SDK
pip install prompt-inspectorPython 3.8+ · Synchronous · Context manager support · Built on httpxNode.js SDK
npm install prompt-inspectorNode.js 14+ · TypeScript-first · Promise-based · Zero dependenciesFeature Comparison
Common Concepts
Client Initialization
All SDKs follow the same pattern:- Create a client instance with your API key
- Call
detect(text)to analyze input - Read the
DetectionResult - Close the client when done
Authentication
The API key can be provided in two ways (both SDKs):- Directly — Pass
api_key(Python) orapiKey(Node.js) to the constructor - Environment variable — Set
PMTINSP_API_KEY; the SDK reads it automatically
Detection Result
Both SDKs return a result object with these fields:Error Handling
Both SDKs provide the same exception hierarchy:PromptInspectorError— Base class for all SDK errorsAuthenticationError— Invalid or missing API keyValidationError— Invalid input (empty text, text too long)APIError— Server returned an error (includesstatus_code/statusCode)TimeoutError— Request exceeded timeoutConnectionError— Cannot reach the API server
Using the REST API Directly
If your language or platform doesn’t have an official SDK, you can call the Detection API directly via HTTP. The API uses simple JSON request/response withX-App-Key header authentication.
API Reference
See the full REST API documentation for direct HTTP integration.

