跳到正文
Skillpedia
智能体48k · #5441

pi-custom-model

它能做什么

这个工具可以让 Pi 使用默认未包含的自定义语言模型。它能确保特殊的模型后缀(比如更快或更便宜的版本)正常工作。

适用场景

  • ✓当你使用特定模型的后缀时(例如用 ':nitro' 表示更快的版本)。
  • ✓当你平时常用的模型在 Pi 中突然无法使用时。
  • ✓当你希望 Pi 始终使用某个模型的精确版本时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pi-custom-model/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/pi-custom-model/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“把“openrouter/mistralai/mistral-7b-instruct:nitro”模型设为我的默认模型。”

每周 5 个新技能,1 分钟读完。

工作原理

你需要在 Pi 的配置文件中添加该自定义模型的确切名称。这样,当你调用它时,Pi 就知道如何找到并使用这个特定的模型。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Pi custom / variant model

When to Use

Pi's saved default only loads if the exact provider/id exists in its model registry. Pi ships a static bundled list per provider — so OpenRouter routing-shortcut variants (:nitro = sort by throughput, :floor = cheapest, :exacto = quality tool-use) and any brand-new slug are NOT in it. When the default doesn't resolve, Pi silently falls through to its built-in per-provider default (for openrouter that's moonshotai/kimi-k2.6) — looking like Pi "reset" your model. Fix = register the slug as a custom model so find(provider, id) matches.

Files (global)

  • ~/.pi/agent/settings.json — defaultProvider, defaultModel, defaultThinkingLevel
  • ~/.pi/agent/models.json — custom models, keyed by provider
  • ~/.pi/agent/auth.json — provider credentials (check the provider key exists)

Steps

  1. Confirm the slug is real before adding it (e.g. check the OpenRouter model/variant exists). A typo'd id also silently falls back.
  2. Confirm auth. The provider must have a key in auth.json (or an env var like OPENROUTER_API_KEY). No auth → the model is registered but unavailable → still falls back.
  3. Add the model to models.json under providers.<provider>.models. For a built-in provider (openrouter, anthropic, etc.) you only supply metadata — api, baseUrl, and auth are inherited from the bundled defaults. Example:
    {
      "providers": {
        "openrouter": {
          "models": [
            {
              "id": "z-ai/glm-5.2:nitro",
              "name": "Z.ai: GLM 5.2 (nitro)",
              "reasoning": true,
              "thinkingLevelMap": { "xhigh": "xhigh" },
              "input": ["text"],
              "cost": { "input": 0.95, "output": 3, "cacheRead": 0.18, "cacheWrite": 0 },
              "contextWindow": 1048576,
              "maxTokens": 32768,
              "compat": { "supportsDeveloperRole": false, "thinkingFormat": "openrouter" }
            }
          ]
        }
      }
    }
    
    Copy cost/contextWindow/compat from the base model (the variant shares them) — find the bundled entry in <pi-pkg>/node_modules/@earendil-works/pi-ai/dist/providers/<provider>.models.js. Don't hardcode generic 128k/16k if the real model is bigger.
  4. Set the default in settings.json: defaultProvider + defaultModel = the exact id. Leave defaultThinkingLevel as the user has it.
  5. Verify: pi --list-models | grep <id> shows it, and JSON parses. Optionally smoke-test: pi --provider <p> --model "<id>" "which model are you?".

Quirks

  • Exact match only. find() is exact provider+id — no fuzzy/colon-stripping for the saved default path. The slug in settings.json and models.json must be byte-identical.
  • Silent fallback. Pi prints no error when the default doesn't resolve; it just shows a different model in the footer. That's the tell.
  • Don't edit settings.json alone. Setting defaultModel to an unregistered slug does nothing — models.json is the actual fix.
  • enabledModels (optional) pins the model picker so Ctrl+P cycling can't drift back: "enabledModels": ["<provider>/<id>:<thinking>"].
  • Project override. A repo's .pi/settings.json overrides global. If a default reverts only inside one project, check that file first.
  • Restart Pi fully — the registry loads at startup.

Example

User request:

Register custom Pi Agent model slugs so saved OpenRouter variants resolve correctly.

Limitations

  • Adapted from davidondrej/skills; verify local paths, tools, credentials, and agent features before acting.
  • For commands, remote access, scheduling, browser automation, or file-changing workflows, get explicit user approval and confirm the target environment first.
常见问题

如果不使用这个工具会怎样?

Pi 可能会在你不知情的情况下,使用与你预期不同的模型,或者使用效率较低的默认模型。

像 ':nitro' 这样的“变体”是什么?

它们是主模型的特殊版本,针对某个方面做了优化,比如速度(nitro)、成本(floor)或质量(exact)。

我需要编辑电脑上的文件吗?

需要。这个工具要求你编辑电脑上特定的 Pi 配置文件,以注册这些模型。

详情

作者的原始描述

Register custom Pi Agent model slugs so saved OpenRouter variants resolve correctly.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5441
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能