Skip to main content

CLI Guide

The Galadriel CLI is a command-line tool for interacting with the GPU marketplace. It provides a kubectl-style interface for managing orders, leases, and marketplace operations.

Installation

curl -sSL https://galadriel.com/install.sh | sh
Verify installation:
galadriel version

Configuration

Initial Setup

galadriel configure
You’ll be prompted for: Configuration is saved to ~/.galadriel/config.yaml:
api_token: gal_abc123...
default_zone: us-west-1
ssh_public_key: ssh-ed25519 AAAAC3...

Environment Variables

Override config with environment variables:
export GALADRIEL_TOKEN=gal_abc123...
export GALADRIEL_ZONE=us-west-1

Marketplace Commands

Create Buy Order

Market Order (Instant)

galadriel order buy \
  --gpu-type h100 \
  --gpus 16 \
  --duration 24h \
  --zone us-west-1 \
  --type market
Options:
  • --gpu-type - GPU type: h100, h200, b200, b300
  • --gpus - Number of GPUs (multiple of 8)
  • --duration - Duration: 12h, 24h, 7d, etc.
  • --zone - Availability zone
  • --type - Order type (default: market)

Limit Order (Wait for Price)

galadriel order buy \
  --gpu-type h100 \
  --gpus 16 \
  --duration 24h \
  --price 3.20 \
  --zone us-west-1
Additional Options:
  • --price - Maximum price per GPU/hour
  • --start - Start time (ISO 8601, default: now)

Flexible Order (Best Price)

galadriel order buy \
  --gpu-type h100 \
  --gpus 8 \
  --duration 12h \
  --price 3.00 \
  --flex 48h \
  --zone us-west-1
Additional Options:
  • --flex - Time window for execution

List Orders

# All active orders
galadriel order list

# Filter by status
galadriel order list --status pending
galadriel order list --status filled

# Filter by side
galadriel order list --side buy
galadriel order list --side sell
Output:
ORDER ID     TYPE    SIDE  GPUs  STATUS   PRICE    FILLED  CREATED
ord_abc123   market  buy   16    filled   -        16/16   2h ago
ord_def456   limit   buy   16    pending  $3.20    0/16    30m ago
ord_ghi789   limit   sell  8     pending  $3.80    0/8     1h ago

Get Order Status

galadriel order get ord_abc123
Output:
ORDER ID:     ord_abc123
TYPE:         limit
SIDE:         buy
GPU TYPE:     h100
GPU COUNT:    16
LIMIT PRICE:  $3.50/hr
STATUS:       partial
FILLED:       8/16 GPUs (50%)
AVG PRICE:    $3.45/hr
CREATED:      2h ago
EXPIRES:      in 2h

MATCHES:
  - 8 GPUs @ $3.45/hr (matched 1h ago)
    Lease: lse_xyz123

Cancel Order

# Cancel entire order
galadriel order cancel ord_abc123

# Cancel with confirmation
galadriel order cancel ord_abc123 --yes

Orderbook Commands

View Orderbook

galadriel orderbook --gpu-type h100 --zone us-west-1
Output:
📊 Orderbook: H100 @ us-west-1 (2025-11-11 14:00 UTC)

Market Depth:
  Best Bid:  $1.30/GPU/hr  (24 GPUs)
  Best Ask:  $1.40/GPU/hr  (16 GPUs)
  Spread:    $0.10 (7.69%)
  Mid Price: $1.35

Bids (Buy Orders):                     Asks (Sell Orders):
  $1.30 ████████████████ 24 GPUs        $1.40 ████████ 16 GPUs
  $1.25 ███████████ 16 GPUs             $1.45 ████ 8 GPUs
  $1.20 ███████████████████ 32 GPUs     $1.50 ████████████ 24 GPUs

Last Trade: $1.35 (8 GPUs) @ 13:55 UTC
24h Volume: 1,920 GPU-hours
Options:
  • --gpu-type - GPU type
  • --zone - Availability zone
  • --depth - Number of price levels (default: 10)

View Prices

# Historical prices
galadriel prices --gpu-type h100 --zone us-west-1 --days 7

# Custom time range
galadriel prices \
  --gpu-type h100 \
  --zone us-west-1 \
  --start "2025-11-01T00:00:00Z" \
  --end "2025-11-07T23:59:59Z"

# With interval
galadriel prices --gpu-type h100 --zone us-west-1 --interval 1h

Get Price Estimate

galadriel prices estimate \
  --gpu-type h100 \
  --gpus 16 \
  --zone us-west-1
Output:
Price Estimate for Market Order
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
GPU Type: H100
Zone: us-west-1
Quantity: 16 GPUs

Estimated price: $1.38/hr (weighted average)
Best ask: $1.40/hr
Worst fill price: $1.45/hr
Total available: 48 GPUs
Sufficient liquidity: YES ✓

For 24h lease:
  Estimated cost: $530.88
  Platform fee: $53.09
  Total: $583.97

Lease Management

List Leases

# All active leases
galadriel list

# Filter by status
galadriel list --status all
galadriel list --status active
galadriel list --status expired
Output:
LEASE ID    GPUs  GPU TYPE  ZONE       STATUS  EXPIRES             COST/HR
lse_xyz123  16    H100      us-west-1  active  2025-11-12 14:00   $3.70
lse_abc456  8     H100      us-east-1  active  2025-11-07 10:00   $3.50

Get Lease Details

galadriel get lse_xyz123
Output:
LEASE ID:       lse_xyz123
CUSTOMER ID:    alice
GPU TYPE:       h100
GPU COUNT:      16
INSTANCE TYPE:  16xh100
NODES:          gpu-node-042, gpu-node-043
ZONE:           us-west-1
STATUS:         active
NAMESPACE:      customer-alice-lse-xyz123

TIMING:
  Start:        2025-11-11 14:00 UTC
  End:          2025-11-12 14:00 UTC
  Duration:     24h
  Remaining:    18h 30m

COST:
  Rate:         $1.40/GPU/hr
  Total cost:   $1,420.80
  Spent so far: $324.40
  Remaining:    $1,096.40

SSH ACCESS:
  [email protected]:22
  [email protected]:22

KUBECONFIG:
  ~/.kube/galadriel-lse-xyz123.conf

Get Kubeconfig

# Print to stdout
galadriel kubeconfig lse_xyz123

# Save to file
galadriel kubeconfig lse_xyz123 --save ~/.kube/galadriel.conf

# Set as current context
galadriel kubeconfig lse_xyz123 --set

SSH Access

# SSH to first node
galadriel ssh lse_xyz123

# SSH to specific node
galadriel ssh lse_xyz123 --node gpu-node-042

# SSH with custom command
galadriel ssh lse_xyz123 -- nvidia-smi

Resell Lease

# Basic resell
galadriel lease resell lse_xyz123 --price 3.00

# With transfer time
galadriel lease resell lse_xyz123 \
  --price 3.00 \
  --from "2025-11-12T14:00:00Z"

# Transfer immediately
galadriel lease resell lse_xyz123 \
  --price 3.00 \
  --transfer-now
Output:
💰 Creating resell order for unused GPU time...
✓ Order ID: ord_resell123
✓ Lease: lse_xyz123 (16x H100 GPUs)
✓ Original price: $3.45/GPU/hr
✓ Resell price: $1.20/GPU/hr
✓ Time remaining: 48 hours
✓ Potential recovery: $2,304.00
✓ After 10% platform fee: $1,958.40

Terminate Lease

# Terminate with confirmation
galadriel terminate lse_xyz123

# Skip confirmation
galadriel terminate lse_xyz123 --yes

Inventory Commands

View Inventory

# All zones
galadriel inventory

# Specific zone
galadriel inventory --zone us-west-1

# Specific GPU type
galadriel inventory --gpu-type h100
Output:
GPU Inventory
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

us-west-1:
  H100:  800 GPUs (100 nodes) available
  H200:  240 GPUs (30 nodes) available
  B200:  160 GPUs (20 nodes) available
  B300:   80 GPUs (10 nodes) available

us-east-1:
  H100:  640 GPUs (80 nodes) available
  H200:  192 GPUs (24 nodes) available
  B200:  128 GPUs (16 nodes) available
  B300:   64 GPUs (8 nodes) available

eu-west-1:
  H100:  480 GPUs (60 nodes) available
  H200:  144 GPUs (18 nodes) available
  B200:   64 GPUs (8 nodes) available
  B300:    8 GPUs (1 node) available

Total: 3,000 GPUs across all zones

Billing Commands

View Usage

# Current billing period
galadriel billing usage

# Previous period
galadriel billing usage --period previous
Output:
Billing Period: November 2025
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Current Charges: $7,139.66

Active Leases:
  lse_xyz123: 384 GPU-hours @ $3.70/hr = $1,689.60
  lse_abc456: 192 GPU-hours @ $3.50/hr = $  806.40

Payment Method: Card ending in 1234
Due Date: 2025-12-08

View Invoices

# Recent invoices
galadriel billing invoices

# With limit
galadriel billing invoices --limit 10

Global Options

All commands support these global flags:
--token string      API token (overrides config)
--zone string       Default availability zone
--output string     Output format: text, json, yaml
--verbose          Enable verbose output
--quiet            Suppress all output except errors
--yes              Skip confirmations

Examples

# JSON output
galadriel list --output json

# Different token
galadriel order list --token gal_different_token

# Quiet mode
galadriel terminate lse_xyz123 --yes --quiet

Bash Completion

Setup

# Bash
galadriel completion bash > /etc/bash_completion.d/galadriel

# Zsh
galadriel completion zsh > "${fpath[1]}/_galadriel"

# Fish
galadriel completion fish > ~/.config/fish/completions/galadriel.fish

Usage

After setup, tab completion works:
galadriel or<TAB>     # Completes to "galadriel order"
galadriel order <TAB>  # Shows: buy, sell, list, get, cancel

Advanced Usage

Piping and Scripting

# Get all pending order IDs
galadriel order list --status pending --output json | jq -r '.orders[].order_id'

# Cancel all pending orders
for id in $(galadriel order list --status pending --output json | jq -r '.orders[].order_id'); do
  galadriel order cancel $id --yes
done

# Export kubeconfigs for all leases
for lease in $(galadriel list --output json | jq -r '.leases[].lease_id'); do
  galadriel kubeconfig $lease --save ~/.kube/$lease.conf
done

Watch Mode

# Watch orders
watch -n 5 'galadriel order list'

# Watch orderbook
watch -n 10 'galadriel orderbook --gpu-type h100 --zone us-west-1'

# Watch leases
watch -n 30 'galadriel list'

Aliases

Add to your ~/.bashrc or ~/.zshrc:
alias gb='galadriel order buy'
alias gl='galadriel list'
alias gk='galadriel kubeconfig'
alias gs='galadriel ssh'
alias go='galadriel orderbook'

Troubleshooting

Common Issues

Ensure the CLI is in your PATH:
which galadriel
If not found, add to PATH:
export PATH=$PATH:/usr/local/bin
Check your API token:
cat ~/.galadriel/config.yaml | grep api_token
Reconfigure if needed:
galadriel configure
Check the orderbook to see if your price is competitive:
galadriel orderbook --gpu-type h100 --zone us-west-1
Cancel and retry with better price or use market order.

Debug Mode

Enable verbose logging:
galadriel --verbose order list

Next Steps