API Reference
The methods you call across the four stages. Grouped by client: Lattica Studio for deploy, tokens, and workers, and query for running encrypted inference. Click any method to expand it.
Lattica Studio
studio = LatticaStudio(license_key). Models, workers, and tokens are on the same client: studio.models, studio.workers, studio.tokens.Creates the Lattica Studio client. Pass your License. This client deploys pipelines and reaches models, workers, and tokens.
def __init__(self, account_license: str)
license_key or LATTICA_LICENSE_KEY.The deploy envelope. Registers a model or reuses one with the same model_name, uploads the pipeline, and waits for compilation. Returns the model_id. Does not create an access token, start a worker, or generate keys.
def deploy_pipeline(self, hom_pipeline, hom_params, model_name: str, instance_type=InstanceType.G6E_2XLARGE, num_devices=1, display_graph=False) -> str
Creates an access token for a deployed model and optionally writes it to disk under save_as. This is a Key generation step, not part of deploy_pipeline.
def create(self, model_id: str, *, name: str | None = None, save_as: str | None = None) -> str
tokens.load. Use the same string as model_name.Starts a worker if needed and yields while it is up. Credits begin when the worker comes up. Set stop_on_exit=True to stop it when the block ends.
def running(self, model_id: str, *, stop_on_exit: bool = False)
with block. Defaults to False.Query client
query_client = QueryClient(studio.tokens.load(model_name)).Reads the query token saved earlier with tokens.create(..., save_as=name). Pass the string to QueryClient.
def load(self, name: str) -> str
save_as when creating the token.Creates a query client for the given access token. Pass the string from studio.tokens.create or studio.tokens.load.
def __init__(self, query_token: str)
Generates or loads key material after the worker is up. Keeps the secret key on your side and uploads the evaluation key on first generation. Call with load_if_exists=False during Key generation. Call with load_if_exists=True on later query runs to reuse that key.
def generate_key(self, load_if_exists: bool = False)
Runs one encrypted query. Encrypts your input, sends it to the worker, decrypts the result, and returns it. Run it as many times as you need while the worker is up.
def run_query(self, sk, pt: torch.Tensor) -> torch.Tensor
Workers and models
studio.workers. The documented session pattern is studio.workers.running. Model lookup is on studio.models.Starts a worker and waits until it is ready. Prefer workers.running in the documented flow. Credits begin when the worker comes up.
def start(self, model_id: str, *, poll_interval: float = 5, timeout: float = 600) -> dict
Stops a running worker. Credits stop the moment it goes down. Pass model_id to stop workers for that model. Prefer workers.running(..., stop_on_exit=True) in the documented flow.
def stop(self, model_id: Optional[str] = None, session_id: Optional[str] = None) -> dict
stop(model_id=model_id).Returns the current status of a worker session.
def get(self, model_id: str, session_id: str) -> dict
Lists worker sessions, with optional filters by model and date range.
def list_sessions(self, *, model_id: Optional[str] = None, from_date: Optional[str] = None, to_date: Optional[str] = None) -> list
Returns information about a model, including whether it compiled and the compilation error if it did not.
def get(self, model_id: str) -> dict
The management surface has more methods for account, tokens, and models than the worker controls shown here. Those are admin tasks outside the build, deploy, key generation, and query path. For the full set, see the platform documentation.