pi-cadence

Pi extension that spreads free-tier model requests across relays so the per-IP rate limit adds up

Packages

Package details

extension

Install pi-cadence from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-cadence
Package
pi-cadence
Version
0.1.7
Published
Nov 16, 2026
Downloads
1,327/mo · 1,327/wk
Author
fn-cafeina
License
MIT
Types
extension
Size
44.2 KB
Dependencies
1 dependency · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-cadence

Free-tier models spread across relays so the per-IP rate limit adds up.

The default provider allows 2 requests per minute per IP and per model. Your own connection is one lane; every relay adds another. Ten relays plus your own connection is 11 lanes, 22 rpm per model. Fewer relays means fewer lanes; it also works with none (2 rpm on your own connection).

Install

pi install npm:pi-cadence                           # from npm (recommended)
pi install git:github.com/fn-cafeina/pi-cadence     # from git
pi install ./pi-cadence                             # local path

pi list shows what is installed, pi remove npm:pi-cadence removes it.

No API key, no /login. The provider shows up as cadence with nine models.

Use

/cadence              state: lanes, free quota per model
/cadence list         saved relays, numbered
/cadence add [relay]  add a relay, or open the editor to paste many
/cadence remove [n]   delete one by number
/cadence test [n]     probe one relay by number, or all of them
/cadence help         show the commands

/cadence add relay saves one relay; with no argument it opens a multiline editor. Paste your whole proxy list, in either format, and it figures out each line:

45.38.107.97:6014:user:pass
http://user:pass@45.38.107.97:6014
proxy.example.com:8080

Each relay is probed against the provider before it is saved. Dead ones are reported and dropped, so a broken relay never silently joins the pool. Probing costs no rate limit.

/cadence test warns when two relays share one egress IP, printing the shared IP, because those two share a bucket and the real limit is lower than the lane count suggests.

Relays are stored in ~/.pi/agent/cadence.json with mode 0600. If the file is corrupt, the next save moves it to cadence.json.bak instead of overwriting it.

Then pick a model:

/model          → cadence/Qwen3.8-27B

Models

model thinking vision context
gpt-oss-20b, gpt-oss-120b low, medium, high no 131k
Qwen3.8-27B off, low, medium, xhigh yes 262k
Qwen3.6-27B off, low, medium, high, xhigh, max yes 262k
Qwen3.5-9B, Qwen3.5-397B-A17B off, low, medium, high yes 262k
Mistral-Small-3.2-24B-Instruct-2506 no yes 131k
Qwen2.5-VL-72B-Instruct no yes 32k
Meta-Llama-3_3-70B-Instruct no no 131k

Thinking levels are mapped to what each model actually accepts. high on Qwen3.8 became xhigh because the provider rejects high there; off does not exist on gpt-oss, so those models offer no off.

How requests are spread

Every request takes a slot from a bucket keyed by (lane, model) and streams through it. pi-cadence does not intercept the stream: every event, including errors, is forwarded to Pi untouched.

A lane that has spent a slot cannot serve that model until the window resets, so the next request takes another lane. When every lane is full, the request waits for the nearest window reset (up to 65s) instead of failing. Retries are Pi's to make; each one simply takes the next slot, and the least-spent lanes come first.

The endpoint

pi-cadence talks to one fixed endpoint. Its id, base URL and rate limit live in src/endpoint.ts, the model catalog in src/models.ts; if the service changes, those are the only files to edit.

What this does not do

  • 22 rpm is 22 HTTP requests, not 22 chat turns. One agent turn with ten tool calls spends eleven of them.
  • Buckets are per model, so switching models starts a fresh 22 rpm but does not refund the previous model's usage.
  • Compaction and subagents draw from the same buckets.
  • Two Pi windows each count the same per-IP budget from zero; the 429s spend slots until the window resets.

Development

npm test          # unit tests, no network
npm run typecheck # tsc --noEmit
npm run lint      # biome lint
npm run format    # biome format

License

MIT. See LICENSE.