hiddenlayer-sdk
The official Python library for the hiddenlayer API
What it is and what it does
hiddenlayer-sdk is an official Python client library for the HiddenLayer REST API, generated using Stainless. It wraps HiddenLayer's security and AI analysis endpoints with full type hints, Pydantic models for responses, and TypedDict for request parameters. The library ships both synchronous (HiddenLayer) and asynchronous (AsyncHiddenLayer) clients, both backed by httpx for HTTP transport.
It is designed for developers integrating HiddenLayer's security analysis into Python applications. The package handles authentication via bearer token, supports multiple environments (prod-us, prod-eu), and includes auto-paginating iterators for list endpoints. Error handling distinguishes between connection failures (APIConnectionError), rate limits (RateLimitError), and HTTP status errors (APIStatusError). Type definitions enable IDE autocomplete and early error detection.
Use it for:
- Integrate HiddenLayer's model interaction analysis into a Python application to detect security risks in LLM inputs and outputs.
- Build a monitoring service that periodically calls HiddenLayer's API to analyze model behavior and log results.
- Implement async batch analysis of multiple model interactions using AsyncHiddenLayer for concurrent API requests.
- Fetch and iterate through paginated lists of model cards or analysis results without manual page-handling logic.
- Catch and handle API errors (rate limits, auth failures, connection issues) with specific exception types in production workflows.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a typed Python client for the HiddenLayer REST API, with both synchronous and asynchronous interfaces powered by httpx.
Yes. The package is actively maintained (released 4 days ago), has no known vulnerabilities, low install friction, and is the official SDK for HiddenLayer's API. Use it if you need to integrate HiddenLayer's security analysis into a Python application. The permissive Apache-2.0 license and broad Python version support make adoption straightforward.
Install
hiddenlayer-sdk on PyPI
pip
pip install hiddenlayer-sdkuv
uv add hiddenlayer-sdkpoetry
poetry add hiddenlayer-sdkInstalling hiddenlayer-sdk
Before you install
Low friction: pure Python wheel with no compiled dependencies. Active maintenance—last commit 2026-08-13, released 4 days ago. Supports Python 3.9 through 3.14.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install hiddenlayer-sdk
from hiddenlayer import HiddenLayer
client = HiddenLayer(environment="prod-eu")
response = client.interactions.analyze(
metadata={"model": "gpt-4", "requester_id": "user-id"},
input={"messages": [{"role": "user", "content": "hello"}]}
)
print(response.analysis)
Requires HIDDENLAYER_TOKEN environment variable or explicit bearer_token; Python 3.9 or later.
Verify before relying
- Whether the monthly downloads reflect active production use or test/CI installations.
- What specific HiddenLayer API endpoints and features are covered by this SDK version.
- Whether Beta APIs marked in the documentation carry breaking-change risk for production deployments.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 9 — anyio, distro, httpx, pydantic, requests-auth, requests, sniffio, types-requests, typing-extensions |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 96,097/month — #13,231 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hiddenlayer_sdk-3.9.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
bilibili-api-pythonProvides async Python bindings for Bilibili's…
copyleft · top 15,000 on PyPI
lithicProvides a typed Python client for the Lithic…
permissive · top 15,000 on PyPI
opencode-aiProvides a Python client library for the…
permissive · top 15,000 on PyPI
agentex-clientProvides a typed Python REST client for the…
permissive · top 15,000 on PyPI
composio-clientA Python client library for the Composio REST…
permissive · top 5,000 on PyPI
groqProvides a Python client library for accessing…
permissive · top 1,000 on PyPI
llama-api-clientProvides a typed Python client for the Llama…
permissive · top 15,000 on PyPI
socketdevA Python SDK that wraps the Socket.dev REST…
permissive · top 15,000 on PyPI
steel-sdkProvides a typed Python client for the Steel…
permissive · top 15,000 on PyPI
simple-rest-clientA lightweight HTTP client library for building…
unclear · top 15,000 on PyPI