Skip to content

Python SDK

The Python SDK is maintained in the dedicated trussium-python repository and published as the trussium-sdk package. It calls an existing local, private, or public runtime; it does not install, host, or configure one.

Prerequisites: Python 3.12 or newer, a reachable Trussium runtime, and a provider configured by that runtime when making inference requests.

pip install trussium-sdk
from trussium_sdk import TrussiumClient

with TrussiumClient("http://127.0.0.1:9000") as client:
    response = client.complete(
        {"model": "gpt-4.1-mini", "messages": [{"role": "user", "content": "Hello"}]},
        request_id="request-123",
    )

For a runnable self-hosted workflow, see the dedicated repository's examples/basic.py. It accepts TRUSSIUM_URL, TRUSSIUM_MODEL, and TRUSSIUM_PROMPT and checks readiness and capabilities before making a completion request:

TRUSSIUM_URL=http://127.0.0.1:9000 \
TRUSSIUM_MODEL=llama3.1:8b \
TRUSSIUM_PROMPT="Say hello." \
uv run python examples/basic.py

The package supports chat, embeddings, moderation, image generation, transcription, reranking, batch jobs, video jobs, controlled tools, readiness, and capability discovery. Audio bytes are sent only to the configured runtime; tool authority remains owned by the runtime's allowlist.