---
slug: "gaurav-321-pi-local-llm"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/gaurav-321/pi-local-llm@main/README.md"
repo: "https://github.com/gaurav-321/pi-local-llm"
source_file: "README.md"
branch: "main"
---
# @gaurav-321/pi-local-llm

Pi coding agent extension for local LLM providers: **LM Studio**, **llama.cpp**, and **llama-swap**.

## Features

- Registers a `llama-swap` provider with dynamic model discovery
- Supports LM Studio, llama.cpp, and llama-swap backends
- Per-model context window detection with overrides
- Optional config via `~/.pi/agent/pi-llama-swap.json`

## Install

```bash
pi install npm:@gaurav-321/pi-local-llm
```

Or load directly:

```bash
pi -e /path/to/pi-llama-swap
```

## Quick Start

1. Start your local LLM server (LM Studio, llama.cpp, or llama-swap)
2. Load the extension: `pi -e /path/to/pi-llama-swap`
3. Select a model: `/model` → pick `llama-swap/your-model-id`

## Config

Create `~/.pi/agent/pi-llama-swap.json`:

```json
{
  "origin": "http://127.0.0.1",
  "port": 8080,
  "apiKey": "optional"
}
```

## Commands

| Command | Description |
|---------|-------------|
| `/llama-swap-set-context-length <n>` | Override context window for current model |

## License

MIT
