1.1 什么是 Agent Plan
Agent Plan 是火山方舟推出的智能体套餐,面向通用 Agent 场景,提供多模型聚合调用能力。一个 API Key 即可调用豆包、DeepSeek、Kimi、智谱、MiniMax 等多家主流模型。
接口地址(OpenAI 兼容 v3):
bash
https://ark.cn-beijing.volces.com/api/plan/v3
1.2 准备工作
- 已注册火山方舟账号并开通 Agent Plan
- 已获取 Agent Plan API Key(格式:
ark-xxxxxxxx) - 已安装 OpenCode
1.3 找到配置文件
OpenCode 全局配置文件位置:
| 系统 | 路径 |
|---|---|
| Windows | %USERPROFILE%\.config\opencode\opencode.json |
| macOS / Linux | ~/.config/opencode/opencode.json |
如果文件不存在,可手动创建。
1.4 编辑配置文件
在 provider 节点下添加 volcengine-agent-plan 配置项,完整结构如下:
json
{
"model": "volcengine-agent-plan/doubao-seed-2.1-turbo",
"provider": {
"volcengine-agent-plan": {
"name": "Volcano Engine (Agent Plan)",
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "你的AgentPlan-APIKey",
"baseURL": "https://ark.cn-beijing.volces.com/api/plan/v3"
},
"models": {
"doubao-seed-2.1-turbo": {
"name": "doubao-seed-2-1-turbo-260628",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"doubao-seed-2.0-pro": {
"name": "doubao-seed-2.0-pro",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"doubao-seed-2.0-lite": {
"name": "doubao-seed-2.0-lite",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"doubao-seed-2.0-code": {
"name": "doubao-seed-2.0-code",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"doubao-seed-code": {
"name": "doubao-seed-code",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"ark-code-latest": {
"name": "ark-code-latest",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"deepseek-v3.2": {
"name": "deepseek-v3.2",
"limit": {
"context": 128000,
"output": 4096
},
"modalities": {
"input": ["text"],
"output": ["text"]
}
},
"kimi-k2.5": {
"name": "kimi-k2.5",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"kimi-k2.6": {
"name": "kimi-k2.6",
"limit": {
"context": 256000,
"output": 4096
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
}
},
"glm-4.7": {
"name": "glm-4.7",
"limit": {
"context": 200000,
"output": 4096
},
"modalities": {
"input": ["text"],
"output": ["text"]
}
},
"glm-5.1": {
"name": "glm-5.1",
"limit": {
"context": 200000,
"output": 4096
},
"modalities": {
"input": ["text"],
"output": ["text"]
}
},
"minimax-m2.7": {
"name": "minimax-m2.7",
"limit": {
"context": 200000,
"output": 4096
},
"modalities": {
"input": ["text"],
"output": ["text"]
}
}
}
}
}
}
关键参数说明:
| 参数 | 说明 |
|---|---|
name |
Provider 显示名称 |
npm |
SDK 包名,OpenAI 兼容协议统一用 @ai-sdk/openai-compatible |
options.apiKey |
你的 Agent Plan API Key |
options.baseURL |
Agent Plan 接口地址 |
models |
可用模型列表,每个模型需指定名称、上下文限制、模态能力 |
1.5 验证配置
保存配置后,打开终端执行:
bash
opencode models volcengine-agent-plan
如果能看到刚才配置的模型列表,说明配置成功。
1.6 切换模型
方式一:修改默认模型(永久)
编辑 opencode.json,修改顶层 model 字段:
json
"model": "volcengine-agent-plan/doubao-seed-2.1-turbo"
方式二:启动时临时指定(单次生效)
bash
opencode -m volcengine-agent-plan/doubao-seed-2.0-pro
1.7 常用命令速查
| 命令 | 说明 |
|---|---|
opencode models |
列出所有可用模型 |
opencode models volcengine-agent-plan |
列出 Agent Plan 的模型 |
opencode -m volcengine-agent-plan/doubao-seed-2.1-turbo |
临时指定模型启动 |
opencode |
使用默认模型启动 |
提示 :模型列表可能随官方更新而变化,如果
opencode models命令显示的模型比配置文件中多,说明 OpenCode 会自动探测远端模型,无需手动全部配置。但手动配置可以指定上下文窗口大小和模态能力,使用体验更稳定。