Setup for CLI

TrueFoundry CLI Library

TrueFoundry CLI library to help you interact with the platform programmatically by

  • Interacting with the deployments side of TrueFoundry, enabling you to manage workspaces, deployments, applications, and view logs.
  • Providing experiment tracking capabilities, allowing you to track ML experiments and interact with ML repositories within TrueFoundry.

Setup for CLI


To install the Truefoundry CLI, run the following command:

pip install -U "truefoundry"

To install the Truefoundry CLI, with experiment tracking capabilities run the following command:

pip install -U "truefoundry[ml]"


Login with manual interaction

You can log in to TrueFoundry using Truefoundry CLI.

To log in to Truefoundry, run the following command:

tfy login --host <your-truefoundry-host> # e.g. host:

Login without manual interaction ( Non-Interactive Mode )

For scenarios where code interacts with Truefoundry APIs or where opening a browser is not feasible, you can log in using the Truefoundry API Key.

To begin, generate an API Key. Once you have the API key, you can authenticate in these ways:

1. Setting environment variables:

Set the TFY_API_KEY and TFY_HOST environment variables.

  • Set TFY_API_KEY to your API key.
  • Set TFY_HOST to your Truefoundry host URL. e.g.

2. Using the CLI:

When using the CLI, you can provide the API key directly within the command:

tfy login --host <your-truefoundry-host> --api-key <your-api-key>

Generate Truefoundry API Key

TrueFoundry API comes in handy when you want to interact with the Platform programmatically. You can generate the API key by following the instructions below:



Your API key is a sensitive piece of information, so handle it with care. Never share it with unauthorized individuals.