← Catalog

pi-prefill

Live prefill progress for pi

Extension

Install

Install with PiG

pig install npm:pi-prefill

Install with Pi

pi install npm:pi-prefill
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "image": "https://raw.githubusercontent.com/eliaskg/pi-prefill/main/assets/prefill.svg",
  "extensions": [
    "./extensions/prefill.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.3 (README.md). PiG does not review it.

pi-prefill

npm version Download Stats license

A pi extension that shows a live prefill progress bar in the loading line. It works with any server that reports prefill progress.

A long prefill can take many seconds. Without feedback, the loading line looks idle. You cannot tell a slow prefill from a hang. pi-prefill fills that gap with a real progress bar.

pi-prefill loading line: prefill progress bar climbing to 100 percent

What it shows

The bar tracks non-cached work only. Cached prompt tokens do not count as progress.

PartMeaning
prefillLabel.
[██████░░░░░░]Progress bar.
52%Percent of uncached tokens processed.
3.4k tok/sInstantaneous prefill rate.
gen in ~4sEstimated time until the first token.
14.1k/27.3kProcessed / total prompt tokens.

You choose which parts to show. See Configuration.

Supported Engines

EngineStatusSetup
llama.cpp🟢 supportednone. llama.cpp is in providers by default
oMLX🟢 supportedadd your provider id to providers
ExLlamaV3🟢 supported via TabbyAPIadd your provider id to providers
Unsloth🟢 supportedadd your provider id to providers
Strata🟢 supportedadd your provider id to providers
Project Maya🟢 supportedadd your provider id to providers
Splash🟢 supportedadd your provider id to providers
vLLM🟠 pending PR vllm#40371add your provider id to providers
mlx-serve🟠 pending PR mlx-serve#1174add your provider id to providers

All engines need api: "openai-completions" on the model. That is the API that defines prompt_progress.

pi-prefill sends return_progress: true for listed providers only. All engines default that flag to false. An unlisted provider gets no progress data and shows no bar. pi-prefill never guesses.

Install

pi install npm:pi-prefill

Configuration

Add a prefill key to ~/.pi/agent/settings.json. It controls which parts the bar shows, in what order, and which providers are asked for progress.

{
  "prefill": {
    "views": ["label", "bar", "percent", "tokens", "tps", "eta"],
    "providers": ["llama.cpp", "exllama"],
    "significantTokens": 1024
  }
}

Valid view names: label, bar, percent, tokens, tps, eta. Default when unset: ["label", "bar", "percent", "tokens", "eta"].

providers lists provider entries that receive return_progress: true. Default: ["llama.cpp"]. Add your compatible endpoint provider id to enable it there. An entry can end in a * wildcard, which matches dynamic provider ids like ["local-*"].

significantTokens sets the token cutoff from Short prefills. Default: 1024. A whole number of 0 or more is valid. 0 disables the token gate, so the time gate alone decides.

pi reads this file on session_start. Restart pi after you change it.

How it decides

pi parses each stream chunk and forwards it to extensions through provider_stream_event. pi-prefill reads that event. It never inspects a host name, an IP address, or a baseUrl.

Server behaviourResult
Stream carries prompt_progressbar is shown
Stream has no prompt_progressnothing is shown, pi's own loading line stays

The response decides. A cloud request, a proxy, or a server without progress support produces no output.

Short prefills

A bar that appears for 20 ms is noise. pi-prefill waits before it draws:

  • uncached total above significantTokens (default 1024) tokens: draw at once;
  • otherwise: draw only if prefill runs longer than 300 ms.

Cached tokens never count as progress.

Background cache warm

pi keeps provider prompt caches warm (cacheWarming setting, default "streaming"). A warm request is a real request, so it reaches the same hooks. With cacheWarming: "idle", a long warm prefill can draw a bar between your messages. Set cacheWarming to "off" if you do not want that.

Debug

Set PI_PREFILL_DEBUG=1 to log each inject, progress, and generation boundary:

PI_PREFILL_DEBUG=1 pi

The log goes to /tmp/pi-prefill-debug.log. Set PI_PREFILL_DEBUG_LOG to change the path.

License

MIT. See LICENSE.