-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path3.html
More file actions
276 lines (276 loc) · 19 KB
/
Copy path3.html
File metadata and controls
276 lines (276 loc) · 19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="CodeClub - OpenCode 配置" />
<meta name="author" content="Jackson" />
<title>OpenCode 配置 - CodeClub</title>
<link rel="icon" type="image/x-icon" href="../../img/logo.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<link rel="stylesheet" href="../../css/main.css" />
<link rel="stylesheet" href="../../css/dark-mode.css" />
<link rel="stylesheet" href="../../css/mobile-optimizations.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.0/marked.min.js"></script>
<style>
.tutorial-page {
max-width: 1200px;
margin: 70px auto 40px;
padding: 0 20px;
display: flex;
gap: 20px;
}
.tutorial-sidebar {
width: 240px;
flex-shrink: 0;
position: sticky;
top: 70px;
max-height: calc(100vh - 90px);
overflow-y: auto;
background: var(--bg-secondary, #fff);
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.tutorial-sidebar h3 {
font-size: 15px;
margin: 0 0 12px;
color: var(--text-primary, #1a1a2e);
padding-bottom: 8px;
border-bottom: 2px solid var(--primary, #3b82f6);
}
.tutorial-sidebar a {
display: block;
padding: 5px 8px;
color: var(--text-secondary, #666);
text-decoration: none;
font-size: 13px;
border-radius: 4px;
line-height: 1.4;
}
.tutorial-sidebar a:hover {
background: var(--primary, #3b82f6);
color: #fff;
}
.tutorial-sidebar a.active {
background: var(--primary, #3b82f6);
color: #fff;
font-weight: 600;
}
.tutorial-main {
flex: 1;
min-width: 0;
}
.tutorial-article {
background: var(--bg-secondary, #fff);
border-radius: 8px;
padding: 32px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.tutorial-article h1 {
font-size: 26px;
margin-bottom: 16px;
color: var(--text-primary, #1a1a2e);
border-bottom: 2px solid var(--primary, #3b82f6);
padding-bottom: 12px;
}
.markdown-body {
font-size: 15px;
line-height: 1.8;
color: var(--text-secondary, #333);
}
.markdown-body h1 {
font-size: 24px;
border-bottom: 1px solid var(--border, #e5e7eb);
padding-bottom: 8px;
}
.markdown-body h2 {
font-size: 20px;
border-bottom: 1px solid var(--border, #e5e7eb);
padding-bottom: 6px;
}
.markdown-body h3 {
font-size: 17px;
}
.markdown-body pre {
background: #1e1e2e;
color: #cdd6f4;
padding: 16px;
border-radius: 8px;
overflow-x: auto;
}
.markdown-body code {
font-family: 'Fira Code', 'Cascadia Code', monospace;
font-size: 14px;
}
.markdown-body p code {
background: #f1f5f9;
padding: 2px 6px;
border-radius: 4px;
color: #e83e8c;
}
.markdown-body blockquote {
border-left: 4px solid var(--primary, #3b82f6);
padding: 12px 20px;
margin: 16px 0;
background: #f8fafc;
border-radius: 0 8px 8px 0;
}
.markdown-body img {
max-width: 100%;
border-radius: 8px;
}
.markdown-body table {
border-collapse: collapse;
width: 100%;
margin: 16px 0;
}
.markdown-body table th,
.markdown-body table td {
border: 1px solid var(--border, #e5e7eb);
padding: 8px 12px;
text-align: left;
}
.markdown-body table th {
background: var(--bg-primary, #f8fafc);
font-weight: 600;
}
.markdown-body table tr:nth-child(2n) {
background: var(--bg-primary, #f8fafc);
}
.markdown-body ul,
.markdown-body ol {
padding-left: 24px;
margin: 12px 0;
}
.markdown-body li {
margin: 4px 0;
}
.markdown-body hr {
border: none;
border-top: 1px solid var(--border, #e5e7eb);
margin: 24px 0;
}
.markdown-body a {
color: var(--primary, #3b82f6);
text-decoration: none;
}
.markdown-body a:hover {
text-decoration: underline;
}
.page-navigation {
display: flex;
justify-content: space-between;
margin-top: 24px;
padding-top: 16px;
border-top: 1px solid var(--border, #e5e7eb);
}
.page-nav-link {
color: var(--primary, #3b82f6);
text-decoration: none;
font-weight: 500;
font-size: 14px;
}
.page-nav-link:hover {
text-decoration: underline;
}
.source-link {
margin-top: 16px;
font-size: 13px;
color: var(--text-secondary, #999);
}
.source-link a {
color: var(--primary, #3b82f6);
}
@media (max-width: 768px) {
.tutorial-page {
flex-direction: column;
}
.tutorial-sidebar {
width: 100%;
position: static;
max-height: 200px;
}
}
</style>
</head>
<body>
<nav class="navbar">
<div class="navbar-container">
<a class="navbar-brand" href="../../index.html">
<img src="../../img/logo.png" alt="CodeClub" width="32" height="32" />
<span>CodeClub</span>
</a>
<button class="mobile-menu-toggle" aria-label="切换导航菜单"><span></span><span></span><span></span></button>
<ul class="navbar-nav">
<li><a class="nav-link" href="../../index.html">首页</a></li>
<li><a class="nav-link" href="../../nav.html">网址导航</a></li>
<li><a class="nav-link" href="../../blog/">博客</a></li>
<li><a class="nav-link" href="../../wiki/index.html" target="_blank">WiKi</a></li>
<li><a class="nav-link active" href="../index.html">教程</a></li>
<li><a class="nav-link" href="../../book.html">图书</a></li>
<li><a class="nav-link" href="../../contact.html">联系我</a></li>
<li><a class="nav-link" href="../../about.html">关于我</a></li>
</ul>
</div>
</nav>
<div class="tutorial-page">
<div class="tutorial-sidebar">
<h3>📖 OpenCode</h3>
<a href="0.html">OpenCode 教程</a>
<a href="1.html">OpenCode 简介</a>
<a href="2.html">OpenCode 安装</a>
<a href="3.html" class="active">OpenCode 配置</a>
<a href="4.html">OpenCode 第一次使用</a>
<a href="5.html">OpenCode VSCode</a>
<a href="6.html">OpenCode 终端界面</a>
<a href="7.html">OpenCode CLI 使用</a>
<a href="8.html">OpenCode Web 使用</a>
<a href="9.html">OpenCode GitHub</a>
<a href="10.html">OpenCode GitLab</a>
<a href="11.html">OpenCode 工具</a>
<a href="12.html">OpenCode 规则</a>
<a href="13.html">OpenCode 代理</a>
<a href="14.html">OpenCode 主题</a>
<a href="15.html">OpenCode 快捷键</a>
<a href="16.html">OpenCode 自定义命令</a>
<a href="17.html">OpenCode 格式化工具</a>
<a href="18.html">OpenCode 权限配置</a>
<a href="19.html">OpenCode LSP 服务器配置</a>
<a href="20.html">OpenCode MCP 服务器配置</a>
<a href="21.html">OpenCode Skills</a>
<a href="22.html">OpenCode 自定义工具</a>
</div>
<div class="tutorial-main">
<div class="tutorial-article">
<div class="markdown-body" id="md-content"></div>
<div class="page-navigation">
<a href="2.html" class="page-nav-link">← OpenCode 安装</a>
<a href="4.html" class="page-nav-link">OpenCode 第一次使用 →</a>
</div>
<div class="source-link">原文来源:<a href="https://www.runoob.com" target="_blank">菜鸟教程</a></div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer-content"><p>© 2024 CodeClub. All rights reserved.</p></div>
</footer>
<script src="../../js/dark-mode.js"></script>
<script src="../../js/mobile-menu.js"></script>
<script>
const md = `# OpenCode 配置\n\n\n\n\n通过 OpenCode,你可以接入任意 LLM(大语言模型)提供商,例如 OpenAI、Claude、DeepSeek、阿里百炼等,从而获得更强的 AI 编程能力。\n\n\n\n\n如果你是第一次使用,建议优先选择 **OpenCode Zen**,它是 OpenCode 官方精选的一组模型,已经过测试和优化,开箱即用,适合新手。\n\n\n**OpenCode Zen** 里面也包含了大量的免费大模型,所以基本上可以直接用,不用充钱。\n\n\n\n---\n\n\n\n### 步骤 1:启动配置\n\n直接运行:\n\n\n\n\`\`\`\nopencode\n\`\`\`\n\n如果出现 **EACCES: permission denied, open \'\'** 是权限问题,请使用管理员权限执行,比如:\n\n\n\n\`\`\`\nsudo opencode\n\`\`\`\n\n你会看到终端界面(TUI):\n\n\n\n\n\n在 OpenCode 终端界面中输入:\n\n\n\n\n\`\`\`\n/connect\n\`\`\`\n\n\n\n\n然后选择:**opencode**\n\n\n\n\n\n\n如果有其他的大模型 Key,你也可以通过这个列表选择配置。\n\n\n\n\n### 步骤 2:获取 API Key\n\n\n打开以下页面并登录: [https://opencode.ai/auth](https://opencode.ai/auth)\n\n\n\n\n\n\n\n- 登录账号\n\n- 添加账单信息\n\n- 创建 API Key\n\n\n\n\n### 步骤 3:粘贴 API Key\n\n\n回到终端,将获取到的 API Key 粘贴进去:\n\n\n\n\n\n\n\n完成后,即可开始使用 OpenCode。\n\n\n\n我们可以按下 Ecs 退出配置 LLM 提供商,然后在对话窗口输入 /model 命令来查看支持的模型:\n\n\n\n\n\n\n看到有 Free 字样的就是免费的模型:\n\n\n\n\n\n选择完成后按下 Ecs 退出配置,就可以看到当前用的大模型:\n\n\n\n\n\n\n\n---\n\n\n## 接入阿里百炼\n\nOpenCode 是开源的 AI 编程工具,可配合阿里云百炼提供的模型推理服务实现高效代码开发。\n\n\n\n我们可以先使用阿里云主账号访问百炼模型服务平台 [https://bailian.console.aliyun.com/](https://bailian.console.aliyun.com/cn-beijing/?userCode=i5mn5r7m&tab=globalset#/efm/api_key),然后点击右上角登录,登录成功后点击右上角的齿轮⚙️图标,选择 API key,然后复制 API key,如果没有也可以创建 API key:\n\n\n\n\n\n\n\n\n\n\n\n\n\n可以直接购买资源包,这样用起来更划算:[https://cn.aliyun.com/benefit?from_alibabacloud=&userCode=i5mn5r7m](https://cn.aliyun.com/benefit?from_alibabacloud=&userCode=i5mn5r7m)\n\n\n\n\n\n### 在 OpenCode 中设置\n\n在输入框输入 /connect 并单击 Enter。\n\n\n\n在 **Connect a Provider **列表的搜索框中输入 **alibaba** 进行搜索,选中 Alibaba (China) 并单击 Enter。\n\n\n\n\n\n\n\n输入我们申请的 API Key 后按 Enter:\n\n\n\n\n\n\n然后我们可以输入 /model 查看阿里支持的模型,并选择需要的:\n\n\n\n\n\n\n本文档仅适用于按量付费模式,Coding Plan 用户请使用专属 Base URL 和 API Key 接入,详情请参考 [OpenCode Coding Plan](https://www.runoob.com/ai-agent/opencode-coding-plan.html) 说明文档进行配置。\n\n\n\n\n\n\n---\n\n## 国内 API 配置\n\n国内厂商 API 申请地址:\n\n\n\n \n \n 厂商/品牌\n 简介\n API 申请入口(点击即达)\n \n \n \n \n DeepSeek(国产高性价比)\n 官方模型:deepseek-chat / deepseek-reasoner\n [https://platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys)\n \n \n 阿里百炼(通义千问)\n 阿里云大模型统一入口,支持千问、GLM、Kimi 、MiniMax 等最新版本模型\n [https://bailian.console.aliyun.com](https://bailian.console.aliyun.com?userCode=i5mn5r7m)\n \n \n GLM(智谱清言)\n 清华系 ChatGLM 系列,支持 GLM-4、GLM-3-Turbo 等\n [https://open.bigmodel.cn](https://www.bigmodel.cn/glm-coding?ic=EMWK7IPUCE)\n \n \n MiniMax\n 国产多模态,支持文本、语音、图像混合调用\n [https://platform.minimaxi.com](https://platform.minimaxi.com)\n \n \n\n\n进入对应控制台后,注册/登录 → 完成实名认证 → 创建 API Key 即可开始调用。\n\n\n\n\n### API 管理工具\n\n平台一多,配置起来就麻烦,我们可以使用第三方工具 CC Switch 可以帮我们轻松管理这几个热门工具的 API 配置:[https://github.com/farion1231/cc-switch/](https://github.com/farion1231/cc-switch/),Windows / macOS / Linux 全支持。\n\n\nCC Switch 是一个 Claude Code / Codex / Gemini CLI 的全方位辅助工具。\n\n\nCC Switch 可以帮我们轻松管理这几个热门工具的 API 配置,就好比给你的开发工具箱来了个智能整理助手,所有工具的配置都能在它这有序管理。\n\n\n\n\n\n各平台安装包下载地址:[https://github.com/farion1231/cc-switch/releases](https://github.com/farion1231/cc-switch/releases)。\n\n\n\n\n\n\n具体的操作设置参考文章:[https://www.runoob.com/ai-agent/cc-switch.html](https://www.runoob.com/ai-agent/cc-switch.html)\n\n\n\n如果你不闲麻烦,可以参照下文,自行配置。\n\n\n \n \n \n \n \n\n \n \n [ OpenCode 第一次使用](http://www.runoob.com/opencode/opencode-first-usage.html)\n \n\n \n \n \n \n \n\n\n\n\n \n \n \n### 点我分享笔记\n\n \n \n \n \n \n \n [取消](https://www.runoob.comjavascript:;)\n\n\n \n \n \n \n \n \n\n\n 分享笔记\n \n \n \n \n \n \n\n 昵称昵称 (必填)\n 邮箱邮箱 (必填)\n 引用地址引用地址\n \n\n \n \n \n \n\n \n \n\n\n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n\n \n \n \n \n \n \n\n\n \n \n \n \n \n \n \n \n \n\n\n\n\n\n 在线实例\n\n\n ·[HTML 实例](https://www.runoob.com/html/html-examples.html)\n\n\n ·[CSS 实例](https://www.runoob.com/css/css-examples.html)\n\n\n ·[JavaScript 实例](https://www.runoob.com/js/js-examples.html)\n\n\n ·[Ajax 实例](https://www.runoob.com/ajx/ajax-examples.html)\n\n\n ·[jQuery 实例](https://www.runoob.com/jquery/jquery-examples.html)\n\n\n ·[XML 实例](https://www.runoob.com/xml/xml-examples.html)\n\n\n ·[Java 实例](https://www.runoob.com/java/java-examples.html)\n\n\n\n\n\n 字符集&工具\n\n\n · [HTML 字符集设置](https://www.runoob.com/charsets/html-charsets.html)\n\n\n · [HTML ASCII 字符集](https://www.runoob.com/tags/html-ascii.html)\n\n\n · [JS 混淆/加密](https://www.jyshare.com/front-end/6939/)\n\n\n · [PNG/JPEG 图片压缩](https://www.jyshare.com/front-end/6232/)\n\n\n · [HTML 拾色器](https://www.runoob.com/tags/html-colorpicker.html)\n\n\n · [JSON 格式化工具](https://www.jyshare.com/front-end/53)\n\n\n · [随机数生成器](https://www.jyshare.com/front-end/6680/)\n\n\n\n\n 最新更新\n\n\n ·\n [\n OpenCode 自定义... ](http://www.runoob.com/opencode/opencode-custom-tools.html)\n\n\n ·\n [\n OpenCode Skills ](http://www.runoob.com/opencode/opencode-skills.html)\n\n\n ·\n [\n OpenCode MCP 服... ](http://www.runoob.com/opencode/opencode-mcp.html)\n\n\n ·\n [\n OpenCode LSP 服... ](http://www.runoob.com/opencode/opencode-lsp.html)\n\n\n ·\n [\n OpenCode 权限配置 ](http://www.runoob.com/opencode/opencode-permissions.html)\n\n\n ·\n [\n OpenCode 格式化... ](http://www.runoob.com/opencode/opencode-formatter.html)\n\n\n ·\n [\n OpenCode 自定义... ](http://www.runoob.com/opencode/opencode-commands.html)\n\n\n\n\n 站点信息\n\n\n ·\n [意见反馈](https://www.runoob.commailto:admin@runoob.com)\n\n\n ·\n [免责声明](https://www.runoob.com/disclaimer)\n\n\n ·\n [关于我们](https://www.runoob.com/aboutus)\n\n\n ·\n [文章归档](https://www.runoob.com/archives)\n\n\n\n\n\n\n\n **关注微信**\n\n\n\n \n\n\n\n\n\n\n Copyright © 2013-2026 **[菜鸟教程](https://www.runoob.com//www.runoob.com/)** \n **[runoob.com](https://www.runoob.com//www.runoob.com/)** All Rights Reserved. 备案号:[闽ICP备15012807号-1](https://beian.miit.gov.cn/)\n\n\n\n [ ](https://www.runoob.comjavascript:void(0))\n [](https://www.runoob.comjavascript:void(0))\n [](https://www.runoob.comjavascript:void(0))\n\n\n\n#### 微信关注\n\n `;
document.getElementById('md-content').innerHTML = marked.parse(md);
</script>
</body>
</html>