Authentication

truss.login(api_key: str) → None

Authenticates with Baseten using an API key.

Parameters:

NameTypeDescription
api_keystrBaseten API Key.

Deploying a Model

truss.push(target_directory: str, **kwargs) → ModelDeployment

Deploys a Truss model to Baseten.

Parameters:

NameTypeDescription
target_directorystrPath to the Truss directory to push.
remoteOptional[str]Name of the remote in .trussrc to push to.
model_nameOptional[str]Override the model name in config.yaml.
publishboolDeploy as published. If no production deployment exists, promote it to production.
promoteboolDeploy as published and promote to production, even if a production deployment exists.
preserve_previous_production_deploymentboolPreserve the previous production deployment’s autoscaling settings (only with promote).
trustedboolGrants access to secrets on the remote host.
deployment_nameOptional[str]Custom deployment name (must contain only alphanumeric, ., -, or _ characters). (Requires publish or promote.)

Returns: ModelDeployment – An object representing the deployed model.


Model Deployment Object

class truss.api.definitions.ModelDeployment

Represents a deployed model (returned by truss.push()).

Attributes

model_idstr – Unique ID of the deployed model. model_deployment_idstr – Unique ID of the model deployment.

Methods

wait_for_active() → bool Waits for the deployment to become active.

Returns: True when deployment is ready. Raises: An error if deployment fails.