Skip to main content

Overview

Python SDK for the Axionic platform. Remote inference via the Axionic API, local model loading via TransformerLens, steering vectors, SAE behavior monitoring, runtime policies, model graph inspection, experimental attribution and RAAG wrappers, and a local OpenAI-compatible server. Install from PyPI:
pip install mechanex
transformer_lens is required for local model loading but is not installed automatically by pip. Install it separately if you plan to run local models:
pip install transformer-lens

Two Modes of Operation

Generation, steering, and SAE operations run on Axionic-hosted GPU infrastructure. No local hardware requirements beyond running the SDK.
  • Requires an API key (ax_ + 48 hex characters)
  • Credits are deducted per inference call
  • Supports all sampling methods including ADS
  • Model does not need to fit in local memory
import mechanex as mx

mx.set_key("ax_your_key_here")
result = mx.generation.generate("Explain sparse autoencoders in one paragraph.")
print(result)

Execution Mode

Control where operations run with set_execution_mode():
ModeBehavior
"auto" (default)Remote when API or JWT credentials are configured; local only when a model is loaded and no credentials are configured
"remote"Always use the Axionic API. Fails if not authenticated.
"local"Always use the locally loaded model. Fails if no model loaded.
mx.set_execution_mode("local")   # force local-only
mx.set_execution_mode("remote")  # force API-only
mx.set_execution_mode("auto")    # default routing behavior
ADS and steering perceptrons are remote-only regardless of execution mode. Policy-backed local generation can still run saved policies, constraints, retries, and verifiers when a local model is loaded.