# Install and Set Up the CLI

You will need `Python >=3.10` to use the Roboflow Python package.

After you have Python installed, run the following command to install:

```bash
pip install roboflow
```

After installing, test that the CLI works:

```bash
roboflow --help
```

## Authentication

There are three ways to authenticate:

### Option 1: Environment variable (recommended for scripts and agents)

```bash
export ROBOFLOW_API_KEY=rf_xxxxx
```

This is the recommended approach for CI/CD, automation, and AI coding agents. No interactive prompts required.

### Option 2: API key flag

```bash
roboflow --api-key rf_xxxxx project list
```

Pass the key directly to any command. Useful for one-off commands.

### Option 3: Interactive login

```bash
roboflow login
```

Open the link in your browser, get the token, and paste it in the terminal. Credentials are saved to `~/.config/roboflow/config.json` so you only need to do this once.

You can also log in non-interactively with:

```bash
roboflow auth login --api-key rf_xxxxx
```

## Verify Authentication

```bash
roboflow auth status
```

This shows your current workspace and a masked API key.

## Set Default Workspace

If you have access to multiple workspaces, set which one is used by default:

```bash
roboflow auth set-workspace my-workspace-id
```

## Shell Completion (Optional)

Enable tab completion for commands, options, and arguments:

```bash
# Zsh
eval "$(roboflow completion zsh)"

# Bash (requires bash >= 4.4)
eval "$(roboflow completion bash)"

# Fish
roboflow completion fish | source
```

To make it permanent, add the `eval` line to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.).
