The Algorithmia CLI is a cross-platform tool for interfacing with algorithms and the Algorithmia Data API.
This guide will cover:
Installing the Algorithmia CLI
The latest releases & changelog can be found here.
Linux and OSX
Install is by running:
On some linux variants, you may need to preinstall curl, file, and git via a command such as:
Download and extract the latest Windows x86_64 zip file. We recommend putting it within your
If needed, you can also find both MSVC and GNU builds for x86 and x86_64 on the release page.
Installation note: Python environment variable
If you’ll be running Python algos, also set the version via
export LANGUAGE_VERSION=python2 or
In order to make calls with the CLI, you’ll need to configure the authentication with an API key. If you don’t already have an API key, get started by signing up for an account at Algorithmia.com. Once you’ve completed the sign up process, copy the API key from your account dashboard.
Begin the configuration process by running the command
You will see an interactive prompt to guide you through setting up a default profile:
See Using multiple profiles for instructions on how to set authenticate and use more than one profile with the Algorithmia CLI tool.
To call an algorithm from the CLI, use the command syntax:
algo run, followed by the algorithm’s username and algorithm name, the data options, and finally the input. Here is a basic example calling the Factor algorithm:
Add the option
--response-body to see the full JSON response:
algo run --help to see more command options or view the following Options section.
Input Data Options
There are several options for specifying the type and source of input data. The Algorithmia CLI supports JSON, text, and binary data, as well as an option to auto-detect the data type.
|-d, –data||If the data parses as JSON, assume JSON, else if the data is valid UTF-8, assume text, else assume binary|
||Same as –data, but the input data is read from a file|
You may also explictly specify the input type as text (
-T), json (
-J), or binary (
-B) instead of using the auto-detection (
The algorithm result is printed to STDOUT by defauft. Additional notices may be printed to STDERR. If you’d like to output the result to a file, use the output option flag followed by a filename:
|–debug||Print algorithm’s STDOUT (author-only)|
|–response-body||Print HTTP response body (replaces result)|
|–response||Print full HTTP response including headers (replaces result)|
|-s, –silence||Suppress any output not explicitly requested (except result)|
||Print result to a file|
||Sets algorithm timeout|
The Algorithmia Data API
Use the Algorithmia CLI to interact with the Algorithmia Data API. You can use the CLI to create and manage your data directories.
Data commands include:
|ls||List contents of a data directory|
|mkdir||Create a data directory|
|rmdir||Delete a data directory|
|rm||Remove a file from a data directory|
|cp||Copy file(s) to or from a data directory|
|cat||Concatenate & print file(s) in a directory|
Examples of the Algorithmia Data API usage:
Create a data directory:
Copy a file from your local directory to the new data directory:
Using multiple profiles
Add additional profiles
With the Algorithmia CLI, you can configure multiple custom profiles to use. To add a new profile, you will run through the same interactive prompt–simply add a profile name to the command to add a new profile.
Now you may use
algo ls --profile second_user to list files in your
second_user account. For more information, see the auth command help with
algo auth --help.
Using profiles in commands
When running commands, the Algorithmia CLI will use the default profile unless otherwise specified with the
--profile <profile> option. See the following example: