omp packages

pi-uva-hva1.5.0

Pi coding-agent provider extension for the UvA/HvA LiteLLM proxy. Adds a /login connect flow (pick base URL, paste API key), discovers every model with real capabilities from /model_group/info, routes each to the right endpoint (Responses vs chat-completi

clearlynotmich Published 6 days ago MIT ~164 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

Pi extension (uva-hva-agentic-tools)

Part of uva-hva-agentic-tools. This is the Pi guide; for other tools see Claude Code, VS Code, OpenCode, Aider, Kilo Code, Factory Droid, or Odysseus.

npm version

A Pi coding-agent provider extension for the University of Amsterdam / Amsterdam University of Applied Sciences LiteLLM proxies (https://llmproxy.uva.nl/v1, https://llmproxy.hva.nl/v1).

Get every UvA/HvA model working in Pi in under a minute, without editing Pi's config files. Load the extension, run /login, pick your proxy, paste your API key, and it auto-discovers all available models so you can select one straight from /model. Your base URL and key are saved, so the next launch just reconnects. Reasoning models come pre-tuned (thinking on at medium), and tool-heavy agent turns that would otherwise silently come back empty on this proxy just work. That's the whole setup; everything below is optional detail.

Quick setup

Copy-paste these commands in a terminal. They install Node.js, Pi and the recommended extension set. If you only want the UvA/HvA provider, use the manual install instead.

1. Install Node.js (skip if node --version shows 22.19 or newer)

Windows (PowerShell):

winget install OpenJS.NodeJS.LTS

Close and reopen PowerShell afterwards so node and npm are found.

Linux / macOS (any distro, no admin rights needed, uses nvm):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
. "$HOME/.nvm/nvm.sh"
nvm install --lts

2. Install Pi

Linux / macOS:

curl -fsSL https://pi.dev/install.sh | sh

Windows (PowerShell):

powershell -c "irm https://pi.dev/install.ps1 | iex"

Or install it with npm, the same command on every platform:

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

Check it with pi --version.

Windows: if PowerShell says "running scripts is disabled on this system", run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once and try again.

3. Install the extensions

Windows (PowerShell):

$pkgs = "pi-uva-hva","@narumitw/pi-plan-mode","pi-ask-user","pi-btw",
  "@dietrichgebert/ponytail","pi-markdown-preview"
foreach ($p in $pkgs) { pi install "npm:$p" }
pi list

Linux / macOS:

for p in pi-uva-hva @narumitw/pi-plan-mode pi-ask-user pi-btw \
  @dietrichgebert/ponytail pi-markdown-preview
do pi install "npm:$p"; done
pi list

Already-installed packages are fine to re-run. Want only some? Remove them from the list; only pi-uva-hva is needed for the university proxy.

We also recommend Matt Pocock's skills. Optional: MCP servers.

4. Log in and pick a model

Start pi, then:

  1. Run /login, choose UvA / HvA proxy, pick your university and paste your own API key (never paste it into a chat or a repo).
  2. Run /model and select a model.
  3. Optional: for a model with a ~1M-token context, see the recommended context window.

This is a package-selection snapshot, not a version-locked environment. New installs resolve the published package versions available at installation time. Extensions run with your account's permissions; review the packages before installing them. Some, such as pi-btw, make additional model calls, so check their routing and cost settings before use.

Install

For the provider alone, you need Pi installed and a UvA/HvA proxy API key.

1. Load the extension

Pick one:

  • From npm : run
    pi install npm:pi-uva-hva
    
  • From a local clone: clone the repo and point at the pi/ folder instead:
    {
      "packages": [
        "/path/to/uva-hva-agentic-tools/pi"
      ]
    }
    

2. Connect with /login

Start Pi and run:

/login

Choose "UvA / HvA proxy", pick a base URL (UvA / HvA / custom), and paste your API key. The extension discovers every model and saves your base URL + key to openai-responses-uva.json in Pi's agent dir (~/.pi/agent unless --agent-dir or PI_CODING_AGENT_DIR is set), so the next launch reconnects with nothing re-entered. /uva-login runs the same flow.

Pi only lists the models that actually work for your key. During login, each model gets one tiny test request, so login can take up to two minutes. Models that return an error (for example a broken deployment on the proxy) are hidden. The result is remembered for a day, then checked again in the background when you start Pi. Run /login again to re-check right away.

Prefer env vars? Set UVA_API_KEY (and optionally UVA_BASE_URL) instead of /login. Both work.

3. Pick a model

/model           # select an available discovered model

Reasoning models default to thinking ON at medium. You can raise or lower a model's default in /configure-models, or set the level per run from the CLI:

pi --provider uva --model gpt-6.1-sol --thinking high -p "hello"

Configuration

/login is the easy path; everything is also configurable via environment variables (all optional):

Variable Default Purpose
UVA_API_KEY - API key, if you prefer env over /login. A saved /login wins when both exist.
UVA_BASE_URL https://llmproxy.uva.nl/v1 Proxy base URL (must end at the /v1 root).
UVA_PROVIDER_ID uva Provider id shown in /model and --provider.
UVA_CREDENTIALS_FILE <agent dir>/openai-responses-uva.json Override the saved-credentials path.
UVA_NO_AUTO_THINKING - Set to disable the medium thinking default.
UVA_MODEL_OVERRIDES_FILE - Path to a JSON file overriding per-model capabilities (below).

Per-model overrides

Capabilities come from the proxy metadata (with a name-table fallback). To pin a value yourself there are two ways.

Interactive menu (easiest): run /configure-models. Pick a model, then set its context window and max output (type the number), toggle reasoning on/off, and choose the default thinking level applied when that model is selected. Two options at the end, Save & apply changes and Discard & exit. Saved overrides are written to openai-responses-uva.models.json in Pi's agent dir and applied live (and on every future launch).

By hand: point UVA_MODEL_OVERRIDES_FILE at a JSON file (this overrides the default path above):

{
  "gpt-6.1-sol":    { "contextWindow": 272000, "maxTokens": 128000, "defaultThinkingLevel": "high" },
  "some-new-model": { "reasoning": false, "input": ["text", "image"], "contextWindow": 200000, "maxTokens": 32000 }
}

The defaultThinkingLevel on gpt-6.1-sol above is just an example of pinning one model to high; by default every reasoning model starts at medium.

Each key is a model id; each value may set any of reasoning, defaultThinkingLevel (off/low/medium/high/xhigh/max), input, contextWindow, maxTokens, vision, name, cost, thinkingLevelMap.

Recommended context window for 1M models

Some models can read about one million tokens at once. We cap them at 272k (272,000 tokens) in Pi, for two reasons:

  1. Lower costs. In agentic work every step resends the whole conversation, so a huge context gets expensive fast. A cap makes Pi compact the history before it grows unnecessarily large.
  2. Better answers. Once the context gets very full, models noticeably get worse: they miss details, forget instructions and make more mistakes (the "dumb zone"). Staying under 272k keeps the model in the range where it still works well.

The model can still handle more; 272k is just the working limit we chose.

To set it, run /configure-models in Pi, select your model, set Context window to 272000, then choose Save & apply changes. Leave Max output tokens and the other settings unchanged. Only do this for 1M models; don't raise smaller models to 272k.

To configure it by hand, merge the following into openai-responses-uva.models.json in Pi's agent dir (or your UVA_MODEL_OVERRIDES_FILE), preserving all other models and settings:

{
  "YOUR_DISCOVERED_1M_MODEL_ID": { "contextWindow": 272000 }
}

Replace the placeholder with an actual model ID from your proxy. Restart Pi after a manual file edit; the interactive menu applies its changes live. /configure-models belongs to this provider, not to all Pi providers. For other providers, use their documented context override mechanism; Pi also supports per-provider modelOverrides in ~/.pi/agent/models.json. A contextWindow field in the general settings.json is not the equivalent.

How it works

For each turn the custom stream handler:

  1. Lets Pi's pristine built-in openai-responses handler build the exact request params (full message + tool conversion, reasoning, caching) via an onPayload hook that captures the params and throws before the network call, so nothing extra is billed.
  2. Reissues the request itself and synthesizes Pi's content events (text / thinking / toolCall), reconciling the incremental SSE events with the terminal response.output[] by item id so a collapsed tool call is never lost. Tool-call ids and signatures are preserved for multi-turn replay.

Two dispatch paths keep it reliable:

  • Non-reasoning turns stream (stream:true): bytes flow, so the nginx gateway read-timeout keeps resetting and output is token-by-token.
  • Reasoning turns use background + poll (background:true + GET /responses/{id}): the model can buffer its whole reasoning phase with zero interim bytes without ever tripping a 504, because each request is short. A streaming turn that still hits a gateway 5xx before any output falls back to this path automatically.

Params incompatible with non-OpenAI backends (prompt_cache_key on Bedrock/Vertex) are stripped per-model.

Robust to model changes

The UvA/HvA line-up changes often, so nothing about specific models is hard-coded. On connect the extension reads the proxy's own /model_group/info and derives each model's context window, max output, reasoning/vision support, cost, and backend directly from it, then decides the endpoint from the backend (azure/bedrock speak the Responses API; open-weight openai/vLLM models use chat-completions). If that metadata endpoint is ever unavailable it falls back to /v1/models plus a researched name table, and if a model is still mis-routed, a Responses turn that 404s is self-healed at runtime (retried on chat-completions and remembered). So even if every current model is replaced with new ones, discovery, capabilities, and routing keep working with no code change.

Trade-off

Reasoning replies are not token-by-token; they appear at once on completion (the proxy only delivers background results as a single terminal payload). Non-reasoning turns stream normally.

Reasoning models

Reasoning is enabled per model from the proxy metadata (supports_reasoning or a reasoning_effort parameter), with the name table as a fallback, but only on the Responses route (chat-completions rejects reasoning_effort alongside tools). Reasoning models default to thinking ON at medium (disable with UVA_NO_AUTO_THINKING=1). Override any model's capabilities, including its default thinking level, per-id via UVA_MODEL_OVERRIDES_FILE or /configure-models.

Compatibility

  • Tested on Pi 1.7.0.
  • The offline tests (npm test in pi/) run on Linux and macOS only.
  • Imports only the extension-facing @earendil-works/pi-ai/compat entry, so it keeps working across Pi updates (it does not patch node_modules).

Pi harness setup

This is a description of a recommended setup, not a requirement to install everything just to use the university proxy. The quick setup contains the install commands.

Packages

Package description
pi-uva-hva The UvA/HvA provider documented on this page.
@narumitw/pi-plan-mode Read-only planning before the agent edits anything.
pi-ask-user The agent asks a structured question instead of guessing when a task is unclear.
pi-btw Ask a side question without interrupting the running task.
@dietrichgebert/ponytail Keeps changes small and readable, so you can understand and explain the code.
pi-markdown-preview Render Markdown/LaTeX and export previews.

Skills

Skills are reusable instructions that the agent loads when a task matches. We recommend installing all of Matt Pocock's skills. They help with planning, TDD, debugging, review, and writing specs and tickets: for example grill-with-docs, tdd, diagnosing-bugs, code-review, to-spec and to-tickets. Install all of them globally for Pi with the skills CLI (same command on every platform):

npx skills@latest add mattpocock/skills -g -a pi -s '*' -y

They are saved in ~/.agents/skills, which Pi reads when it starts. Run /skill:setup-matt-pocock-skills once in each repo. To update later, run npx skills@latest update -g, and run the add command again to pick up new skills. Skills run with the agent's permissions, so read them before you use them.

MCP servers

These are the public MCP servers we use through Pi's built-in MCP support. Merge them into the mcpServers of ~/.pi/agent/mcp.json (it applies to all projects; create the file if it does not exist). Check them with pi mcp list, then restart Pi or run /reload. If you still have pi-mcp-adapter installed, remove it: it replaces the built-in support, and Pi then ignores mcp.json.

{
  "mcpServers": {
    "playwright": { "command": "npx", "args": ["-y", "@playwright/mcp@latest", "--headless"] },
    "deepwiki": { "url": "https://mcp.deepwiki.com/mcp" },
    "context7": { "url": "https://mcp.context7.com/mcp" },
    "parallel-search": { "url": "https://search.parallel.ai/mcp", "exposure": "direct" },
    "github": { "url": "https://api.githubcopilot.com/mcp", "headers": { "Authorization": "!echo Bearer $(gh auth token)" } },
    "shadcn": { "command": "npx", "args": ["-y", "shadcn@latest", "mcp"] },
    "ui-layouts": { "command": "npx", "args": ["-y", "@ui-layouts/mcp@latest"] },
    "lazyweb": { "url": "https://www.lazyweb.com/mcp/public" },
    "avalonia-docs": { "url": "https://docs-mcp.avaloniaui.net/mcp" }
  }
}
Server description
playwright Drive a headless browser to test and inspect web pages.
deepwiki Ask questions about public GitHub repositories.
context7 Up-to-date library and framework documentation.
parallel-search Web search and page fetching for agents.
github Issues, pull requests and code on GitHub. Needs the GitHub CLI logged in (gh auth login); the token is read at connect time, never stored in the file. Checked on Linux; if the command fails on Windows, set GITHUB_TOKEN and use "Bearer ${GITHUB_TOKEN}" instead.
shadcn Browse and add shadcn/ui components.
ui-layouts UI layout and component examples.
lazyweb Real-app UI design references.
avalonia-docs Avalonia UI documentation (only for Avalonia/.NET projects).

Keep only the ones you need: each one starts a process or connection and adds a line to the system prompt.

License

MIT. See LICENSE.