9
46
近 7 天 2
38.4
生态多维模型
3 天前
2026-10-02
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@pandada8/opencode-axonhub@0.3.0"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@pandada8/opencode-axonhub@0.3.0"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @pandada8/opencode-axonhubOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode v2 plugin that discovers AxonHub models from /v1/models and /v1/models?include=all, merges both responses, and exposes them as the axonhub provider through the catalog.
It targets the opencode v2 plugin format: the module default-exports a definition with an id and a setup(ctx) function (see @opencode/plugin). Models are cached at ~/.cache/opencode/axonhub-models.json for one day. If no base URL or API key is configured, no models are registered.
Usage
Add the plugin and an axonhub provider entry to opencode.jsonc. Provide the endpoint and API key as plugin options, provider options, or environment variables.
{
"plugin": [["@pandada8/opencode-axonhub", { "baseURL": "https://your-axonhub.example.com", "apiKey": "ah-..." }]],
"provider": {
"axonhub": {
"options": {
"baseURL": "https://your-axonhub.example.com"
},
"models": {}
}
}
}
Alternatively, set the key via environment so it never lands in config:
export AXONHUB_BASE_URL="https://your-axonhub.example.com"
export AXONHUB_API_KEY="ah-..."
Resolution order for the endpoint/key: plugin options (baseURL/apiKey) -> configured provider options (provider.axonhub.options.baseURL / apiKey) -> environment (AXONHUB_BASE_URL, AXONHUB_API_KEY). If neither is found, the plugin registers nothing.
Routing
Each model is routed to the vendor protocol AxonHub expects through its per-model SDK package and endpoint:
- OpenAI models ->
@ai-sdk/openaiagainst/v1 - Gemini/Google ->
@ai-sdk/googleagainst/gemini/v1beta - everything else ->
@ai-sdk/anthropicagainst/anthropic/v1
Because opencode v2 stores the endpoint per model (there is no per-model api.url), the plugin sets each model's settings.baseURL accordingly, while exposing all of them under the single axonhub provider.
Notes
- Model enrichment from OpenCode's
~/.cache/opencode/models.jsonandexperimental.modes(*-fastvariants) are not yet ported to the v2 API. - Requires opencode v2 (tested against 2.0.18).
同类生态推荐
Elicify Vertex
@elicify-ai/elicify-vertex
OpenCode plugin that makes any coding model behave like a mythos-class engineer: a behavioural contract, live in-loop detection and correction, and an independent verifier that verifies the work against your repo. Self-validating, evidence-driven agent lo
Comment Judge
opencode-plugin-comment-judge
opencode plugin and Claude Code hook that has a model judge every comment an agent writes, and removes or rewrites the ones that do not earn their place
Plain English
opencode-plain-english
Plain-English communication mode plugin for opencode