文档 · 指南

让 OpenPencil 用任意模型

OpenPencil(ZSeven-W/openpencil,openpencil-desktop)是一个设计画布,它的对话通过你自己配置的「内置 Agent」调用模型:一个 Anthropic 或 OpenAI 兼容的地址、一把 Key 和一组模型,都出现在对话的模型选择器里。magpie 在里面加一个名为 magpie 的条目,OpenPencil 就能用 DeepSeek、GLM、Kimi、Qwen、Claude 或 ChatGPT 订阅等 magpie 里的任意模型。

接入 OpenPencil

  1. 在 magpie 里添加供应商在 供应商 页添加 API Key,或登录一个订阅。
  2. 退出 OpenPencil原因见下文。
  3. 在 Agent 页给 OpenPencil 选 magpie再勾选要出现在 OpenPencil 里的模型。
  4. 打开 OpenPencil,在对话的模型选择器里选一个 magpie 模型模型在 OpenPencil 里选,不写在文件里。
终端
magpie openpencil magpie

settings.json 里的条目

OpenPencil 把设置放在一个 settings.json 里:

终端
macOS    ~/Library/Application Support/openpencil/settings.json
Linux    ~/.config/openpencil/settings.json   ($XDG_CONFIG_HOME)
Windows  %APPDATA%\openpencil\settings.json

magpie 在 builtin_agents 里写一个 id 为 magpie 的条目,类型 openai-compat,请求发到网关 /v1 下的 /chat/completions。OpenPencil 的 User-Agent 不固定,所以网关靠 Key magpie-openpencil 认出它的请求:

终端
{"version": 1,
 "builtin_agents": [{"id": "magpie", "preset": "custom", "display_name": "magpie",
   "kind": "openai-compat", "api_key": "magpie-openpencil",
   "model": "", "models": ["", …],
   "base_url": "http://127.0.0.1:3425/v1", "enabled": true}]}

你的其他条目和设置都不动;你在 OpenPencil 里给 magpie 条目改的名字和开关也保留。version 必须是 1:没有它 OpenPencil 会把文件当作损坏挪开,之后再也存不了设置。所以 magpie 新建文件时写 version 1,遇到不认识的 version 就不碰这个文件。

先退出 OpenPencil

OpenPencil 只在启动时读一次 settings.json,改设置和退出时把它内存里的整份设置写回去。它运行时 magpie 写的内容,会在它退出时被覆盖。所以 OpenPencil 运行时 magpie 不改它的设置,会提示:先退出 OpenPencil 再试。Windows 上 magpie 看不出它在不在运行,就在页面上提醒你先退出。

模型列表

条目里的模型就是你在 magpie 的 Agent 页为 OpenPencil 勾选的模型,每个只列一次,最多 64 个(OpenPencil 保存时会丢掉多出来的)。两个以上才写 models 列表,第一个同时写进 model;v0.8.4 只认 model,所以那个版本只显示第一个模型。magpie 里的模型有变化时会同步过去。

切回

切回时 magpie 把自己的条目从 builtin_agents 里删掉;如果文件里只剩 magpie 当初写的 version 和空列表,就把文件也删掉。同样要先退出 OpenPencil。

终端
magpie openpencil default

同名的另一个应用 open-pencil/open-pencil 把供应商存在网页的 localStorage 里,magpie 写不了。它可以通过 magpie 接好的 Agent(如 Pi 或 ACP Agent)用上 magpie,或者手动填 magpie 的地址。

常见问题

OpenPencil 能用 DeepSeek、GLM 或 ChatGPT 订阅吗?

能。退出 OpenPencil,在 magpie 的 Agent 页给它选 magpie,再打开 OpenPencil,在对话的模型选择器里选一个 magpie 模型。

为什么要先退出 OpenPencil?

OpenPencil 退出时会把整份设置写回 settings.json,覆盖 magpie 在它运行时写的内容。

为什么 OpenPencil 里只看到一个 magpie 模型?

OpenPencil v0.8.4 只认 model 字段,只显示第一个模型;更新版本会读 models 列表,最多 64 个。

切回后我的其他内置 Agent 还在吗?

在。magpie 只删除 id 为 magpie 的条目,其他条目和设置都不动。

更多桌面应用用同样的模型:让 Alma 用任意模型、让 Kun 用任意模型、让 Pi 用任意模型。遇到报错?见 常见错误排查,或到 Discord 提问。