Skip to main content
The HiddenLayer SDKs are the official Python, TypeScript, and Java libraries for the HiddenLayer REST API. They let you call HiddenLayer services from scripts, CI/CD pipelines, and applications without writing raw HTTP requests or handling authentication tokens yourself.
  • If you are familiar with SDKs and want to get started right away, see the Quickstart.
  • For a more thorough walk-through, including installation and common workflows, read the rest of this Overview page, then continue with Prerequisites and the rest of the SDK guide. You can skip the Quickstart.
Code examples throughout this guide have a tab for each language. Select a language once, and every example on the page switches to it. All three SDKs share one design:
  • A client for each language, with synchronous and asynchronous options. Python has HiddenLayer and AsyncHiddenLayer. In TypeScript, the HiddenLayer client returns promises. Java has HiddenLayerClient and AsyncHiddenLayerClient, which returns CompletableFutures.
  • Typed requests and responses. Every request and response has a type, so editors can autocomplete fields and catch mistakes before you run your code. Python responses are Pydantic models, TypeScript responses are interfaces in the HiddenLayerApi namespace, and Java responses are immutable classes with getters.
  • Built-in authentication, retries, and timeouts. The client exchanges your client ID and client secret for an access token, renews the token before it expires, and retries requests that fail with a temporary error.
  • Helpers for common workflows. Higher-level helpers handle multi-step tasks, such as uploading and scanning a model folder or driving a red team session.

Services covered

The SDKs cover every public operation in the HiddenLayer API, so you can automate every HiddenLayer service.

AI Supply Chain Security

Scan models for threats and manage the policy that decides whether a model is compliant. See AI Supply Chain Security.
  • Scan model files and folders, and models in Hugging Face, AWS S3, or Azure Blob Storage.
  • Have HiddenLayer fetch and scan a remote model.
  • List scans and read reports, file results, summaries, and SARIF.
  • Export scan reports as CSV.
  • Get a scan’s AI Bill of Materials (AIBOM).
  • List, update, and delete models, and override a model’s policy compliance status.
  • Define the Supply Chain policy that marks scans compliant or noncompliant, and read its evaluations.
  • Look up Model Intelligence about a file.
  • Submit model scanner results.
For the methods, see Model scanner in the API reference.

AI Runtime Security

Evaluate LLM and agent traffic for threats such as prompt injection and data leakage, and manage the projects and policies that govern it. See AI Runtime Security.
  • Evaluate LLM requests and responses inline, and full interactions including agent tool calls.
  • Analyze prompts and responses with the v1 Interactions endpoint.
  • Analyze a prompt with Prompt Analyzer.
  • Manage projects, which choose the policy each evaluation applies.
  • Manage policy packs and list rule packs (Beta).
For the methods, see Runtime in the API reference.

AI Attack Simulation

Run simulated attacks against your AI application and strengthen its system prompt. All of these endpoints are Beta. See AI Attack Simulation.
  • Run red team evaluations, track their status, and read the results. Python also has a red team session helper.
  • Manage attack objectives and saved red team configurations.
  • Manage prompt sets.
  • Run a system prompt analysis.
  • Run threat modeling.
For the methods, see Evaluations: red team in the API reference.

AI Discovery

Discover and inventory the AI assets in your cloud providers. See AI Discovery.
  • List, search, and filter discovered AI assets, and see how they relate.
  • Tag assets and manage custom tags, including in bulk.
  • Count assets by provider, region, and type.
  • Scan a discovered model on demand.
The asset-inventory/v2 endpoints are Beta; the v1 endpoints are generally available.

Console and administration

Manage access to your tenant, review activity, and read the data behind Console reports. See the Console overview.
  • Create and delete client credentials and API keys (Beta), and exchange a token for a short-lived one.
  • Manage users, and list roles and permissions.
  • Configure single sign-on.
  • Read the audit log.
  • Read the time series behind Reports: inferences, incidents, convictions, and scans.
  • Work triage issues, which correlate related alerts, and read a summary of triage outcomes (Beta).
  • Look up MITRE ATLAS tactics and techniques.
AI Discovery and the Console and administration services have no section in the API reference. Each SDK’s full method reference lists every method for them, with its parameters and an example. Method names follow each language’s conventions. For example, the operation that evaluates an interaction is client.runtime.evaluate_interaction in Python, client.runtime.evaluateInteraction in TypeScript, and client.runtime().evaluateInteraction in Java.
Beta APIsSome endpoints are marked Beta. Beta APIs have no compatibility guarantees and may change at any time, and they are not considered when an SDK determines its semantic version. The first time you call a beta endpoint, the SDK warns you: Python emits a hiddenlayer.BetaWarning, TypeScript logs a console.warn, and Java logs a warning through java.util.logging. For details, see the Beta API FAQ on the Developer Portal.

Feature availability by language

The REST API resources are the same in every SDK. The higher-level helpers differ:

A first look

Every API call follows the same pattern: create a client, then call a method on a resource. This example asks AI Runtime Security to evaluate a user prompt that tries to extract customer data:
To run this code, follow the Quickstart. It walks you through installation, credentials, and error handling.

How this guide is organized

Get started

Quickstart

Make your first API call in a few minutes.

Prerequisites

What you need before you install an SDK.

Installation

Add the SDK to your Python, Node.js, or Java project.

Authentication and configuration

Provide credentials, choose a region, and configure the client.

Core concepts

Clients, resources, request types, and response types.

Workflows

Scan models

Scan local, Hugging Face, S3, and Azure models with AI Supply Chain Security.

Runtime security

Evaluate LLM requests, responses, and agent interactions with the evaluation endpoints.

Attack simulation

Run red team sessions against your AI application.

API usage examples

Low-level resources, pagination, raw responses, and more.

Reference

Error handling

Error types, retries, and timeouts.

Troubleshooting

Fixes for common problems.

Security and production guidance

Handle credentials and data safely in production.

Version compatibility and upgrades

Versioning policy, pinning, and upgrading.

API reference

Clients, resources, methods, and types in each SDK.

Additional resources

The Python repository also has an examples directory, with demo.py for model scanning and red_team/ notebooks for AI Attack Simulation. For the REST API reference of the endpoints the SDKs call, see the HiddenLayer Developer Portal.