pi
SHA-256pi 是一个开源的 AI agent 工具包,提供统一的 LLM API、自扩展的编码 agent CLI、终端 UI 库和 Slack 机器人。相比 Cursor 等工具,它支持多提供商切换且供应链更安全。
一个能切换多个大模型的编码助手工具包,开源且安全。
核心功能
- 统一多提供商LLM API(OpenAI、Anthropic、Google等),切换模型无需改代码
- 交互式编码 agent CLI,支持工具调用和状态管理,可自我扩展
- 终端UI(TUI)库,支持差异渲染,用于构建丰富的命令行界面
- 集成 Slack/聊天自动化(通过 pi-chat 项目)
- 严格的依赖安全策略:精确锁定版本、锁文件校验、发布冒烟测试
避坑指南
- •该项目默认自动关闭新贡献者的 Issue 和 PR,但维护者每天手动审查,如需贡献请先阅读 CONTRIBUTING.md
- •依赖管理极其严格:npm install 必须加 --ignore-scripts,否则构建脚本可能因为缺少锁文件修改权限而失败
- •如果遇到版本冲突,请确保设置 PI_ALLOW_LOCKFILE_CHANGE=1 来允许锁文件变更
- •仅支持 Node.js 环境,不适用于 Python 或其它语言项目
适用场景
- 开发者在终端中使用编码 agent 辅助写代码、重构、调试
- 团队通过统一 LLM API 在不同大模型之间快速切换测试效果
- 在 Slack 中配置聊天机器人,自动化处理工作流
详细介绍
pi 是一个开源的 AI agent 工具包,包含可自扩展的编码 agent CLI、统一的多提供商 LLM API(支持 OpenAI、Anthropic、Google 等)、TUI/Web UI 库、Slack 机器人和 vLLM pods。它的核心优势在于:1)统一 API 让你无需修改代码即可切换不同的大模型后端;2)编码 agent CLI 具有工具调用和状态管理能力,且可以自我扩展。与 Cursor、Claude Code 等商业工具相比,pi 完全开源,并采用严格的供应链安全措施(精确锁定依赖版本、锁文件校验、发布冒烟测试),确保依赖可信。此外,项目鼓励分享真实的编码会话数据,以推动基于实际任务的 agent 改进。
标签
快速上手
安装软件
双击下载的安装程序,按提示完成安装
全局安装 pi 编码 agent:npm install -g @earendil-works/pi-coding-agent
在项目目录中运行 npx pi 启动交互式终端,首次会提示配置 LLM API Key
按照向导设置你的大模型(如 OpenAI、Anthropic),然后即可输入中文/英文指令让 agent 帮你编码
- 全局安装 pi 编码 agent:npm install -g @earendil-works/pi-coding-agent
- 在项目目录中运行 npx pi 启动交互式终端,首次会提示配置 LLM API Key
- 按照向导设置你的大模型(如 OpenAI、Anthropic),然后即可输入中文/英文指令让 agent 帮你编码
最新更新
### New Features
- **Cleaner read tool output** - Collapsed `read` tool cards now show only the read line by default, while `Ctrl+O` still expands the full file content.
- **Faster file tools on Windows** - Built-in file tools now use async filesystem operations during streaming, and image resizes run off the main TUI thread in a worker.
- **More reliable package updates** - `pi update` and git package installs now reconcile pinned git refs and keep package settings intact. See [Packages](docs/packages.md).
- **Custom Anthropic-compatible adaptive thinking** - Custom provider model configs can opt into adaptive-thinking Claude behavior with `compat.forceAdaptiveThinking`. See [Custom providers](docs/custom-provider.md) and [Models](docs/models.md).
### Added
- Added `compat.forceAdaptiveThinking` support to custom Anthropic-compatible model configuration docs and validation ([#4797](https://github.com/earendil-works/pi-mono/pull/4797) by [@mbazso](https://github.com/mbazso)).
- Added a standard unified patch to edit tool result details for SDK consumers ([#4821](https://github.com/earendil-works/pi/issues/4821)).
### Changed
- Changed collapsed read tool cards to show only the read line until expanded ([#4916](https://github.com/earendil-works/pi/issues/4916)).
- Replaced the inherited optional `koffi` dependency for Windows VT input with a tiny vendored native helper, reducing install size while preserving Shift+Tab handling ([#4480](https://github.com/earendil-works/pi/issues/4480)).
- Changed the root development install documentation to use `npm install --ignore-scripts` ([#4868](https://github.com/earendil-works/pi/issues/4868)).
### Fixed
- Fixed `pi update` to reconcile git-pinned packages to their configured ref ([#4869](https://github.com/earendil-works/pi/issues/4869)).
- Fixed package/resource path handling for Windows and glob/pattern resolution ([#4873](https://github.com/earendil-works/pi-mono/pull/4873) by [@mitsuhiko](https://github.com/mitsuhiko)).
- Fixed config pattern matching to resolve patterns from the correct base directory ([#4898](https://github.com/earendil-works/pi-mono/pull/4898) by [@haoqixu](https://github.com/haoqixu)).
- Fixed theme pickers to list themes by their content name instead of file stem ([#4830](https://github.com/earendil-works/pi-mono/pull/4830) by [@Perlence](https://github.com/Perlence)).
- Fixed OpenCode Zen/Go requests to send per-session OpenCode routing headers ([#4847](https://github.com/earendil-works/pi/issues/4847)).
- Fixed Amazon Bedrock provider loading under strict package managers by inheriting the declared `@smithy/node-http-handler` dependency from `@earendil-works/pi-ai` ([#4842](https://github.com/earendil-works/pi/issues/4842)).
- Fixed inherited Amazon Bedrock Claude requests to send the model output token cap by default, avoiding Bedrock's 4096-token default truncation ([#4848](https://github.com/earendil-works/pi/issues/4848)).
- Fixed exported session HTML to escape quote characters in attribute values ([#4832](https://github.com/earendil-works/pi/issues/4832)).
- Fixed GitHub Copilot device-code login to keep opening the verification URL in browser-capable environments while ignoring browser launch failures for headless use ([#4788](https://github.com/earendil-works/pi-mono/pull/4788) by [@vegarsti](https://github.com/vegarsti)).
- Fixed git package installs to reconcile existing checkouts to the requested ref and update package settings without losing filters ([#4870](https://github.com/earendil-works/pi/issues/4870)).
- Published a 0.74.2 rescue release that tells Node 20 users to upgrade Node before updating to newer Pi versions ([#4876](https://github.com/earendil-works/pi/issues/4876)).
- Fixed final bash tool cards to avoid rendering duplicate full-output truncation paths ([#4819](https://github.com/earendil-works/pi/issues/4819)).
- Fixed bash tool truncation line counts to ignore the trailing newline as an extra output line ([#4818](https://github.com/earendil-works/pi/issues/4818)).
- Fixed footer home-directory abbreviation to avoid shortening sibling paths that only share the same prefix ([#4878](https://github.com/earendil-works/pi/issues/4878)).
- Fixed macOS Bun release binaries to resolve the native clipboard sidecar so Ctrl+V image paste can load `@mariozechner/clipboard` ([#4307](https://github.com/earendil-works/pi/issues/4307)).
- Fixed coding-agent tools to avoid synchronous filesystem operations during streaming and moved image resizing off the main TUI thread ([#4756](https://github.com/earendil-works/pi-mono/pull/4756) by [@mitsuhiko](https://github.com/mitsuhiko)).
已提供 SHA-256 校验码,下载后可自行核对文件完整性
该校验码提取自 GitHub 官方 Release 页面
SHA256 校验码
775bec6cf05ed13cfb866cf13280c7878d018ccf9db11b44902c80589166cbb5该校验码提取自 GitHub Release 页面,下载后请自行核对文件完整性
本平台所有 SHA-256 校验码均提取自项目在 GitHub 官方 Release 页面发布的文件,未做任何修改。你可以通过 GitHub Releases 页面自行验证。
开源透明
查看 GitHub 源码卸载说明
卸载 pi:npm uninstall -g @earendil-works/pi-coding-agent,如果使用了 pi-chat 也需单独卸载。全局安装的包会一并删除。
无额外依赖
下载后即可直接使用,无需安装其他运行环境