The Nscale CLI is a powerful tool that allows you to interact with Nscale services directly from your terminal.

Installation

You can install the Nscale CLI using one of the following methods:

Option 1: Download Binary

Download the binary for your operating system from the releases page.

Option 2: Homebrew (for macOS users)

You can install the Nscale CLI using Homebrew:

# Tap our Homebrew repository
brew tap nscaledev/nscale

# Install the Nscale CLI
brew install nscale

Alternatively, you can combine both steps into a single command:

brew install nscaledev/tap/nscale

Authentication

Before using protected commands, you need to authenticate:

nscale login

This will open a browser to the Nscale Console UI, and store your access token on successful login.

Basic Usage

After installation and authentication, you can start using the CLI:

Exploring Available Models and Endpoints

To list available serverless endpoints, you need your organisation ID. Your organisation ID is in the browser URL after logging in. If you set up completions, you should be able to tab complete after the -o.

nscale inferencing serverless endpoints list -o <your organisation id>

To inference models, you need your API Key. You can create one in the Nscale Console UI.

nscale chat "What is machine learning?" -a $NSCALE_API_KEY -m meta-llama/Llama-3.1-8B-Instruct```

Getting Help

You can get help for any command by adding the --help flag:

nscale --help
nscale inferencing --help

Shell Completion

To enhance your CLI experience, you can set up shell completion for autocomplete of CLI commands, and organisations.

Bash

# Load completions for current session
source <(nscale completion bash)

# To load completions for every session, execute once:
# Linux:
nscale completion bash > /etc/bash_completion.d/nscale
# macOS:
nscale completion bash > $(brew --prefix)/etc/bash_completion.d/nscale

Zsh

# If shell completion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
echo "autoload -U compinit; compinit" >> ~/.zshrc

# To load completions for every session, execute once:
# First, check your fpath directories to find the right location:
echo $fpath

# Then, create a directory for completions if it doesn't exist:
mkdir -p ~/.zsh/completions
nscale completion zsh > ~/.zsh/completions/_nscale
# Then add to your ~/.zshrc if you haven't already configured completions:
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc

# You will need to source your ~/.zshrc or start a new shell for this setup to take effect.

Fish

# Load completions for current session
nscale completion fish | source

# To load completions for every session, execute once:
mkdir -p ~/.config/fish/completions
nscale completion fish > ~/.config/fish/completions/nscale.fish

PowerShell

# Load completions for current session
nscale completion powershell | Out-String | Invoke-Expression

# To load completions for every new session, run:
nscale completion powershell > nscale.ps1
# and source this file from your PowerShell profile.

Next Steps

Now that you have the CLI set up, you can:

Contact Support

Need assistance? Get help from our support team