These releases include breaking changes:
- Python 6.0.0, TypeScript 5.0.0, and Java 6.0.0 make a scan’s requested scan location optional. See Requested scan location is optional.
- Python 5.0.0, TypeScript 4.3.0, and Java 4.0.0 change the scan result types. See Scan result types changed.
- Java 5.0.0 changes how folder scans match file patterns. See Java folder-scan patterns changed.
- Python 4.0.0, TypeScript 4.0.0, and Java 3.0.0 changed how you configure the client, pass arguments, name types, and catch errors. See Upgrading from an earlier major version.
Supported runtimes
- Python
- TypeScript
- Java
The SDK requires Python 3.10 or later and is tested on Python 3.10 through 3.14.
Dependencies
- Python
- TypeScript
- Java
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 as4.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.
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.
- 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
WARNINGthrough thejava.util.loggingloggercom.hiddenlayer.api.lib.BetaWarning, once per endpoint per JVM.
/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
- Python
- TypeScript
- Java
Print the version your code is actually using:You can also ask pip. Run it with the same Python interpreter that runs your code (on Windows, 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.
Python
py -m pip instead of python -m pip):Python
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
- Python
- TypeScript
- Java
Create or activate a separate virtual environment, then upgrade:To install a specific version, use
Python
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.
- Python
- TypeScript
- Java
In If you use only GA APIs, you can allow compatible minor and patch releases:
requirements.txt or pyproject.toml, pin an exact version:Python
Python
Upgrade notes
Requested scan location is optional
Python 6.0.0, TypeScript 5.0.0, and Java 6.0.0 makerequested_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:
Nonewhen absent. In 5.0.0,client.scans.jobs.listraisedParsingErroron a page that included such a scan. - TypeScript:
undefinedwhen absent. - Java:
getRequestedScanLocation()returns anOptional<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 toScanFolderOptions:
- 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 asonnx/*.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.lockfiles and.gitattributesare 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.
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
- TypeScript
- Java
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_tokenbecomestoken,default_headersbecomesheaders, andhttp_clientbecomeshttpx_client.client.with_options()andclient.copy()are removed. So areclient.close()and using the client as a context manager, until 6.0.0 adds them back:close()andwithonHiddenLayer, andaclose()andasync withonAsyncHiddenLayer. - Types are imported from
hiddenlayerinstead ofhiddenlayer.types.*, and are named after the API’s schemas. The scan report isScanReportOfRecordV3.hiddenlayer.ScanReportstill imports, but it is a different type. - Errors: catch
hiddenlayer.core.ApiErrorand typed errors such ashiddenlayer.UnauthorizedErrorinstead ofAPIStatusErrorand its subclasses. Timeouts and failed connections raisehttpxexceptions. - Per-request
timeout,extra_headers,extra_query, andextra_bodymove into onerequest_optionsargument.with_raw_responsereturns an object whose.datareplaces.parse(). scans.jobs.listandsensors.queryreturn pagers. With the async client,awaita pager before you iterate it.runtime.evaluate_requestandruntime.evaluate_responsetake the payload asrequestinstead ofbody.prompt_analyzer.createtakesrequester_idinstead ofx_requester_id.scans.upload.file.completetakes the scan ID, then the file ID.- When both a token and client credentials are set, the token now wins.
HIDDENLAYER_LOGandHIDDENLAYER_CUSTOM_HEADERSare no longer read. - Red team session errors are the documented ones:
WorkflowNotFoundErrorwhere 3.x raisedNotFoundError, andPollTimeoutErrorwhere 3.x raised a plainExceptionforpoll_max_wait.
Deprecated top-level fields on the scan report
These top-level scan report fields are deprecated. Read the same values fromsummary 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’sstatus 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 a0.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’sModelScanAPI 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
- Installation: install or reinstall the SDK.
- Security and production guidance: pin versions and configure the client for production.
- API reference: find every resource and method.

