File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # opencode 配置第三方模型
2+
3+ ## 安装部署
4+
5+ ### 安装
6+ - Node.js
7+ ``` bash
8+ npm isntall -g opencode-ai # npm
9+ bun install -g opencode-ai # bun
10+ pnpm install -g opencode-ai # pnpm
11+ ```
12+ - Macos & Linux
13+ ``` bash
14+ brew install anomalyco/tap/opencode
15+ ```
16+ - Windows
17+ ``` bash
18+ choco install opencode # choco
19+ scoop install opencode # scoop
20+ ```
21+
22+ ### 配置文件
23+ - 配置第三方模型的ID, 执行` opencode auth login `
24+ - 选择other,然后输入provider id, 输入模型的key
25+ - 然后在` ~/.config/opencode/ ` ,创建一个opencode.json文件,输入以下内容
26+ ``` json
27+ {
28+ "$schema" : " https://opencode.ai/config.json" ,
29+ "provider" : {
30+ "local" : {
31+ "npm" : " @ai-sdk/openai-compatible" ,
32+ "name" : " local" ,
33+ "options" : {
34+ "baseURL" : " https://api.scnet.cn/api/llm/v1" ,
35+ },
36+ "models" : {
37+ "DeepSeek-V3.2" : { "name" : " DeepSeek-V3.2" },
38+ "MiniMax-M2.5" : { "name" : " MiniMax-M2.5" },
39+ "Qwen3-30B-A3B-Instruct-2507" :{"name" :" Qwen3-30B-A3B-Instruct-2507" },
40+ "Qwen3-235B-A22B-Thinking-2507" :{"name" :" Qwen3-235B-A22B-Thinking-2507" }
41+ }
42+ }
43+ }
44+ }
45+ ```
46+ - 然后重新打开模型,检查是否可以使用
47+
48+ - 注意事项:在第一步填写的provider id,在配置文件中对应的provider的key不要填错!
49+
50+
51+ ### 基础命令
52+ - 模型切换 switch model ` ct + x m `
53+ - 切换绘画 switch session ` ct + x l `
54+ - tab 切换模型
55+ - 常用命令 ` ct + p `
You can’t perform that action at this time.
0 commit comments