Skip to main content

Licantha SDK

PyPI version Python versions

License-gated, encrypted-model SDK for on-prem AI services.

📦 Available on PyPI: pip install licantha-sdk

The SDK validates a customer's license against a Keygen.sh server (or an offline Ed25519-signed .lic file for air-gapped deployments), activates this machine, runs a background heartbeat, and decrypts AES-256-GCM encrypted model files using keys delivered through license metadata.

✨ Features

  • Online activation against a self-hosted Keygen server (SecureClient)
  • Offline / air-gapped mode via signed .lic files
  • AES-256-GCM model envelope with embedded model_id for multi-model licenses
  • Background heartbeat daemon with clean SIGTERM-safe shutdown
  • Pluggable KeyProvider abstraction (lease today, GPU-attestation tomorrow)
  • Pydantic-validated config (SecureClientConfigPM) and .env loader (SecureClientCliConfig)
  • Self-contained example mini-apps for every flow

🛠 Installation

1. 🚧 Prerequisites

[OPTIONAL] For DEVELOPMENT environment:

2. 📥 Download or clone the repository

[TIP] Skip this step, if you're going to install the package directly from PyPi or GitHub repository.

2.1. Prepare projects directory (if not exists):

# Create projects directory:
mkdir -pv ~/workspaces/projects

# Enter into projects directory:
cd ~/workspaces/projects

2.2. Follow one of the below options [A], [B] or [C]:

OPTION A. Clone the repository:

git clone https://github.com/humblebeeai/int-sdk-python-licensing.git && \
    cd int-sdk-python-licensing

OPTION B. Clone the repository (for DEVELOPMENT: git + ssh key):

git clone git@github.com:humblebeeai/int-sdk-python-licensing.git && \
    cd int-sdk-python-licensing

OPTION C. Download source code:

  1. Download archived zip file from releases.
  2. Extract it into the projects directory.

3. 📦 Install the package

[NOTE] Choose one of the following methods to install the package [A ~ E]:

OPTION A. [RECOMMENDED] Install from PyPI:

pip install -U licantha-sdk

OPTION B. Install from the downloaded source code:

# Install directly from the source code:
pip install .

# Or install with editable mode:
pip install -e .

OPTION C. Install for DEVELOPMENT environment:

pip install -e .[dev]

# Install pre-commit hooks:
pre-commit install

OPTION D. Install from pre-built release files:

  1. Download .whl or .tar.gz file from PyPI downloads
  2. Install with pip:
# Install from .whl file:
pip install ./licantha_sdk-[VERSION]-py3-none-any.whl

# Or install from .tar.gz file:
pip install ./licantha_sdk-[VERSION].tar.gz

OPTION E. Copy the module into the project directory (for testing):

# Install python dependencies:
pip install -r ./requirements.txt

# Copy the module source code into the project:
cp -r ./src/licantha_sdk [PROJECT_DIR]
# For example:
cp -r ./src/licantha_sdk /some/path/project/

🚸 Usage/Examples

Simple

examples/simple/main.py:

# Standard libraries
import sys
import logging
from pathlib import Path

# Third-party libraries
from dotenv import load_dotenv

# Internal modules
from licantha_sdk import LicenseError, SecureClient, SecureClientCliConfig


HERE = Path(__file__).parent
load_dotenv(HERE / ".env")
logger = logging.getLogger("quickstart")


def serve(weights: bytes) -> None:
    logger.info(f"model loaded — {len(weights)} bytes")


def main() -> int:
    logging.basicConfig(level=logging.INFO)

    _config = SecureClientCliConfig()  # picks up LICANTHA_SDK_* from .env / env
    with SecureClient(config=_config) as _client:
        try:
            _weights = _client.decrypt_model(str(HERE / "model.encrypted"))
        except LicenseError as _e:
            logger.critical(f"cannot start: {_e}")
            return 2
        serve(_weights)
    return 0


if __name__ == "__main__":
    sys.exit(main())

See examples/ for offline / custom-inference / multi-model / manual-lifecycle / error-shape variants.


⚙️ Configuration

Production callers construct SecureClientConfigPM explicitly — they do NOT pull env vars from inside a compiled binary:

from licantha_sdk import SecureClient, SecureClientConfigPM

config = SecureClientConfigPM(
    account_id="...",
    license_key="...",
    app_id="my-product",
    api_url="https://licensing.your-company.com",
    # public_key="..."  # 64-char hex Ed25519 — only needed for offline .lic mode
)
with SecureClient(config=config) as client:
    weights = client.decrypt_model("model.enc")

Dev / examples can load from .env via SecureClientCliConfig instead.

🌎 Environment Variables

.env.example:

# Required:
LICANTHA_SDK_ACCOUNT_ID=
LICANTHA_SDK_LICENSE_KEY=
LICANTHA_SDK_PUBLIC_KEY=

# Optional:
# LICANTHA_SDK_APP_ID=licantha-default
# LICANTHA_SDK_API_URL=https://licensing.your-company.com
# LICANTHA_SDK_OFFLINE_LICENSE_PATH=./license.lic
# LICANTHA_SDK_HEARTBEAT_INTERVAL=60
# LICANTHA_SDK_DEACTIVATE_ON_EXIT=true

🧪 Running Tests

To run tests, run the following command:

# Install python test dependencies:
pip install .[test]

# Run tests:
python -m pytest -sv -o log_cli=true
# Or use the test script:
./scripts/test.sh -l -v -c

🏗️ Build Package

To build the python package, run the following command:

# Install python build dependencies:
pip install -r ./requirements/requirements.build.txt

# Build python package:
python -m build
# Or use the build script:
./scripts/build.sh

📝 Generate Docs

To build the documentation, run the following command:

# Install python documentation dependencies:
pip install -r ./requirements/requirements.docs.txt

# Serve documentation locally (for development):
mkdocs serve -a 0.0.0.0:8000 --livereload
# Or use the docs script:
./scripts/docs.sh

# Or build documentation:
mkdocs build
# Or use the docs script:
./scripts/docs.sh -b

📚 Documentation


📑 References

Metadata

Release files for licantha-sdk 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for licantha-sdk 0.8.0
File Size Uploaded Provenance Actions
licantha_sdk-0.8.0.tar.gz 63.2 kB Without provenance Details for licantha_sdk-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for licantha-sdk 0.8.0
File Interpreter ABI Platform Actions
licantha_sdk-0.8.0-py3-none-any.whl Python 3 none any Details for licantha_sdk-0.8.0-py3-none-any.whl

Total release size: 131.5 kB

Release files / licantha_sdk-0.8.0.tar.gz

Download URL licantha_sdk-0.8.0.tar.gz
Size 63.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c126ad7a19179afd8ae61c93e340eb454d1676690c0a35207dfa33af321a642d
BLAKE2b-256 checksum
How to use checksums
83a32261aab933a9235653dbbaa8baf3fe7d8373c41ca3fcffc41af1bd72880b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.22

Release files / licantha_sdk-0.8.0-py3-none-any.whl

Download URL licantha_sdk-0.8.0-py3-none-any.whl
Size 68.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6bbc21cc39857203967733d8f018af5056c85052bf6abdc09d6f4476294a861
BLAKE2b-256 checksum
How to use checksums
be24b43ba0242f978181bbb82991a5beb291847d7b92621468f0c126656b7378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.22

Security for licantha-sdk 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page