mit-parley-pi-extension
Pi custom provider extension for MIT Parley API
Package details
Install mit-parley-pi-extension from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:mit-parley-pi-extension- Package
mit-parley-pi-extension- Version
0.3.0- Published
- Sep 9, 2026
- Downloads
- 488/mo · 488/wk
- Author
- askprash
- License
- MIT
- Types
- extension
- Size
- 108.4 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./dist/index.js"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
MIT Parley Pi Extension
A provider extension for the Pi coding agent that talks to MIT Parley. Parley's own Pi instructions work with a hand-written models.json; this extension replaces that with one install command and adds what the generic OpenAI provider cannot do:
- Registers every chat model Parley serves (Claude, GPT-5 through GPT-6 Astra, Gemini, Llama) with current prices.
- Maps Pi thinking levels to the request shape each model family needs (token budgets for Claude and Gemini, adaptive thinking for Opus 4.7+,
reasoning_effortfor GPT-5). - Routes the models that need it through Parley's
/v1/responsesendpoint so reasoning and tools work together. - Shows a plain-language footer with model, thinking level, context, cache hits, and cost.
- Honors a
PARLEY_BASE_URLoverride (including plainhttp://127.0.0.1:...URLs), so it can be pointed at a local credential proxy.
Install
curl -fsSL https://pi.dev/install.sh | sh # if Pi is not installed (Windows: npm install -g @earendil-works/pi-coding-agent)
pi install npm:mit-parley-pi-extension
export PARLEY_API_KEY="sk-parley-v1-..." # MIT_PARLEY_API_KEY or MY_MIT_PARLEY_API_KEY also work
pi --model MIT-parley/bedrock/claude-sonnet-5
Use /model inside Pi to switch models and Shift+Tab to change the thinking level. Update later with pi update.
If you already have a Parley provider in ~/.pi/agent/models.json, keep it or remove it; the extension registers its own provider named MIT-parley.
Models and thinking
Model ids are Parley's, prefixed with MIT-parley/. Run pi --list-models | grep MIT-parley for the full list. Embedding and image models are not registered. Prices follow Parley's cost guidance as of 4 September 2026.
| Family | Pi thinking level becomes |
|---|---|
| Claude Haiku 4.5, Sonnet 4.6, Sonnet 5, Gemini | thinking: { type: "enabled", budget_tokens } with budgets 1024 / 2048 / 4096 / 8192 / 16384 for minimal / low / medium / high / xhigh |
| Claude Opus 4.7, 4.8, 5 | thinking: { type: "adaptive" } |
| GPT-5.1 to GPT-5.5 | reasoning_effort on Chat Completions |
| GPT-5, 5 Mini, 5 Nano, 5.3 Codex, GPT-5.6 family, GPT-6 Astra | reasoning.effort on the Responses endpoint (Parley's Chat Completions route cannot combine tools with reasoning for these). Astra also accepts xhigh and max. |
| Llama | no thinking |
max_completion_tokens is raised automatically when it would not exceed the Claude/Gemini thinking budget.
Footer
While an MIT-parley model is active the extension replaces Pi's terse footer with one that spells things out: model and thinking level, then context fill, tokens sent and received, the cache hit rate of the last turn, and the session cost so far. Values are colored as they approach limits. /parley-footer toggles it off and on; switching to another provider restores Pi's own footer.
Cost
Your key has a limited credit balance. Prompt caching works through Parley for Claude and for the GPT-5.6 and GPT-6 Responses models, so repeated context in a session is billed at the cache-read rate; the footer's cache figure shows how much of the last prompt was served from cache. GPT-5.6 Luna, GPT-5.4 Nano, and Gemini 3.5 Flash-Lite are good low-cost defaults; GPT-6 Astra and the Opus models are the most expensive. See Parley's cost guidance for rates.
Limitations
- Text and image inputs only; no PDF or audio attachments.
- Pi does not read Parley's model catalogue, so new Parley models appear here only after a package update.
Development
git clone <this repo> && cd mit-parley-pi-extension
npm install
npm run build # compiles src/ to dist/ (dist/ is committed)
npm run validate # type check plus structural checks in validate.js
pi install "$PWD" # load this checkout instead of the npm package
src/stream.ts must not statically import @earendil-works/pi-ai/api/*; Pi's extension loader only aliases the root, /compat, /oauth, and /providers/all entrypoints, and an npm-installed extension has no pi-ai copy of its own. The Responses helper is resolved at runtime with a Chat Completions fallback.
To release: bump version in package.json, npm run build && npm run validate, commit, then npm publish --access public.