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

# Quickstart

> Get started with Galadriel in under 5 minutes

## Get Your First GPUs in 5 Minutes

This guide will walk you through purchasing GPU time, deploying a workload, and cleaning up.

## Prerequisites

* Unix-based system (macOS or Linux)
* Credit card for payment
* SSH key (optional, but recommended)

## Step 1: Install the CLI

<CodeGroup>
  ```bash macOS/Linux theme={null}
  curl -sSL https://galadriel.com/install.sh | sh
  ```

  ```bash Homebrew theme={null}
  brew install galadriel/tap/galadriel-cli
  ```

  ```bash Manual Download theme={null}
  # Download latest release
  wget https://github.com/galadriel-io/cli/releases/latest/download/galadriel-linux-amd64
  chmod +x galadriel-linux-amd64
  sudo mv galadriel-linux-amd64 /usr/local/bin/galadriel
  ```
</CodeGroup>

Verify installation:

```bash theme={null}
galadriel version
```

## Step 2: Configure Authentication

Create an account and get your API token:

```bash theme={null}
galadriel configure
```

You'll be prompted to:

1. Enter your API token (get one at [https://app.galadriel.com/settings/tokens](https://app.galadriel.com/settings/tokens))
2. Set default zone (e.g., `us-west-1`)
3. Add your SSH public key (optional)

Your configuration is saved to `~/.galadriel/config.yaml`.

<Tip>
  Create an API token at [https://app.galadriel.com/settings/tokens](https://app.galadriel.com/settings/tokens) with full access permissions.
</Tip>

## Step 3: Check the Marketplace

Before buying, check current prices and availability:

```bash theme={null}
# View orderbook for H100 GPUs in us-west-1
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
```

Get a price estimate:

```bash theme={null}
galadriel prices estimate --gpu-type h100 --gpus 16 --zone us-west-1
```

## Step 4: Purchase GPUs

### Option A: Market Order (Instant)

Buy GPUs immediately at the current market price:

```bash theme={null}
galadriel order buy \
  --gpu-type h100 \
  --gpus 16 \
  --duration 24h \
  --zone us-west-1 \
  --type market
```

<Note>
  Market orders execute instantly but you pay the current best ask price. For this example, you'd pay \~\$1.40/GPU/hr.
</Note>

### Option B: Limit Order (Save Money)

Wait for a specific price:

```bash theme={null}
galadriel order buy \
  --gpu-type h100 \
  --gpus 16 \
  --duration 24h \
  --price 1.30 \
  --zone us-west-1
```

<Tip>
  Limit orders can save 10-25% but may take minutes to hours to fill. Use this for non-urgent workloads.
</Tip>

Expected output:

```
🛒 Creating market buy order for 16 GPUs...
✓ Order matched instantly!
✓ Order ID: ord_abc123
✓ Matched at: $1.40/GPU/hour
✓ Total cost: $537.60 (16 GPUs * 24h * $1.40)
✓ Lease ID: lse_xyz123
✓ Nodes: gpu-node-042, gpu-node-043

📦 Getting kubeconfig...
✓ Saved to ~/.kube/galadriel-lse_xyz123.conf

🎉 Your cluster is ready!
```

## Step 5: Connect to Your GPUs

### Option A: Using kubectl

Set your kubeconfig:

```bash theme={null}
export KUBECONFIG=~/.kube/galadriel-lse_xyz123.conf
```

Verify access:

```bash theme={null}
kubectl get nodes
```

Output:

```
NAME            STATUS   ROLES    AGE   VERSION
gpu-node-042    Ready    <none>   30s   v1.30.0
gpu-node-043    Ready    <none>   30s   v1.30.0
```

### Option B: Using SSH

SSH directly to a node:

```bash theme={null}
galadriel ssh lse_xyz123
```

Or specify a node:

```bash theme={null}
galadriel ssh lse_xyz123 --node gpu-node-042
```

## Step 6: Deploy a Workload

### Simple GPU Test

Create `gpu-test.yaml`:

```yaml theme={null}
apiVersion: v1
kind: Pod
metadata:
  name: gpu-test
spec:
  containers:
  - name: cuda-test
    image: nvidia/cuda:12.2.0-base-ubuntu22.04
    command: ["nvidia-smi"]
    resources:
      limits:
        nvidia.com/gpu: 1
  restartPolicy: Never
```

Deploy:

```bash theme={null}
kubectl apply -f gpu-test.yaml
kubectl logs gpu-test
```

### Multi-Node Training Job

Create `distributed-training.yaml`:

```yaml theme={null}
apiVersion: batch/v1
kind: Job
metadata:
  name: distributed-training
spec:
  completions: 2
  parallelism: 2
  template:
    spec:
      containers:
      - name: trainer
        image: nvcr.io/nvidia/pytorch:23.10-py3
        command:
          - python
          - -m
          - torch.distributed.run
          - --nproc_per_node=8
          - --nnodes=2
          - train.py
        resources:
          limits:
            nvidia.com/gpu: 8
        volumeMounts:
        - name: infiniband
          mountPath: /dev/infiniband
      volumes:
      - name: infiniband
        hostPath:
          path: /dev/infiniband
      nodeSelector:
        nvidia.com/gpu.product: NVIDIA-H100-80GB-HBM3
```

Deploy:

```bash theme={null}
kubectl apply -f distributed-training.yaml
kubectl get pods -w
```

## Step 7: Monitor Your Lease

Check lease details:

```bash theme={null}
galadriel get lse_xyz123
```

List all active leases:

```bash theme={null}
galadriel list
```

Output:

```
LEASE ID    GPUs  GPU TYPE  ZONE       STATUS  EXPIRES             COST/HR
lse_xyz123  16    H100      us-west-1  active  2025-11-12 14:00   $1.40
```

## Step 8: Cleanup (Optional)

### Finished Early?

If you're done before your 24 hours are up, you have two options:

#### Option A: Terminate and Get Refund

```bash theme={null}
galadriel terminate lse_xyz123
```

You'll get a prorated refund for unused time.

#### Option B: Resell Unused Time

Recover even more by reselling to the marketplace:

```bash theme={null}
# Resell remaining time at $1.20/GPU/hr
galadriel lease resell lse_xyz123 --price 1.20
```

If matched, you'll receive:

* Original refund from Galadriel
* Net recovery from marketplace sale (minus 10% platform fee)

See the [Reselling Guide](/marketplace/reselling) for details.

### Automatic Cleanup

Your lease automatically expires and cleans up at the end time. You'll receive:

* 5-minute warning notification
* Automatic namespace deletion
* Complete resource cleanup

## Next Steps

<CardGroup cols={2}>
  <Card title="Understand the Marketplace" icon="scale-balanced" href="/marketplace/how-it-works">
    Learn about order types and pricing strategies
  </Card>

  <Card title="Cluster Specs" icon="microchip" href="/marketplace/cluster-specs">
    GPU types, system specs, and access model
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference">
    REST API and SDK documentation
  </Card>

  <Card title="Examples" icon="book" href="/examples">
    Real-world training examples
  </Card>
</CardGroup>

## Common Issues

<AccordionGroup>
  <Accordion title="Order not filling">
    **Limit orders** may not fill if your price is too low. Check the current orderbook:

    ```bash theme={null}
    galadriel orderbook --gpu-type h100 --zone us-west-1
    ```

    Cancel and create a new order with a higher price, or switch to a market order.
  </Accordion>

  <Accordion title="kubectl connection refused">
    Make sure your kubeconfig is set:

    ```bash theme={null}
    export KUBECONFIG=~/.kube/galadriel-lse_xyz123.conf
    ```

    Or get the kubeconfig again:

    ```bash theme={null}
    galadriel kubeconfig lse_xyz123 --save ~/.kube/galadriel.conf
    ```
  </Accordion>

  <Accordion title="SSH permission denied">
    Verify your SSH key was added during configuration:

    ```bash theme={null}
    cat ~/.galadriel/config.yaml | grep ssh_public_key
    ```

    If not set, reconfigure:

    ```bash theme={null}
    galadriel configure
    ```
  </Accordion>
</AccordionGroup>

## Getting Help

* **Email**: [support@galadriel.com](mailto:support@galadriel.com)
* **Slack**: [https://galadriel-community.slack.com](https://galadriel-community.slack.com)
* **GitHub Issues**: [https://github.com/galadriel-io/galadriel/issues](https://github.com/galadriel-io/galadriel/issues)
* **Status Page**: [https://status.galadriel.com](https://status.galadriel.com)
