Registry / ai-ml / hiddenlayer-sdk

hiddenlayer-sdk

JSON →
library3.7.1pypypi✓ verified 84d ago

The official Python library for the HiddenLayer API, providing access to AI security and model scanning services. Current version 3.6.0, released April 2026, with frequent updates aligned to API changes.

pip install hiddenlayer-sdk
INSTALL
IMPORT
SIG · HIDDENLAYER-SDK
H
hiddenlayer-sdk
ai-mlpythonv3.7.1
Install
4.4s avg
Import
879ms
Disk
35MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.912s · 36.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.4s · import 0.846s · 36MB
35MB installed
● package 35MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HiddenLayer
from hiddenlayer import HiddenLayer
from hiddenlayer_sdk import HiddenLayer
The package is installed as hiddenlayer-sdk, but the import module is 'hiddenlayer'.
HiddenLayerAsync
from hiddenlayer import HiddenLayerAsync
from hiddenlayer_sdk.async_client import HiddenLayerAsync
The async client is exported from the main 'hiddenlayer' module.

Initialize the client using environment variables for credentials, then make a sample API call.

import os from hiddenlayer import HiddenLayer client = HiddenLayer( api_key=os.environ.get('HIDDENLAYER_API_KEY', ''), base_url=os.environ.get('HIDDENLAYER_BASE_URL', 'https://api.hiddenlayer.ai'), ) # Example: list models models = client.models.list() print(models)
Debug
Known issues
breakingIn v3.0.0, the import path changed from 'hiddenlayer_sdk' to 'hiddenlayer'. All existing code using 'from hiddenlayer_sdk import ...' will break.
fix
Change imports to 'from hiddenlayer import ...'.
affects: <3.0.0 -> >=3.0.0
deprecatedThe 'HiddenLayerApiKey' environment variable is deprecated. Use 'HIDDENLAYER_API_KEY' instead.
fix
Set 'HIDDENLAYER_API_KEY' environment variable.
affects: >=3.0.0
gotchaThe SDK requires Python >= 3.9. If using Python 3.8 or older, installation will fail.
fix
Upgrade Python to 3.9 or later.
affects: >=3.0.0
gotchaWhen using async client, ensure you use the correct async context manager. Forgetting to await client.close() may cause resource leaks.
fix
Always use 'async with HiddenLayerAsync(...) as client:' or explicitly await client.close().
affects: >=3.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'hiddenlayer_sdk'
The package is installed as 'hiddenlayer-sdk', but the import module is 'hiddenlayer' (not 'hiddenlayer_sdk').
fix
Use 'from hiddenlayer import HiddenLayer' instead of 'from hiddenlayer_sdk import HiddenLayer'.
ImportError: cannot import name 'HiddenLayer' from 'hiddenlayer' (unknown location)
The package may not be installed, or you are running in an environment where it's not available.
fix
Run 'pip install hiddenlayer-sdk' to install the package.
AttributeError: 'NoneType' object has no attribute 'get'
Environment variables HIDDENLAYER_API_KEY or HIDDENLAYER_BASE_URL are not set, causing client to fail.
fix
Set the environment variables before creating the client: HIDDENLAYER_API_KEY and HIDDENLAYER_BASE_URL.
Upgrade
Version history
3.7.1latest on PyPI · released May 14, 2026
Audit
Dependencies
httpxrequiredUsed for HTTP client. v3.x requires httpx >= 0.21.0
pydanticrequiredUsed for data validation. v3.x requires pydantic >= 2.0.0
Agent activity
31 hits · last 30 days
node
30
OpenAI (training)
1
Resources
hiddenlayer-sdk — pip install hiddenlayer-sdk · libregistry