Date2022-07-07 09:58

Introducing Kili Command-line interface

Introducing Kili Command-line interface

What is Kili CLI?

Kili provides an API to integrate the data labeling with your data science workflow. It is a flexible tool, which allows you to query and mutate data quickly and painlessly.

Until now, this API could be accessed through a Python SDK or directly from the GraphQL endpoint.

We are glad to announce that we are releasing a command-line interface (CLI) tool. Kili CLI allows you to trigger key actions on your project with short commands from the terminal.You can now create projects, list your projects, import data and labels, and more, directly from your prompt.

Why a CLI?

Whether you are a Machine Learning Engineer, a Data Scientist, or a Data Engineer, Kili CLI is an important, new tool to integrate into your workflow. Its impact is threefold:

  • Ease of use: Kili CLI allows you to easily manipulate objects from your Kili organization without using the UI, instantiating a client in Python, or running graphQL queries and mutations. It is directly actionable from your prompt, with one-liner commands.

  • Productivity: Thanks to Kili CLI, some simple project-related tasks can be performed by Data Labeling Managers. This can increase the overall administration and management productivity.

  • Compactness: While the SDK allows you to run exhaustive actions on the API at the cost of increased complexity, the CLI allows you to run powerful, high-level actions in a single line. Several workflows that previously required building complex scripts can now be automated more easily.

How to set it up?

To use Kili CLI, you must have the Kili package installed.

If you don’t have it yet, you can simply install it with this command:

pip install kili

To try it out, type this in your prompt:

kili --version

kili --help


To be able to communicate with your Kili project, you must:

  • have a license that allows you to use the API

  • set your API key as an environment variable

export KILI_API_KEY='<your API key value here>'

Only if you are an on-premise client:

If you are an on-premise client, you must also set your API endpoint as an environment variable.

export KILI_API_ENDPOINT='<your API endpoint here>'

You are now ready to use Kili CLI!

The CLI is built as a command repository. All commands are currently nested under the project command, as they allow the management of entities related to a specific Kili project. 

How to use it?

To help you get started with the Kili CLI, see an example of a project creation workflow. The example that follows is a tweet sentiment analysis classification project.

Create a project

As we work with text inputs, let’s first create a TEXT project. The interface has to be saved as a JSON file. To do that, use the create subcommand:


The command returns the newly-created project ID and a URL for quick access to your project on the web platform.

Import assets into your project 

Let’s assume that all your text assets are saved in a folder named dataset on your local machine.

You can simply import all these assets by providing the dataset folder path in the import subcommand:


Kili CLI will automatically select all files that can be imported into your project and then import them. 

Import Labels or Predictions into your project

Kili CLI lets you import labels into your project. You can either import ground truth labels, or predictions generated by a pre-annotation model. Suppose, for example that you have a pre-annotation model that generated predictions for all your assets. The predictions are stored in JSON files, in the Kili annotation format, and listed in the labels.csv file. To import labels or predictions, use the label subcommand:


Kili CLI also contains other commands and more will gradually be added (like member management, for example). To see every command and to access the technical reference information on how to use them, see our technical documentation website: https://python-sdk-docs.kili-technology.com/latest/cli

Don’t hesitate to contact support at [email protected] to provide feedback or if you have any questions.

Related resources