| name | models-config |
| description | Model configuration editor for ~/.pi/agent/models.json - 使用 Bun 脚本管理模型配置 |
Pi Models Manager
管理 ~/.pi/agent/models.json 配置文件的命令行工具。
快速开始
bun ~/.pi/agent/skills/models-config/models.ts list
bun ~/.pi/agent/skills/models-config/models.ts add provider myprovider https://api.example.com/v1 --api-key sk-your-api-key
bun ~/.pi/agent/skills/models-config/models.ts add model pox gpt-5.4 --reasoning --context-window 200000
bun ~/.pi/agent/skills/models-config/models.ts test pox gpt-5.4
bun ~/.pi/agent/skills/models-config/models.ts test pox gpt-5.4 --reasoning --thinking high
bun ~/.pi/agent/skills/models-config/models.ts test pox gpt-5.4 --stream
bun ~/.pi/agent/skills/models-config/models.ts batch pox
bun ~/.pi/agent/skills/models-config/models.ts update
bun ~/.pi/agent/skills/models-config/models.ts validate
命令详解
list - 列出模型
bun models.ts list
bun models.ts list --provider pox
bun models.ts list --json
add provider - 添加 Provider
bun models.ts add provider <name> <baseUrl> [options]
bun models.ts add provider myprovider https://api.example.com/v1 \
--api-key sk-your-api-key \
--api openai-responses \
--auth-header
add model - 添加模型
bun models.ts add model <provider> <modelId> [options]
bun models.ts add model pox gpt-5.4 \
--name "GPT-5.4" \
--reasoning \
--context-window 200000 \
--max-tokens 64000
test - 测试连接 ⭐
支持所有主流 API 类型和高级功能:
bun models.ts test <provider> [modelId] [options]
bun models.ts test pox gpt-5.4
bun models.ts test pox gpt-5.4 --message "What is 2+2?"
bun models.ts test pox gpt-5.4 --stream
bun models.ts test pox gpt-5.4 --reasoning --thinking high
支持的 API 类型:
| API 类型 | 说明 | 端点 |
|---|
openai-responses | OpenAI Responses API | /responses |
openai-completions | OpenAI Chat Completions | /chat/completions |
anthropic-messages | Anthropic Messages API | /v1/messages |
google-generative-ai | Google Gemini API | /v1beta/models/:generateContent |
mistral-conversations | Mistral API | /v1/chat/completions |
azure-openai-responses | Azure OpenAI | /openai/deployments/.../responses |
batch - 批量测试
bun models.ts batch pox
bun models.ts batch pox --reasoning
bun models.ts batch pox --stream
rm - 删除
bun models.ts rm pox
bun models.ts rm pox gpt-5.4
update - 更新价格
从 models.dev 获取最新价格数据:
bun models.ts update
bun models.ts update --provider pox
template - 配置模板
bun models.ts template openai-compatible
bun models.ts template anthropic-compatible
validate - 验证 JSON
bun models.ts validate
完整配置示例
{
"providers": {
"pox": {
"baseUrl": "https://api.example.com/v1",
"apiKey": "sk-your-api-key",
"api": "openai-responses",
"authHeader": true,
"models": [
{
"id": "gpt-5.4",
"name": "GPT-5.4",
"reasoning": true,
"input": ["text", "image"],
"output": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 200000,
"maxTokens": 64000
}
]
}
}
}
配置文件位置
~/.pi/agent/models.json