# Getting Started

## Installation

This extension is a Pi Coding Agent extension. Install it with:

```bash
pi install npm:@faks/pi-gateway
```

Or directly from GitHub:

```bash
pi install https://github.com/faks/pi-gateway
```

## Prerequisites

- A running [llama.cpp server](https://github.com/ggml-org/llama.cpp) (local or remote)
- Pi Coding Agent installed and configured

### Starting the Server

**Single model mode:**

```bash
llama-server --model path/to/model.gguf --port 8080
```

**Multi-model router mode:**

```bash
llama-server --models-preset path/to/presets.ini --port 8080
```

**With API authentication:**

```bash
llama-server --model path/to/model.gguf --port 8080 --api-key your-secret-key
```

**With auto-sleep (models sleep after inactivity):**

```bash
llama-server --model path/to/model.gguf --port 8080 --sleep-idle-seconds 300
```

## Quick Start

1. Start your llama.cpp server
2. Open Pi and run `/models` to browse available models
3. Select a model to load, switch, or unload

That's it — the extension auto-detects your server at `http://127.0.0.1:8080` by default.

## Status Indicators

| Icon | Status | Description |
|------|--------|-------------|
| 🟢 | Loaded | Model is active and ready to use |
| 🟡 | Loading | Model is currently being loaded |
| 🔴 | Failed | Model failed to load |
| 🔵 | Sleeping | Model is available but inactive |
| ⚪ | Unloaded | Model is not loaded on the server |
| ⛔ | Unauthorized | API key required |

> **Note:** The `Sleeping` status only appears when you start your server with `--sleep-idle-seconds <n>`.
