文档 · 指南

让 Avibe 用任意模型

Avibe(avibe-bot/avibe,MIT 协议,avibe-os 包和 vibe 命令)是一个本地的 Agent OS。它自己的 Agent Vibey,以及它运行的 Claude Code、Codex 和 OpenCode,都从它的 Model Hub 取模型;Model Hub 是 Avibe 自带的网关(CLIProxyAPI),后面接着你在 Models 页添加的模型来源。magpie 作为其中一个来源加进去,Avibe 里的所有 Agent 就能用 DeepSeek、GLM、Kimi、Qwen、Claude 或 ChatGPT 订阅等 magpie 里的任意模型。

接入 Avibe

  1. 在 magpie 里添加供应商在 供应商 页添加 API Key,或登录一个订阅。
  2. 启动 AvibeAvibe 只在运行时添加和移除模型来源,所以先用 vibe start 启动它。
  3. 在 Agent 页给 Avibe 选 magpiemagpie 作为一个模型来源出现在 Avibe 的 Models 页,Vibey 和它运行的 Agent 都能用。
终端
vibe start
magpie avibe magpie

magpie 这个模型来源

Avibe 的家目录是 $AVIBE_HOME,没有设置时是 ~/.avibe(3.0 之前是 ~/.vibe_remote),模型来源在那里的 config/config.json 的 model_hub.sources 中。来源不能手写进 config.json:每个来源都要整体校验,Key 存在 Model Hub 自己的存储里,添加时 Avibe 还会把它加进各个 Agent 的路由链。所以 magpie 和 Avibe 的 Models 页一样,通过 Avibe 的内部 API 添加和移除:macOS 和 Linux 上走家目录里的 state/dispatch.sock,Windows 上走 runtime/control-ipc/endpoint.json 给出的本机端口和 bearer token。magpie 发出的请求:

终端
POST /internal/model-hub
{
  "operation": "create_source",
  "payload": {
    "source": {
      "kind": "api_key",
      "vendor": "custom",
      "display_name": "magpie",
      "base_url": "http://127.0.0.1:3425/v1",
      "key": "",
      "protocol": "openai_chat",
      "supply_channel": "hub",
      "billing": "metered",
      "save_unverified": true
    }
  }
}

magpie 记下这个来源的 id,所以你在 Avibe 里改了它的名字,它仍然是 magpie 的。你在 Models 页手动添加的、指向网关的 custom 来源,magpie 也认作自己的。网关换了端口时,同步会删掉旧来源再按新地址重新添加,因为 Key 和地址是一起封存的;指向另一台机器、本机代理路径或 WSL 访问 Windows 方式的地址不会被改。

为什么用 chat completions

来源的协议是 openai_chat,不是 Responses。对 Responses 来源,Model Hub 会走 Codex 的执行器,它自称 codex-tui,会被网关当成 Codex 本身;用 chat 时,Model Hub 原样传递各个后端自己的请求头。一个 Hub 来源服务所有后端,Model Hub 负责转换 Claude 和 Codex 的请求。保存时跳过 Avibe 的协议探测,因为网关所有协议都支持,探测分辨不出来。

模型列表

Avibe 自己从网关的 /v1/models 列出模型,所以 Avibe 里能选的就是你在 magpie 的 Agent 页给 Avibe 选的那些。Avibe 自己只在列表超过半小时才重新读取,所以 magpie 在你增减模型时会让 Avibe 立刻刷新这个来源。

移除

切回时,magpie 通过同一个内部 API 删掉这个来源,并忘掉记下的 id。如果删除会让某些路由失去这一跳或中断正在进行的工作,Avibe 会要求确认,和它的 Models 页一样;这是你在 magpie 里要求的,所以 magpie 带上 Avibe 列出的内容再确认一次。

终端
magpie avibe default

常见问题

Avibe 里的 Claude Code 和 Codex 也能用 magpie 的模型吗?

能。magpie 是 Model Hub 的一个来源,Hub 来源服务 Vibey 和 Avibe 运行的所有后端,包括 Claude Code、Codex 和 OpenCode。

为什么提示要先启动 Avibe?

Avibe 只在运行时通过内部 API 添加和移除模型来源,magpie 不能直接改 config.json。先运行 vibe start 再试。

Avibe 里能选哪些模型?

你在 magpie 的 Agent 页给 Avibe 选的那些。Avibe 从网关的 /v1/models 读取,magpie 在列表变化时让它刷新。

怎么移除 magpie?

在 magpie 里把 Avibe 切回默认,或运行 magpie avibe default。magpie 会删掉它添加的来源。

更多 Agent 用同样的模型:让 MothX 用任意模型、让 PenguinHarness 用任意模型、让 Paimon 用任意模型、让 StepCode 用任意模型。遇到报错?见 常见错误排查,或到 Discord 提问。