Skip to main content
In this tutorial, we will teach you how to use the command-line interface to run models. We will be querying the RedPajama-INCITE-7B-Base model to complete the phrase β€œSpace robots are”. For the full API reference go to API Reference.

Pre-requisites

  • Make sure you have Python installed in your CLI.
  • Obtain an API key from Together to access the Inference API by signing up.

Install the Library

Launch your terminal and install or update the Together CLI by executing the following command:

Authenticate

The API Key can be configured by setting the TOGETHER_API_KEY environment variable, like this:
Find your API token in your account settings.

Query a chat model

Query a chat model by running the following command.
The Chat Completions CLI enables streaming tokens to stdout by default. To disable streaming, use --no-stream.

Query a language or code model

To run a completion for a language or code model, use the completions method in the CLI.
The Completions CLI enables streaming tokens to stdout by default. To disable streaming, use --no-stream.

Query an image model

To query an image model, use the images method in the CLI.
The image is opened in the default image viewer by default. To disable this, use --no-show.

List all models

To list all the available models, run the following: