{"id":21432,"library":"hiddenlayer-sdk","title":"HiddenLayer SDK","description":"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.","status":"active","version":"3.6.0","language":"python","source_language":"en","source_url":"https://github.com/hiddenlayerai/hiddenlayer-sdk-python","tags":["ai-security","ml-model-scanning","hiddenlayer","api-client"],"install":[{"cmd":"pip install hiddenlayer-sdk","lang":"bash","label":"Install the library"}],"dependencies":[{"reason":"Used for HTTP client. v3.x requires httpx >= 0.21.0","package":"httpx","optional":false},{"reason":"Used for data validation. v3.x requires pydantic >= 2.0.0","package":"pydantic","optional":false}],"imports":[{"note":"The package is installed as hiddenlayer-sdk, but the import module is 'hiddenlayer'.","wrong":"from hiddenlayer_sdk import HiddenLayer","symbol":"HiddenLayer","correct":"from hiddenlayer import HiddenLayer"},{"note":"The async client is exported from the main 'hiddenlayer' module.","wrong":"from hiddenlayer_sdk.async_client import HiddenLayerAsync","symbol":"HiddenLayerAsync","correct":"from hiddenlayer import HiddenLayerAsync"}],"quickstart":{"code":"import os\nfrom hiddenlayer import HiddenLayer\n\nclient = HiddenLayer(\n    api_key=os.environ.get('HIDDENLAYER_API_KEY', ''),\n    base_url=os.environ.get('HIDDENLAYER_BASE_URL', 'https://api.hiddenlayer.ai'),\n)\n\n# Example: list models\nmodels = client.models.list()\nprint(models)","lang":"python","description":"Initialize the client using environment variables for credentials, then make a sample API call."},"warnings":[{"fix":"Change imports to 'from hiddenlayer import ...'.","message":"In v3.0.0, the import path changed from 'hiddenlayer_sdk' to 'hiddenlayer'. All existing code using 'from hiddenlayer_sdk import ...' will break.","severity":"breaking","affected_versions":"<3.0.0 -> >=3.0.0"},{"fix":"Set 'HIDDENLAYER_API_KEY' environment variable.","message":"The 'HiddenLayerApiKey' environment variable is deprecated. Use 'HIDDENLAYER_API_KEY' instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Upgrade Python to 3.9 or later.","message":"The SDK requires Python >= 3.9. If using Python 3.8 or older, installation will fail.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Always use 'async with HiddenLayerAsync(...) as client:' or explicitly await client.close().","message":"When using async client, ensure you use the correct async context manager. Forgetting to await client.close() may cause resource leaks.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from hiddenlayer import HiddenLayer' instead of 'from hiddenlayer_sdk import HiddenLayer'.","cause":"The package is installed as 'hiddenlayer-sdk', but the import module is 'hiddenlayer' (not 'hiddenlayer_sdk').","error":"ModuleNotFoundError: No module named 'hiddenlayer_sdk'"},{"fix":"Run 'pip install hiddenlayer-sdk' to install the package.","cause":"The package may not be installed, or you are running in an environment where it's not available.","error":"ImportError: cannot import name 'HiddenLayer' from 'hiddenlayer' (unknown location)"},{"fix":"Set the environment variables before creating the client: HIDDENLAYER_API_KEY and HIDDENLAYER_BASE_URL.","cause":"Environment variables HIDDENLAYER_API_KEY or HIDDENLAYER_BASE_URL are not set, causing client to fail.","error":"AttributeError: 'NoneType' object has no attribute 'get'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}