FHEnom for AI™ — Python SDK and CLI
fhenomai is the official client for FHEnom for AI™ by DataKrypto. It lets you
encrypt AI models, serve them from a Trusted Execution Environment (TEE), and run
inference on them, from the command line or from Python.
Requirements
- Python 3.8 or newer
- Access to a FHEnom for AI node: TEE 1.9.3+ and FHEnom AI Server 1.5.3+
(these are minimums; newer nodes work).
fhenomai health livechecks your node.
Installation
pip install fhenomai
fhenomai --version
Configuration
Run the setup wizard and answer the prompts (node address, admin token, SFTP credentials, inference server):
fhenomai config init
This writes ~/.fhenomai/config.yaml. Keep that file private: it holds your
admin token. Then check the settings and the connection:
fhenomai config show
fhenomai test connection
Example config.yaml
admin:
host: "tee.example.com"
port: 9099
auth_token: "your-admin-token"
user: # inference endpoint
host: "tee.example.com"
port: 9999
sftp:
host: "tee.example.com"
port: 22
username: "your-sftp-user"
key_path: "~/.ssh/fhenom_sftp" # or: password: "..."
You can also set any value through an environment variable, for example
FHENOM_ADMIN_HOST, FHENOM_AUTH_TOKEN or FHENOM_SFTP_PASSWORD.
Quick start
To encrypt and serve a Hugging Face model (in .safetensors format):
# 1. Upload the plaintext model to the node
fhenomai sftp upload ./my-model my-model --recursive
# 2. Encrypt it inside the TEE
fhenomai model encrypt my-model --wait
# 3. Copy the encrypted model to the GPU server
fhenomai model transfer my-model-encrypted
# 4. Serve it (starts the serving framework and registers it with the TEE)
fhenomai model serve my-model-encrypted
# 5. Send it a prompt
fhenomai test chat "What is the capital of France?"
To stop serving the model, run fhenomai model stop my-model-encrypted.
model serve starts the first framework in server.engines (vLLM by
default). Install SGLang on the GPU server and list it with
fhenomai config init --server-engine vllm --server-engine sglang, then pick it
with fhenomai model serve my-model-encrypted --engine sglang.
If you run the serving framework yourself, register it with the TEE directly:
fhenomai serve start my-model-encrypted \
--server-url http://GPU_HOST:8000 \
--display-model-name my-model-encrypted
Encryption options
| Option | What it does |
|---|---|
--encryption-impl |
Selects the encryption profile for the model's architecture. Omit it and the node picks the profile from the model's config.json; pass it alone and the matching preprocessing and inference mode follow. fhenomai model encrypt --help lists the values. |
--lora-adapter |
Encrypts a LoRA adapter on top of its base model: pass the adapter folder in upload/, plus the base model's --encryption-impl. |
--optimize-accuracy |
Keeps the encrypted model accurate if you quantize it later. Encryption takes a little longer. |
--secure-channel |
Encrypts the token channel used during inference. You choose this when you encrypt the model. |
Inference
The node exposes an OpenAI-compatible API, so any OpenAI client works:
from openai import OpenAI
client = OpenAI(base_url="http://tee.example.com:9999/v1", api_key="unused")
response = client.chat.completions.create(
model="my-model-encrypted",
messages=[{"role": "user", "content": "Explain confidential computing."}],
max_tokens=200,
)
print(response.choices[0].message.content)
Python SDK
from fhenomai import FHEnomClient, FHEnomConfig
client = FHEnomClient(FHEnomConfig.from_file()) # reads ~/.fhenomai/config.yaml
# Upload, encrypt, wait
client.upload_model("./my-model", "my-model")
job_id = client.admin.encrypt_model("my-model", "my-model-encrypted")
job = client.admin.wait_for_job(job_id, timeout=3600)
model_id = job["result"]["encrypted_model_id"]
# Serve through your vLLM server
client.admin.start_serving(
encrypted_model_id=model_id,
server_url="http://GPU_HOST:8000",
display_model_name="my-model-encrypted",
)
FHEnomConfig.from_env() builds the configuration from environment variables
instead of a file.
Verify the endpoint
Before you send it a prompt, check that the inference endpoint is running in a genuine TEE. This check needs no admin token:
fhenomai attest # exits 0 only if verification succeeds
from fhenomai.inference_attestation import verify_endpoint
result = verify_endpoint("tee.example.com", 9999)
if not result.verified:
raise SystemExit(result.error)
Node operators can also generate and verify a full attestation report with
fhenomai admin attestation and fhenomai admin verify-attestation.
Optional features
Encrypted prompts and responses (thick client)
By default, prompts and responses travel in plaintext. In thick-client mode, each client has its own key, and the node refuses any prompt that is not encrypted with it.
fhenomai model serve my-model-encrypted --thick-client
fhenomai thick-client add my-model-encrypted --label my-app --save my-app.json
fhenomai test chat "Hello" --thick-key-file my-app.json
The node shows each key only once, so store it when you create it. A
thick-client model refuses every request until you have added at least one
client. In Python, use ThickClientSession.
Sovereign split inference
Split inference keeps part of the model inside the TEE and runs the rest on
your own GPU server, in the datakrypto-vllm image. The TEE connects to that
server's inference port (50052).
fhenomai model split my-model --first-layers 2 --last-layers 2
fhenomai model transfer my-model --restart
fhenomai model serve my-model --sovereign-host GPU_SERVER_ADDRESS_SEEN_FROM_THE_TEE
The TEE and the sovereign server must use the same dtype and the same
max_model_len. model serve starts both with the same values: --dtype
(default: the model's own dtype, float16 on a GPU without bfloat16 support)
and --max-model-len (default 4096). If you run the sovereign server yourself,
pass the same explicit values it was started with:
fhenomai serve start my-model --sovereign-server-host HOST \
--sovereign-max-model-len 4096 --sovereign-dtype float16
fhenomai serve list shows the values the TEE uses. Thick-client mode
(--thick-client) works with sovereign serving too.
Administration
| Command | Purpose |
|---|---|
fhenomai provision |
Activate a new node with the licence details supplied by DataKrypto |
fhenomai admin license |
Show licence state and remaining budget |
fhenomai admin usage --from … --to … |
Signed inference usage for a period |
fhenomai admin token create/list/revoke |
Manage scoped admin tokens |
fhenomai whoami |
Show what the configured token is allowed to do |
fhenomai health check |
Check every service the CLI talks to |
For security, always provision with --admin-token and --rotation-token.
Without them provision asks for confirmation, and fhenomai health check
warns about the node.
Command reference
| Group | Commands |
|---|---|
config |
init, show, get, validate |
model |
list, info, upload, download, encrypt, encrypt-dataset, serve, stop, split, delete, delete-encrypted, chat-template |
serve |
start, stop, list |
sftp |
upload, download, list, clear |
job |
list, status, wait, cancel |
thick-client |
add, list, remove |
health |
check, live, ready, status, admin, sftp, server |
test |
connection, admin, sftp, chat |
admin |
license, usage, token, attestation, verify-attestation, logs, ssl, sync, ita, reload, deprovision |
| top level | provision, attest, whoami |
Add --help to any command to see its options.
If a command fails, the CLI exits with a non-zero status, so you can safely chain
commands in scripts (fhenomai … && next-step).
Support
- Website: datakrypto.ai
- Email: support@datakrypto.ai
License
MIT License. Copyright (c) 2024-2026 DataKrypto. See the LICENSE file for details.
Metadata
Release files for fhenomai 1.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fhenomai-1.5.2.tar.gz | 239.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fhenomai-1.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 479.3 kB
Release files / fhenomai-1.5.2.tar.gz
| Download URL | fhenomai-1.5.2.tar.gz |
|---|---|
| Size | 239.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0287062de4f59d99a7cccecebd3d52ed44e480742bc5bb3190e153680606bb8f
|
|
BLAKE2b-256 checksum How to use checksums |
0ed7f529aa4965a332b287415956946b53a8a444cf2774bcfa01681487a4bff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Release files / fhenomai-1.5.2-py3-none-any.whl
| Download URL | fhenomai-1.5.2-py3-none-any.whl |
|---|---|
| Size | 240.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c8e7de846c9f27c7082264228c3bbb912aaa31acb19f12511dfb3ee882ad74d
|
|
BLAKE2b-256 checksum How to use checksums |
33e3c8787267c9fb032d099128218cbb5fa0f0584037e4a4ca6eba645b75ef42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.2
|
Security for fhenomai 1.5.2
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.