> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hiddenlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Version compatibility and upgrades

> Check which runtimes and dependencies the HiddenLayer SDKs support, understand their versioning policy, and upgrade safely.

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:

| SDK | Package | Version |
| - | - | - |
| Python | `hiddenlayer-sdk` on PyPI | 6.0.0 |
| TypeScript | `@hiddenlayerai/hiddenlayer-sdk` on npm | 5.0.0 |
| Java | `com.hiddenlayer.api:hiddenlayer-java` on Maven Central | 6.0.0 |

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](#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](#scan-result-types-changed).
* Java 5.0.0 changes how folder scans match file patterns. See [Java folder-scan patterns changed](#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](#upgrading-from-an-earlier-major-version).

## Supported runtimes

> [tab] Python
>
> The SDK requires Python 3.10 or later and is tested on Python 3.10 through 3.14.
>
> | Python version | Supported | Notes |
> | - | - | - |
> | 3.10 | Yes | Minimum supported version. |
> | 3.11 | Yes | |
> | 3.12 | Yes | |
> | 3.13 | Yes | |
> | 3.14 | Yes | |
> | 3.9 and earlier | No | Python 3.9 reached end of life on October 31, 2025. On Python 3.9, pip installs 3.10.0, the last 3.x release. |

> [tab] TypeScript
>
> The SDK requires Node.js 22 or later and TypeScript 4.9 or later. It ships both CommonJS and ESM builds, for server-side code.
>
> Version 3.x supported Node.js 20, which reached end of life on April 30, 2026.

> [tab] Java
>
> The SDK requires Java 8 or later.

## Dependencies

> [tab] Python
>
> When you install `hiddenlayer-sdk`, pip installs these dependencies within the following version ranges:
>
> | Package | Supported range | Purpose |
> | - | - | - |
> | `httpx` | `>=0.21.2` | HTTP client used for all API requests |
> | `pydantic` | `>=1.9.2` | Request and response models. Both Pydantic v1 and v2 are supported. |
> | `pydantic-core` | `>=2.18.2, <3` | Pydantic's core validation library |
> | `typing_extensions` | `>=4.0.0` | Typing features for older Python versions |
>
> 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](https://docs.hiddenlayer.ai/docs/integrations/sdk/installation.md).

> [tab] TypeScript
>
> The SDK has one runtime dependency, `minimatch` (`^9.0.5`), which matches the file patterns of folder scans.
>
> The model scanning helpers for S3, Azure Blob Storage, and Hugging Face use optional peer dependencies. npm doesn't install them with the SDK, so install the ones for the scans you run:
>
> | Package | Supported range | Used by |
> | - | - | - |
> | `@aws-sdk/client-s3` | `^3.0.0` | `scanS3Model` |
> | `@azure/storage-blob` | `^12.0.0` | `scanAzureBlobModel` |
> | `@huggingface/hub` | `^0.19.0` | `scanHuggingFaceModel` |

> [tab] Java
>
> The SDK is a single artifact, `com.hiddenlayer.api:hiddenlayer-java`. It depends on:
>
> | Dependency | Version | Purpose |
> | - | - | - |
> | `com.squareup.okhttp3:okhttp` | 5.2.1 | HTTP client. It is part of the SDK's API: `httpClient` and `addInterceptor` on the client builders take OkHttp types. |
> | `com.fasterxml.jackson.core:jackson-databind` | 2.18.12 | JSON serialization of requests and responses |
> | `com.fasterxml.jackson.datatype:jackson-datatype-jdk8` and `jackson-datatype-jsr310` | 2.18.12 | `Optional` and `java.time` support |
>
> Models are serialized through Jackson annotations, so if you shrink your application with ProGuard or R8, keep `com.hiddenlayer.api.**`.

## Versioning policy

The SDKs follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (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](https://docs.hiddenlayer.ai/docs/integrations/sdk/error_handling.md).
* **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](https://dev.hiddenlayer.ai/docs/beta-api-faq) on the Developer Portal.

## Check your installed version

> [tab] Python
>
> Print the version your code is actually using:
>
> ```python Python theme={null}
> import hiddenlayer
>
> print(hiddenlayer.__version__)
> ```
>
> 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`):
>
> ```bash Python theme={null}
> python -m pip show hiddenlayer-sdk
> ```
>
> 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](https://docs.hiddenlayer.ai/docs/integrations/sdk/troubleshooting.md).

> [tab] TypeScript
>
> Ask npm which version your project resolved:
>
> ```bash TypeScript theme={null}
> npm ls @hiddenlayerai/hiddenlayer-sdk
> ```

> [tab] Java
>
> Ask your build tool which version it resolved:
>
> ```bash Gradle theme={null}
> ./gradlew dependencyInsight --dependency com.hiddenlayer.api:hiddenlayer-java --configuration runtimeClasspath
> ```
>
> ```bash Maven theme={null}
> mvn dependency:tree -Dincludes=com.hiddenlayer.api:hiddenlayer-java
> ```

## 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](https://github.com/hiddenlayerai/hiddenlayer-sdk-python/blob/main/CHANGELOG.md), [TypeScript](https://github.com/hiddenlayerai/hiddenlayer-sdk-typescript/blob/main/CHANGELOG.md), or [Java](https://github.com/hiddenlayerai/hiddenlayer-sdk-java/blob/main/CHANGELOG.md). Look for deprecations, behavior changes, and changes to beta APIs you use. For a new major version, also read the [upgrade notes](#upgrade-notes) on this page.

**2. Upgrade in a test environment first**

> [tab] Python
>
> Create or activate a separate virtual environment, then upgrade:
>
> ```bash Python theme={null}
> python -m pip install --upgrade hiddenlayer-sdk
> ```
>
> To install a specific version, use `python -m pip install hiddenlayer-sdk==6.0.0`.

> [tab] TypeScript
>
> On a branch, install the new version:
>
> ```bash TypeScript theme={null}
> npm install @hiddenlayerai/hiddenlayer-sdk@latest
> ```
>
> To install a specific version, use `npm install @hiddenlayerai/hiddenlayer-sdk@5.0.0`.

> [tab] Java
>
> On a branch, change the version in your build file:
>
> ```kotlin Gradle theme={null}
> implementation("com.hiddenlayer.api:hiddenlayer-java:6.0.0")
> ```
>
> ```xml Maven theme={null}
> <dependency>
>   <groupId>com.hiddenlayer.api</groupId>
>   <artifactId>hiddenlayer-java</artifactId>
>   <version>6.0.0</version>
> </dependency>
> ```

**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.

> [tab] Python
>
> In `requirements.txt` or `pyproject.toml`, pin an exact version:
>
> ```text Python theme={null}
> hiddenlayer-sdk==6.0.0
> ```
>
> If you use only GA APIs, you can allow compatible minor and patch releases:
>
> ```text Python theme={null}
> hiddenlayer-sdk>=5.0,<6
> ```

> [tab] TypeScript
>
> Commit your lockfile. In `package.json`, `"@hiddenlayerai/hiddenlayer-sdk": "5.0.0"` pins an exact version, and `"^5.0.0"` allows compatible minor and patch releases.

> [tab] Java
>
> Gradle and Maven use the exact version you declare. Change it deliberately when you upgrade.

## 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:

| What changed | Python 5.0.0 | TypeScript 4.3.0 | Java 4.0.0 |
| - | - | - | - |
| The SARIF export returns the SARIF log as an object, not a string. Serialize it before you write it to a file. See [Export a SARIF report](https://docs.hiddenlayer.ai/docs/integrations/sdk/api_examples.md#export-a-sarif-report). | `client.scans.results.sarif` returns a `dict`. In 4.0.0 the call raised `ParsingError`. | `client.scans.results.sarif` is typed as `Record<string, unknown>`. Earlier versions returned the same object but typed it as `string`. | `client.scans().results().sarif` returns a `Map<String, Object>`. In 3.0.0 the call threw `HiddenLayerException`. |
| The detection fields `risk`, `likelihood`, `impact`, `owasp`, `cve`, `cwe`, and `cwe_href` are optional, because the API can leave them out. | They default to `None`. In 4.0.0, reading a scan whose detection left one out raised `ParsingError`. | They can be `undefined`. | Their getters, such as `getCwe()`, return an `Optional`. |
| A file result's `end_time` is optional. It is absent while the file's scan is pending or running. | `None` when absent. | `undefined` when absent. | `getEndTime()` returns an `Optional<OffsetDateTime>`. |
| On the deprecated model cards listing, `model_scan_severity` is renamed `model_scanner_severity`, the name the API returns. | `model_scanner_severity` | `model_scanner_severity` | `getModelScannerSeverity()` |

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](https://docs.hiddenlayer.ai/docs/integrations/sdk/model_scanning.md#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](https://docs.hiddenlayer.ai/docs/integrations/sdk/model_scanning.md#scan-a-folder), and the 5.0.0 entry in the [Java changelog](https://github.com/hiddenlayerai/hiddenlayer-sdk-java/blob/main/CHANGELOG.md) 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](#scan-result-types-changed) and, in Java, [Java folder-scan patterns changed](#java-folder-scan-patterns-changed).

> [tab] Python
>
> Python 3.x to 4.0.0. The full list is in [BREAKING\_CHANGES\_v4.0.0.md](https://github.com/hiddenlayerai/hiddenlayer-sdk-python/blob/main/docs/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`.

> [tab] TypeScript
>
> TypeScript 3.x to 4.0.0. The full list is in [BREAKING\_CHANGES\_v4.0.0.md](https://github.com/hiddenlayerai/hiddenlayer-sdk-typescript/blob/main/docs/BREAKING_CHANGES_v4.0.0.md). The changes most code needs:
>
> * Node.js 22 or later is required.
> * Install `@aws-sdk/client-s3`, `@azure/storage-blob`, or `@huggingface/hub` beside the SDK for each storage scan you run. They are now optional peer dependencies.
> * In CommonJS, use `const { HiddenLayer } = require("@hiddenlayerai/hiddenlayer-sdk")`.
> * Client options: `bearerToken` becomes `token`, `clientID` becomes `clientId`, `baseURL` becomes `baseUrl`, and `timeout` in milliseconds becomes `timeoutInSeconds`. The constructor throws a `TypeError` that names the replacement for any 3.x option you pass. `client.withOptions()` is removed.
> * Every method takes one request object. Path parameters move into it, such as `client.sensors.retrieve({ sensor_id })`.
> * Request and response types are in the `HiddenLayerApi` namespace, named after the API's schemas. Deep imports under `/resources/...` are gone.
> * Errors: check `HiddenLayerError` and its `statusCode` instead of `APIError` and `status`. `.withResponse()` becomes `.withRawResponse()`.
> * `scans.jobs.list` and `sensors.query` return pages.

> [tab] Java
>
> Java 2.x to 3.0.0. The full list is in [BREAKING\_CHANGES\_v3.0.0.md](https://github.com/hiddenlayerai/hiddenlayer-sdk-java/blob/main/docs/BREAKING_CHANGES_v3.0.0.md). The changes most code needs:
>
> * Depend on `com.hiddenlayer.api:hiddenlayer-java` alone. Remove `hiddenlayer-java-core` and `hiddenlayer-java-client-okhttp`, whose classes are now in the single artifact. OkHttp moves to version 5.
> * Build clients with `new HiddenLayerClientBuilder()` instead of `HiddenLayerOkHttpClient.fromEnv()` or `.builder()`. `bearerToken`, `baseUrl`, and `prodEu()` become `token`, `url`, and `environment(Environment.PROD_EU)`. `timeout` takes seconds as an `int`. `build()` throws `IllegalStateException` when no credentials are available.
> * Replace `client.async()` with an `AsyncHiddenLayerClient` built by `new AsyncHiddenLayerClientBuilder()`, and close it when you are done.
> * Imports move from `com.hiddenlayer.api.client`, `.models`, and `.services` to `com.hiddenlayer.api`, `.types`, and `.resources`. Path parameters are passed as `String` arguments, and each `Params` class is replaced by a request class.
> * Response getters are named `getX()` instead of `x()`.
> * Errors: catch `HiddenLayerApiException` and the `*Error` classes in `com.hiddenlayer.api.errors` instead of `HiddenLayerServiceException` and its subclasses.
> * `scans.jobs.list` and `sensors.query` return pages. Replace `page.autoPager()` with the page itself.
> * Version 2.5.0 was tagged but never published to Maven Central, so an upgrade from Maven Central's latest 2.x starts at 2.4.0.

### Deprecated top-level fields on the scan report

These top-level scan report fields are deprecated. Read the same values from `summary` instead:

| Deprecated | Use instead |
| - | - |
| `detection_count` | `summary.detection_count` |
| `file_count` | `summary.file_count` |
| `files_with_detections_count` | `summary.files_with_detections_count` |
| `detection_categories` | `summary.detection_categories` |
| `severity` | `summary.highest_severity` |

`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.

```python Python theme={null}
report = client.model_scanner.scan_file(model_name="resnet50", model_path="models/resnet50.pkl")
print("Detections:", report.summary.detection_count)  # not report.detection_count
print("Highest severity:", report.summary.highest_severity)  # not report.severity
```

```typescript TypeScript theme={null}
const report = await client.modelScanner.scanFile({ modelName: "resnet50", modelPath: "models/resnet50.pkl" });
console.log("Detections:", report.summary.detection_count); // not report.detection_count
console.log("Highest severity:", report.summary.highest_severity); // not report.severity
```

```java Java theme={null}
ScanReportOfRecordV3 report = client.modelScanner().scanFile("resnet50", "models/resnet50.pkl");
System.out.println("Detections: " + report.getSummary().getDetectionCount().orElse(0L)); // not getDetectionCount()
System.out.println("Highest severity: " + report.getSummary().getHighestSeverity().map(Object::toString).orElse("unknown")); // not getSeverity()
```

### 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](https://docs.hiddenlayer.ai/docs/integrations/sdk/model_scanning.md).

### 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](https://docs.hiddenlayer.ai/docs/integrations/sdk/attack_simulation.md).

### 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

* [Installation](https://docs.hiddenlayer.ai/docs/integrations/sdk/installation.md): install or reinstall the SDK.
* [Security and production guidance](https://docs.hiddenlayer.ai/docs/integrations/sdk/security.md): pin versions and configure the client for production.
* [API reference](https://docs.hiddenlayer.ai/docs/integrations/sdk/api_reference.md): find every resource and method.
