Skip to main content

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]Temporarily override the model name for this deployment without updating config.yaml.
promoteboolPromote the deployment to production, even if a production deployment already exists.
preserve_previous_production_deploymentboolPreserve the previous production deployment’s autoscaling settings (only with promote).
deployment_nameOptional[str]Custom deployment name (must contain only alphanumeric, ., -, or _ characters). (Requires promote.)
disable_truss_downloadboolDisable downloading of the Truss directory from the UI.
environmentOptional[str]Name of a stable environment to deploy to.
labelsOptional[dict]JSON-serializable dictionary of label key-value pairs to attach to the deployment.
teamOptional[str]Name of the team to push the model to.
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(timeout_seconds: int = 600) → bool Waits for the deployment to become active.
NameTypeDescription
timeout_secondsintMaximum time to wait in seconds. Defaults to 600.
Returns: true when deployment is ready. Raises: TimeoutError if deployment doesn’t become active within timeout_seconds. ValueError if deployment fails.