CLI Commands
Complete reference for all PolarGrid CLI commands.
Authentication
polargrid login # Browser OAuth flow
polargrid login --headless # Show CI/CD instructions
polargrid logout # Clear stored credentials
polargrid whoami # Show current user and organization
Login
Opens browser for OAuth authentication:
For CI/CD, use environment variable instead:
export POLARGRID_API_KEY="pg_your_key"
Whoami
Shows your current authentication context:
Output:
User
Email: you@example.com
ID: abc123
Current Organization
Name: My Company
ID: org_xyz
Plan: pro
Organizations
polargrid orgs list # List organizations you belong to
polargrid orgs switch <org_id> # Switch to a different organization
polargrid orgs current # Show current organization
List Organizations
Shows all organizations you’re a member of, with your role in each.
Switch Organization
# By ID
polargrid orgs switch org_abc123
# By partial ID
polargrid orgs switch abc
# By name (case-insensitive)
polargrid orgs switch "my company"
# By slug
polargrid orgs switch my-company
API Keys
polargrid keys list # List API keys
polargrid keys create <name> # Create a new API key
polargrid keys revoke <key_id> # Revoke an API key
Create Key
polargrid keys create my-app-key
polargrid keys create prod-key --permissions admin
polargrid keys create dev-key --permissions read-only
polargrid keys create project-key --project proj_123
Options:
-p, --permissions <level>: read-only, read-write, or admin (default: read-write)
--project <id>: Scope key to a specific project
Copy your API key immediately — you won’t be able to see it again!
Revoke Key
polargrid keys revoke key_abc123
polargrid keys revoke key_abc123 --yes # Skip confirmation
Regions
polargrid regions list # List available regions with latency
polargrid regions ping # Ping all regions, show RTT
List Regions
Shows all regions with current latency from your location.
Ping Regions
polargrid regions ping
polargrid regions ping --count 5 # 5 pings per region (default: 3)
Shows min/avg/max latency to each region.
Testing
polargrid test # Health check (default)
polargrid test health # Check edge infrastructure health
polargrid test inference # Run a quick inference test
Health Check
# Check all regions
polargrid test health
# Check specific region
polargrid test health --region ymq-01
Inference Test
polargrid test inference \
--region montreal \
--model llama-3.1-8b \
--prompt "What is the capital of France?"
Options:
-r, --region <region>: Target region (required unless default set)
-m, --model <model>: Model to use (default: gpt2)
-p, --prompt <prompt>: Prompt to send (default: “Hello, how are you?”)
Configuration
polargrid config list # Show current config
polargrid config get <key> # Get a config value
polargrid config set <key> <val> # Set a config value
polargrid config unset <key> # Remove a config value
Available Config Options
| Key | Description |
|---|
default_region | Default edge region for requests |
output_format | Output format: json, table, or plain |
api_base_url | Override API base URL |
Examples
# Set default region
polargrid config set default_region ymq-01
# Check default region
polargrid config get default_region
# Clear default region
polargrid config unset default_region
# View all config
polargrid config list
Configuration Files
The CLI stores configuration in ~/.polargrid/:
| File | Description |
|---|
credentials.json | Auth tokens (mode 0600) |
config.json | CLI configuration |
CI/CD Example
#!/bin/bash
# ci-test.sh
export POLARGRID_API_KEY="${POLARGRID_API_KEY}"
# Health check
polargrid test health --region ymq-01
# Run inference test
polargrid test inference \
--region ymq-01 \
--model llama-3.1-8b \
--prompt "Integration test: respond with OK"