PI配置

记录 Pi(终端里的 AI 编码助手)的安装、模型配置、常用命令与扩展玩法。 文中所有 API Key、自建代理地址均已脱敏,实际使用时替换成自己的。 一、安装使用 1. 安装 确保本地有 node 和 git。 使用 npm 安装: # 安装(走腾讯云 npm 镜像) npm install -g @earendil-works/pi-coding-agent --registry=https://mirrors.cloud.tencent.com/npm/ # 验证 pi --version 2. 使用(Windows) 配置文件路径: C:\Users\adminUser\.pi\agent\models.json OpenCode 的公共 API apiKey 就是字面量 public,不需要申请: { "providers": { "OpenCodeZen": { "baseUrl": "https://opencode.ai/zen/v1", "api": "openai-completions", "apiKey": "public", "compat": { "sendSessionAffinityHeaders": true }, "headers": { "user-agent": "opencode/1.18.16 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.14", "x-opencode-client": "cli" }, "models": [ {"id": "mimo-v2.5-free", "reasoning": true, "input": ["text", "image"], "contextWindow": 1000000, "maxTokens": 131072}, {"id": "nemotron-3-ultra-free", "reasoning": true, "input": ["text"], "contextWindow": 1000000, "maxTokens": 128000}, {"id": "laguna-s-2.1-free", "reasoning": true, "input": ["text", "image"], "contextWindow": 1000000, "maxTokens": 128000}, {"id": "hy3-free", "reasoning": true, "input": ["text"], "contextWindow": 262144, "maxTokens": 128000}, {"id": "nemotron-3.5-lightning-free", "reasoning": true, "input": ["text"], "contextWindow": 262144, "maxTokens": 128000}, {"id": "x-preview-f-free", "reasoning": true, "input": ["text", "image"], "contextWindow": 1000000, "maxTokens": 128000}, {"id": "muse-spark-1.2-contributor-free", "reasoning": true, "input": ["text"], "contextWindow": 1000000, "maxTokens": 128000} ] } } } CLIProxyAPI(自建代理) 地址与 Key 已脱敏: { "providers": { "CLIProxyAPI": { "baseUrl": "http://<你的服务器IP>:8317/v1", "api": "openai-completions", "apiKey": "sk-********", "compat": { "sendSessionAffinityHeaders": true }, "headers": { "user-agent": "opencode/1.18.16 ai-sdk/provider-utils/4.0.23 runtime/bun/1.3.14", "x-opencode-client": "cli" }, "models": [ {"id": "deepseek-v4-flash", "reasoning": true, "input": ["text"], "contextWindow":128000, "maxTokens": 8192}, {"id": "deepseek-v4-flash-vision-exp", "reasoning": true, "input": ["text", "image"],"contextWindow": 128000, "maxTokens": 8192}, {"id": "hy3", "reasoning": true, "input": ["text"], "contextWindow": 262144,"maxTokens": 128000}, {"id": "mimo-v2.5", "reasoning": true, "input": ["text", "image"], "contextWindow":262144, "maxTokens": 128000} ] } } } CloseAI(anthropic-messages 模式) 换成 anthropic-messages 协议的中转,顺带补上 cost 字段(免费模型全填 0): ...

2026-09-21 · 6 分钟 · 1209 字 · Javaow