Skip to main content
This page explains which runtimes and dependencies the HiddenLayer SDKs support, how SDK version numbers are assigned, and how to upgrade without surprises. It also lists deprecated features that you should move away from. The information on this page applies to these releases: These releases include breaking changes:

Supported runtimes

The SDK requires Python 3.10 or later and is tested on Python 3.10 through 3.14.

Dependencies

When you install hiddenlayer-sdk, pip installs these dependencies within the following version ranges:Because the SDK supports both Pydantic v1 and v2, you can add it to a project that already depends on either version.The optional aiohttp extra (pip install "hiddenlayer-sdk[aiohttp]") adds aiohttp (>=3.14.1, <4) and httpx-aiohttp (>=0.1.8, <0.2.0). When they are installed, AsyncHiddenLayer sends its requests with aiohttp. The model scanning helpers for S3, Azure Blob Storage, and Hugging Face need packages that you install separately. See Installation.

Versioning policy

The SDKs follow Semantic Versioning (SemVer), apart from beta APIs. In a version number such as 4.3.1, the parts are MAJOR.MINOR.PATCH:
  • Major releases can include breaking changes.
  • Minor releases add features in a backwards-compatible way. A minor release often adds methods and fields for new API features.
  • Patch releases fix bugs.
Each SDK has its own version number. The three SDKs cover the same API, but their versions are not kept in step: for example, Python 6.0.0, TypeScript 5.0.0, and Java 6.0.0 are all current.

Beta APIs

Some HiddenLayer APIs are in beta, meaning they are not yet generally available (GA) or production ready. You can use them in production at your own risk. For beta APIs:
  • HiddenLayer does not provide compatibility guarantees. Breaking changes can happen at any time.
  • SDK methods and types for beta APIs are excluded when determining SemVer versions. A minor or patch release can change them.
Beta endpoints include the AI Attack Simulation (red team) endpoints, prompt sets, system prompt analysis, threat modeling, the v2 AI Asset Inventory endpoints, triage, and governance policy packs. The first call to each beta endpoint emits a warning that names the endpoint by HTTP method and path:
  • Python: a hiddenlayer.BetaWarning, once per endpoint per client. To handle it in code, see Error handling.
  • TypeScript: a console.warn, once per endpoint per process.
  • Java: a WARNING through the java.util.logging logger com.hiddenlayer.api.lib.BetaWarning, once per endpoint per JVM.
The Runtime Security v2 evaluation endpoints (/detection/v2/interaction-evaluations, /detection/v2/request-evaluations, and /detection/v2/response-evaluations) are not beta, and calling them emits no warning. For details, see the Beta API guidelines on the Developer Portal.

Check your installed version

Print the version your code is actually using:
Python
You can also ask pip. Run it with the same Python interpreter that runs your code (on Windows, py -m pip instead of python -m pip):
Python
If the version is older than you expect after an upgrade, your code is probably running in a different Python environment than the one you upgraded. See Troubleshooting.

Upgrade the SDK

Follow these steps to upgrade safely:
1

Review the changelog

Read the changelog for every version between your current version and the target version: Python, TypeScript, or Java. Look for deprecations, behavior changes, and changes to beta APIs you use. For a new major version, also read the upgrade notes on this page.
2

Upgrade in a test environment first

Create or activate a separate virtual environment, then upgrade:
Python
To install a specific version, use python -m pip install hiddenlayer-sdk==6.0.0.
3

Run your tests

Run your test suite, and your type checker or compiler. Watch for new deprecation messages and beta warnings, which point to code that you should update.
4

Pin the version

Pin the version so every environment installs the same one. Use an exact pin when you rely on beta APIs.
In requirements.txt or pyproject.toml, pin an exact version:
Python
If you use only GA APIs, you can allow compatible minor and patch releases:
Python

Upgrade notes

Requested scan location is optional

Python 6.0.0, TypeScript 5.0.0, and Java 6.0.0 make requested_scan_location optional on a scan’s inventory. The API leaves it out when a scan has no files, as for a model hosted by a provider such as AWS Bedrock or Microsoft Foundry. Handle a missing value where you read it:
  • Python: None when absent. In 5.0.0, client.scans.jobs.list raised ParsingError on a page that included such a scan.
  • TypeScript: undefined when absent.
  • Java: getRequestedScanLocation() returns an Optional<String>.

Scan result types changed

Python 5.0.0, TypeScript 4.3.0, and Java 4.0.0 change the scan result types to match what the API returns. TypeScript makes the change in a minor release, so a ^4.2.0 range in package.json picks it up. Update code that reads these values: These releases also fix oauth2.token, which failed with 401 in Python 4.0.0 and Java 3.0.0 when the client was built with a client ID and secret. In TypeScript 4.3.0, hfToken: true sends the Hugging Face token configured on your machine. See Scan a Hugging Face model.

Java folder-scan patterns changed

Java 5.0.0 changes how a folder scan matches its allow and ignore patterns, and always applies the default ignore patterns, as the Python and TypeScript SDKs do. Review the patterns you pass to ScanFolderOptions:
  • A pattern without a /, such as *.safetensors, matches a file’s name wherever the file is in the folder. Earlier versions matched every pattern against the file’s whole path, so such a pattern matched nothing.
  • A pattern with a /, such as onnx/*.bin, matches the file’s path inside the folder. A pattern that starts with the folder’s path as you passed it still matches.
  • The default ignore patterns now take effect, so .txt, .md, and .lock files and .gitattributes are no longer uploaded.
  • Your ignore patterns add to the defaults (ScanFolderOptions.DEFAULT_IGNORE_FILE_PATTERNS) instead of replacing them.
  • Patterns match only inside the folder, and as globs: ? no longer matches a /, and {a,b} matches either alternative.
See Scan a folder, and the 5.0.0 entry in the Java changelog for the full list.

Upgrading from an earlier major version

Python 4.0.0, TypeScript 4.0.0, and Java 3.0.0 cover the same API as the previous major versions. The package names, client classes, environment variables, model and community scanners, and (in Python) red team sessions stay. Every method the previous major had keeps its name and path. What changes is mostly how you configure the client, pass arguments, name types, and catch errors. Each SDK also gains every public API in the specification that the previous major didn’t cover. After you make these changes, apply the ones in Scan result types changed and, in Java, Java folder-scan patterns changed.
Python 3.x to 4.0.0. The full list is in BREAKING_CHANGES_v4.0.0.md. The changes most code needs:
  • Python 3.10 or later is required.
  • Client options: bearer_token becomes token, default_headers becomes headers, and http_client becomes httpx_client. client.with_options() and client.copy() are removed. So are client.close() and using the client as a context manager, until 6.0.0 adds them back: close() and with on HiddenLayer, and aclose() and async with on AsyncHiddenLayer.
  • Types are imported from hiddenlayer instead of hiddenlayer.types.*, and are named after the API’s schemas. The scan report is ScanReportOfRecordV3. hiddenlayer.ScanReport still imports, but it is a different type.
  • Errors: catch hiddenlayer.core.ApiError and typed errors such as hiddenlayer.UnauthorizedError instead of APIStatusError and its subclasses. Timeouts and failed connections raise httpx exceptions.
  • Per-request timeout, extra_headers, extra_query, and extra_body move into one request_options argument. with_raw_response returns an object whose .data replaces .parse().
  • scans.jobs.list and sensors.query return pagers. With the async client, await a pager before you iterate it.
  • runtime.evaluate_request and runtime.evaluate_response take the payload as request instead of body. prompt_analyzer.create takes requester_id instead of x_requester_id. scans.upload.file.complete takes the scan ID, then the file ID.
  • When both a token and client credentials are set, the token now wins. HIDDENLAYER_LOG and HIDDENLAYER_CUSTOM_HEADERS are no longer read.
  • Red team session errors are the documented ones: WorkflowNotFoundError where 3.x raised NotFoundError, and PollTimeoutError where 3.x raised a plain Exception for poll_max_wait.

Deprecated top-level fields on the scan report

These top-level scan report fields are deprecated. Read the same values from summary instead: summary.severity is also deprecated. Use summary.highest_severity. Some older examples, including examples/demo.py in the Python SDK repository, still use the deprecated top-level fields.

Scan reports are assembled from the summary and file results

The model scanning helpers in all three SDKs build the scan report the same way: they poll the scan summary endpoint until the scan finishes, then read the file results page by page. In Python, this behavior started in 3.10.0. The return type is the same full scan report. If you start a scan without waiting for results while it is still running, the report is a point-in-time snapshot. File results can be incomplete, so check the report’s status before you rely on them. See Model scanning.

Model cards listing is deprecated

models.cards.list (Python and TypeScript) and models().cards().list() (Java) are deprecated in favor of the GET /asset-inventory/v2/assets endpoint. The SDKs call that endpoint with asset_inventory.assets.list (Python), assetInventory.assets.list (TypeScript), and assetInventory().assets().list() (Java). The v2 AI Asset Inventory endpoints are in beta. The deprecated method still works, but avoid it in new code.

Sensor endpoints are deprecated

The sensor methods (create, retrieve, update, delete, and query on sensors) are deprecated. The API reference states that the endpoints will be removed after April 13, 2026. Do not use them in new code.

Python: start_session defaults changed in 3.8.0

In Python 3.8.0, client.evaluation_sessions.red_team.start_session stopped applying hard-coded defaults and now forwards all parameters to the API. If you upgrade from an earlier version and relied on the old defaults, review the arguments you pass. See AI Attack Simulation.

Upgrading from alpha versions

If you use a 0.x alpha release of the Python or TypeScript SDK, upgrade to the current major. The alpha releases included frequent API updates, and no migration guide from them is available. Review the changelog and test your code before you upgrade.

Upgrading from the legacy HiddenLayer SDK

The current SDKs replace an earlier HiddenLayer SDK. To ease the transition, the model scanner and community scanner helpers provide the same scanning functionality as the legacy SDK’s ModelScanAPI and community scan. Method names, parameters, and return types may still differ, and no migration guide from the legacy SDK is available. Test your scanning code against the current SDK before switching.

Next steps