License-gated, encrypted-model SDK for on-prem AI services.
Project description
Licantha SDK
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
.licfiles - AES-256-GCM model envelope with embedded
model_idfor multi-model licenses - Background heartbeat daemon with clean SIGTERM-safe shutdown
- Pluggable
KeyProviderabstraction (lease today, GPU-attestation tomorrow) - Pydantic-validated config (
SecureClientConfigPM) and.envloader (SecureClientCliConfig) - Self-contained example mini-apps for every flow
🛠 Installation
1. 🚧 Prerequisites
- Install Python (>= v3.10) and pip (>= 23):
- [RECOMMENDED] Miniconda (v3)
- [arm64/aarch64] Miniforge (v3)
- [Python virtual environment] venv
[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:
- Download archived zip file from releases.
- Extract it into the projects directory.
3. 📦 Install the package
[NOTE] Choose one of the following methods to install the package [A ~ F]:
OPTION A. [RECOMMENDED] Install from PyPi:
# Install from production PyPI:
pip install -U licantha-sdk
# Or install from staging TestPyPI:
# pip install -i https://test.pypi.org/simple -U licantha-sdk
OPTION B. Install latest version directly from GitHub repository:
pip install git+https://github.com/humblebeeai/int-sdk-python-licensing.git
OPTION C. Install from the downloaded source code:
# Install directly from the source code:
pip install .
# Or install with editable mode:
pip install -e .
OPTION D. Install for DEVELOPMENT environment:
pip install -e .[dev]
# Install pre-commit hooks:
pre-commit install
OPTION E. Install from pre-built release files:
- Download
.whlor.tar.gzfile from releases - 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 F. 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
# 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
# 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file licantha_sdk-0.1.1.tar.gz.
File metadata
- Download URL: licantha_sdk-0.1.1.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d35a138c8de6df7ae2a494b03740400b541f797715edc90e1168aa88456a698b
|
|
| MD5 |
665c4926d09e890b1142e636e1916008
|
|
| BLAKE2b-256 |
cd1e6c9874b7f7c36683364c20c40a7fb757dccc5deeab64a25e62d6942834ac
|
File details
Details for the file licantha_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: licantha_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 26.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27938f1a5839a314df670891bf80b8de92e88186a34c6056c1f73def5d9fc2f3
|
|
| MD5 |
a61b109b433ec9391de45f894723efe8
|
|
| BLAKE2b-256 |
94dfb64ab8cfb211843a0d433079fa7b4c3d48697b856bc9a898684a380d1772
|