> ## Documentation Index
> Fetch the complete documentation index at: https://polargrid.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI Quickstart

> Get started with the PolarGrid CLI

# CLI

Command-line interface for PolarGrid Edge AI Infrastructure.

## Installation

```bash theme={null}
npm install -g @polargrid/cli
```

## Quick Start

```bash theme={null}
# Login to PolarGrid (opens browser)
polargrid login

# Check who you're logged in as
polargrid whoami

# List your organizations
polargrid orgs list

# Create an API key
polargrid keys create my-app-key

# Set default region
polargrid config set default_region yto-01

# Chat with a model (streaming)
polargrid chat "What is the capital of Canada?"

# Text-to-speech
polargrid tts "Hello from PolarGrid" --output hello.mp3
```

## Authentication

### Browser Login (Interactive)

```bash theme={null}
polargrid login
```

Opens your browser for OAuth authentication. Your credentials are stored **encrypted at rest** in your OS keychain (macOS Keychain, Windows Credential Manager, or Linux Secret Service), with an AES-256-GCM encrypted file at `~/.polargrid/credentials.enc` as a fallback where no keychain is available.

### API Key (CI/CD)

For CI/CD pipelines, no login is needed. Just set the environment variable:

```bash theme={null}
export POLARGRID_API_KEY="pg_your_api_key"

# Now you can run inference commands
polargrid chat "Hello" --no-interactive
```

### Check Current Session

```bash theme={null}
polargrid whoami
```

Shows your email, user ID, and current organization.

### Logout

```bash theme={null}
polargrid logout
```

## Shell Completions

Enable tab-completion for commands, subcommands, and flags:

```bash theme={null}
# Bash
eval "$(polargrid completion bash)" >> ~/.bashrc

# Zsh
eval "$(polargrid completion zsh)" >> ~/.zshrc

# Fish
polargrid completion fish > ~/.config/fish/completions/polargrid.fish
```

## Next Steps

<Card title="All Commands" icon="terminal" href="/sdks/cli/commands">
  Complete command reference for auth, inference, models, GPU, and more
</Card>
