Skip to main content

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 httpx

Node.js SDK

npm install prompt-inspectorNode.js 14+ · TypeScript-first · Promise-based · Zero dependencies

Feature Comparison

Common Concepts

Client Initialization

All SDKs follow the same pattern:
  1. Create a client instance with your API key
  2. Call detect(text) to analyze input
  3. Read the DetectionResult
  4. Close the client when done

Authentication

The API key can be provided in two ways (both SDKs):
  • Directly — Pass api_key (Python) or apiKey (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 errors
  • AuthenticationError — Invalid or missing API key
  • ValidationError — Invalid input (empty text, text too long)
  • APIError — Server returned an error (includes status_code / statusCode)
  • TimeoutError — Request exceeded timeout
  • ConnectionError — Cannot reach the API server
See Error Handling for detailed examples.

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 with X-App-Key header authentication.

API Reference

See the full REST API documentation for direct HTTP integration.