CLI Manual
Command-line interface for accessing Pending AI's retrosynthesis service.
Getting Started
Usage of the Pending AI CLI requires
an account for the Pending AI Platform and
a locally installed Python version
>=3.9.
The Pending AI CLI is available from the Python Package Index, the official third-party software repository for Python and can thus be easily installed using the package management system pip:
pip install pendingaiSuccessful installation can be verified with
pendingai --versionwhich is expected to output the name and version of the Pending AI CLI.
Authentication
Using the Pending AI services via the CLI requires an authenticated session. The pendingai auth command provides several subcommands to manage your authentication status.
Logging In
To initiate the login process, use the login subcommand:
pendingai auth loginThis command uses device authorization, which will automatically open a web browser window. Follow the prompts in your browser to enter your Pending AI Platform credentials and authorize the CLI session.
For any account problems, contact Pending AI via email at [email protected].
Checking Session Status
You can check the status of your current authenticated session, including details like the associated user and expiry time:
Refreshing a Session
Authenticated sessions have a limited lifetime for security reasons. If your session is close to expiring or has already expired, you can attempt to refresh it without needing to fully log in again:
This will extend the lifetime of your current session if it's still valid for refreshing.
Retrieving the Access Token
Successful authentication stores an access token locally on your machine. You can retrieve the current access token using:
The access token retrieved via pendingai auth token can be used as a Bearer token for direct API access by including it in the Authorization header of each API request (e.g., Authorization: Bearer <your_token>).
Logging Out
To end your authenticated session and remove the locally cached authentication details, use the logout subcommand:
This ensures that your credentials are no longer stored by the CLI on the current machine.
Exploring Available Generative Models
An overview of Pending AI's generative models and their characteristics can be found here. Please note that your account might have access to select models only. Reach out to our support at [email protected] if you want discuss your generative model options.
Before generating molecules, you might want to know which generative models are available to your account. Each model has a unique ID that can be provided to the generator sample command to select a model.
To list all available models, use the models command:
The output will be a table listing the available models, their version, and their current status. Only models with an Online status can be used for sampling.
Example Output:
You can also get this list in a machine-readable format using the --json flag.
Guide: Sampling Molecules
To sample molecules from a generative model, use the sample command. You can specify the number of molecules to generate and the model to use.
1. Basic Sampling
To generate 1,000 molecules using any available online model and save them to a file named samples.smi:
If an output file is not specified with --output-file, the results will be saved to a default file that follows the pattern endingai_generator_sample_XXX.smi with XXX starting at 001 and being incremented in steps of 1.
2. Targeted Sampling with a Specific Model
To generate 5,000 molecules specifically from the diverse small transformer model (using its ID from the models command), run:
If you don't specify a model, the service will pick any model is available to your account and is online to generate the samples. It is highly recommended to always specify a model ID so that the generated molecules are suitable to the requirements of your specific task.
3. Appending to an Existing File
If you want to add more samples to an existing file without being prompted to overwrite it, use the --append flag:
Molecule Sampling Parameters
The following parameters can be used with the pendingai generator sample command:
-o, --output-file <FILE>Specifies the file path for storing the output SMILES molecules.
If not provided, it defaults to
pendingai_generator_sample_XXX.smiin the current directory.
-n, --num-samples <INTEGER>The number of molecules you want to generate.
Must be an integer between 1 and 1,000,000.
Defaults to 500 if not specified.
-m, --model <TEXT>The unique ID of the model you want to use for sampling.
Use the
pendingai generator modelscommand to find available model IDs.If not specified, the system will use any available online generator model.
-a, --appendA flag to indicate that the generated molecules should be appended to the output file if it already exists.
This also suppresses the prompt that asks for confirmation before overwriting a file.
Last updated
Was this helpful?

