fix(docs): locale translations

This commit is contained in:
Adam
2026-02-10 07:11:13 -06:00
parent 19ad7ad809
commit 4c4e30cd71
351 changed files with 3744 additions and 3765 deletions

View File

@@ -1,37 +1,36 @@
---
title: 供
description: 使用 opencode 中的任何 LLM 提供程式
title: 供商
description: opencode 中使用任意 LLM 提供
---
import config from "../../../../config.mjs"
export const console = config.console
opencode uses the [AI SDK](https://ai-sdk.dev/) and [Models.dev](https://models.dev) to support **75+ LLM providers** and it supports running local models.
opencode 使用 [AI SDK](https://ai-sdk.dev/) [Models.dev](https://models.dev),支持 **75+ LLM 提供商**,也支持运行本地模型。
新增提供商,需要:
添加提供商,需要:
1. 使用 `/connect` 命令新增提供 API 程序金钥匙
2. 在您的 opencode 配置中配置提供程式
1. 使用 `/connect` 命令添加提供商的 API 密钥
2. 在 opencode 配置中设置该提供商
---
### 證書
### 凭据
使用 `/connect` 命令再次成功的 API 时,它们会被存储
in `~/.local/share/opencode/auth.json`.
使用 `/connect` 命令添加提供商 API 后,凭据会存储
`~/.local/share/opencode/auth.json`
---
### 配置
可以用 opencode 中的 `provider` 部分自定义提供程序
配置。
可以使用 opencode 配置中的 `provider` 部分自定义提供商配置。
---
#### 基本網址
您可以通过设置 `baseURL` 选项来自定义任何提供程序的基本 URL。这在使用代理服务或自定义端点时非常有用。
您可以通过设置 `baseURL` 选项来自定义任何提供的基本 URL。这在使用代理服务或自定义端点时非常有用。
```json title="opencode.json" {6}
{
@@ -63,9 +62,9 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
/connect
```
2. 登入,新增您的账单详细信息,然后复制您的 API 金钥匙
2. 登录,添加您的账单详细信息,然后复制您的 API 密钥
3. 贴上您的 API 金钥匙
3. 贴上您的 API 密钥
```txt
┌ API key
@@ -74,7 +73,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
└ enter
```
4. 在 TUI 中执行 `/models` 以检视我们推荐的型列表。
4. 在 TUI 中执行 `/models` 以查看我们推荐的型列表。
```txt
/models
@@ -84,13 +83,13 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
---
## 目
## 目
讓我詳細瞭解一些提供商。如果您想提供商新增
讓我詳細瞭解一些提供商。如果您想提供商添加
列表请随时开启PR。
:::note
在这里没有看到成功?提交 PR。
没看到你要的提供商?欢迎提交 PR。
:::
---
@@ -105,7 +104,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
/connect
```
3. 输入您的 302.AI API 金钥匙
3. 输入您的 302.AI API 密钥
```txt
┌ API key
@@ -114,7 +113,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -127,15 +126,15 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
相当于 Amazon Bedrock 与 opencode 结合使用:
1. 前往 Amazon Bedrock 控制台中的 **模型目录** 并请求
訪問您想要的模型。
访问您想要的模型。
:::提示
您需要能够在 Amazon Bedrock 中访问所需的模型。
:::
2. **使用以下方法之一配置身份驗證**
2. **使用以下方法之一配置身份验证**
#### 環境變數(快速啟動
#### 环境变量(快速启动
执行 opencode 时设置以下环境变量之一:
@@ -157,7 +156,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
export AWS_REGION=us-east-1
```
#### 配置檔案(推薦)
#### 配置文件(推薦)
For project-specific or persistent configuration, use `opencode.json`:
@@ -181,7 +180,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
- `endpoint` - VPC 节点节点的自定义节点 URL通用 `baseURL` 选项的别名)
:::提示
配置檔案選項優先於環境變數
配置文件選項优先于环境变量
:::
#### 高阶VPC 端点
@@ -210,27 +209,27 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
#### 認證方式
- **`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY`**创建IAM用户并在AWS控制台中生成访问金币。
- **`AWS_PROFILE`**:使用 `~/.aws/credentials` 中的命名配置文件。首先配置 `aws configure --profile my-profile` 或 `aws sso login`
- **`AWS_BEARER_TOKEN_BEDROCK`**:从 Amazon Bedrock 控制台生成长期 API 金钥匙
- **`AWS_BEARER_TOKEN_BEDROCK`**:从 Amazon Bedrock 控制台生成长期 API 密钥
- **`AWS_WEB_IDENTITY_TOKEN_FILE` / `AWS_ROLE_ARN`**:适用于 EKS IRSA服务账户的 IAM 角色)或具有 OIDC 联合的其他 Kubernetes 环境。使用服务账户注释时,这些环境变量由 Kubernetes 自动注入。
#### 認證優先順
#### 認證优先顺
Amazon Bedrock 使用以下身份验证优先顺序:
1. **不记名令牌** - `AWS_BEARER_TOKEN_BEDROCK`环境变化数据或来自`/connect`令牌的令牌
2. **AWS 凭证链** - 配置档案、访问钥、共享凭证、IAM 角色、Web 身份令牌 (EKS IRSA)、实例项后设置资料
1. **不记名Tokens** - `AWS_BEARER_TOKEN_BEDROCK`环境变化数据或来自`/connect`Tokens的Tokens
2. **AWS 凭证链** - 配置档案、访问钥、共享凭证、IAM 角色、Web 身份Tokens (EKS IRSA)、实例项后设置资料
:::笔记
设置不记名令牌(使用 `/connect` 或 `AWS_BEARER_TOKEN_BEDROCK`)时,其优先于所有 AWS 凭证方法(包括配置的配置文件)。
设置不记名Tokens(使用 `/connect` 或 `AWS_BEARER_TOKEN_BEDROCK`)时,其优先于所有 AWS 凭证方法(包括配置的配置文件)。
:::
3. 执行`/models`命令选择所需的型
3. 执行`/models`命令选择所需的型。
```txt
/models
```
:::note
对于自定义推理配置文件,请在按键中使用模型并提供程序名称,并将 `id` 属性设置为 arn。这确保了正确的快取
对于自定义推理配置文件,请在按键中使用模型并提供名称,并将 `id` 属性设置为 arn。这确保了正确的缓存
```json title="opencode.json"
{
@@ -261,7 +260,7 @@ OpenCode Zen 是opencode团队提供的模型列表这些模型已被
```
2. 您可以在此处选择 **Claude Pro/Max** 选项,就会打开您的浏览器
要求您行身份驗證
要求您行身份验证
```txt
┌ Select auth method
@@ -284,9 +283,9 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
##### 使用 API 键
如果您没有 Pro/Max 订阅,您还可以选择 **建 API 重要**。它还会开启您的浏览器并要求您登 Anthropic 并为您提供一个可以粘贴到终端中的程序代码。
如果您没有 Pro/Max 订阅,您还可以选择 **建 API 密钥**。它还会开启您的浏览器并要求您登 Anthropic 并为您提供一个可以粘贴到终端中的代码。
或者,如果您已安装 API 金钥匙,则可以选择 **手动输入 API 金钥匙** 将其贴到终端中。
或者,如果您已安装 API 密钥,则可以选择 **手动输入 API 密钥** 将其贴到终端中。
---
@@ -298,12 +297,12 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
1. Head over to the [Azure portal](https://portal.azure.com/) and create an **Azure OpenAI** resource. You'll need:
- **资源名称**:这将成为您的 API 端点 (`https://RESOURCE_NAME.openai.azure.com/`) 的一部分
- **API 金钥匙**:来自您资源的 `KEY 1` 或 `KEY 2`
- **API 密钥**:来自您资源的 `KEY 1` 或 `KEY 2`
2. Go to [Azure AI Foundry](https://ai.azure.com/) and deploy a model.
:::笔记
部署名称必须与型名称匹配opencode才能正常工作。
部署名称必须与型名称匹配opencode才能正常工作。
:::
3. 执行 `/connect` 命令并搜索 **Azure**。
@@ -312,7 +311,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
/connect
```
4. 输入您的 API 金钥匙
4. 输入您的 API 密钥
```txt
┌ API key
@@ -321,13 +320,13 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
└ enter
```
5. 您的源名稱設定為環境變數
5. 您的源名称设置为环境变量
```bash
AZURE_RESOURCE_NAME=XXX opencode
```
或者将其新增内容添加到您的 bash 配置文件中:
或者将其添加内容添加到您的 bash 配置文件中:
```bash title="~/.bash_profile"
export AZURE_RESOURCE_NAME=XXX
@@ -345,12 +344,12 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
1. Head over to the [Azure portal](https://portal.azure.com/) and create an **Azure OpenAI** resource. You'll need:
- **资源名称**:这将成为您的 API 端点 (`https://AZURE_COGNITIVE_SERVICES_RESOURCE_NAME.cognitiveservices.azure.com/`) 的一部分
- **API 金钥匙**:来自您资源的 `KEY 1` 或 `KEY 2`
- **API 密钥**:来自您资源的 `KEY 1` 或 `KEY 2`
2. Go to [Azure AI Foundry](https://ai.azure.com/) and deploy a model.
:::笔记
部署名称必须与型名称匹配opencode才能正常工作。
部署名称必须与型名称匹配opencode才能正常工作。
:::
3. 执行 `/connect` 命令并搜索 **Azure 认知服务**。
@@ -359,7 +358,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
/connect
```
4. 输入您的 API 金钥匙
4. 输入您的 API 密钥
```txt
┌ API key
@@ -368,13 +367,13 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
└ enter
```
5. 您的源名稱設定為環境變數
5. 您的源名称设置为环境变量
```bash
AZURE_COGNITIVE_SERVICES_RESOURCE_NAME=XXX opencode
```
或者将其新增内容添加到您的 bash 配置文件中:
或者将其添加内容添加到您的 bash 配置文件中:
```bash title="~/.bash_profile"
export AZURE_COGNITIVE_SERVICES_RESOURCE_NAME=XXX
@@ -398,7 +397,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
/connect
```
3. 输入您的 Baseten API 金钥匙
3. 输入您的 Baseten API 密钥
```txt
┌ API key
@@ -407,7 +406,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -425,7 +424,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
/connect
```
3. 输入您的 Cerebras API 金钥匙
3. 输入您的 Cerebras API 密钥
```txt
┌ API key
@@ -434,7 +433,7 @@ Using your Claude Pro/Max subscription in opencode is not officially supported b
└ enter
```
4. 执行`/models`命令选择*Qwen 3 Coder 480B*等型
4. 执行`/models`命令选择*Qwen 3 Coder 480B*等型。
```txt
/models
@@ -461,7 +460,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
4. 输入您的 Cloudflare API 令牌
4. 输入您的 Cloudflare API Tokens
```txt
┌ API key
@@ -470,19 +469,19 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
└ enter
```
或者將其設定為環境變數
或者将其设置为环境变量
```bash title="~/.bash_profile"
export CLOUDFLARE_API_TOKEN=your-api-token
```
5. 执行`/models`命令选择型
5. 执行`/models`命令选择型。
```txt
/models
```
您还可以使用opencode配置新增模型。
您还可以使用opencode配置添加模型。
```json title="opencode.json"
{
@@ -510,7 +509,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
3. 输入您的 Cortecs API 金钥匙
3. 输入您的 Cortecs API 密钥
```txt
┌ API key
@@ -519,7 +518,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
└ enter
```
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型。
```txt
/models
@@ -527,7 +526,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
---
### 深度搜
### 深度搜
1. Head over to the [DeepSeek console](https://platform.deepseek.com/), create an account, and click **Create new API key**.
@@ -537,7 +536,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
3. 输入您的 DeepSeek API 钥。
3. 输入您的 DeepSeek API 钥。
```txt
┌ API key
@@ -564,7 +563,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
3. 输入您的深层基础设施 API 钥。
3. 输入您的深层基础设施 API 钥。
```txt
┌ API key
@@ -573,7 +572,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -591,7 +590,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
3. 输入您的韧体API金钥匙
3. 输入您的韧体API 密钥
```txt
┌ API key
@@ -600,7 +599,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -618,7 +617,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
/connect
```
3. 输入您的 Fireworks AI API 金钥匙
3. 输入您的 Fireworks AI API 密钥
```txt
┌ API key
@@ -627,7 +626,7 @@ Cloudflare AI Gateway lets you access models from OpenAI, Anthropic, Workers AI,
└ enter
```
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型。
```txt
/models
@@ -645,7 +644,7 @@ GitLab Duo 通过 GitLab 的人工代理提供具有本机工具呼叫功能的
/connect
```
2. 選擇您的身份驗證方法:
2. 选择您的身份验证方法:
```txt
┌ Select auth method
@@ -659,14 +658,14 @@ GitLab Duo 通过 GitLab 的人工代理提供具有本机工具呼叫功能的
选择**OAuth**,您的浏览器将开启并进行授权。
#### 使用個人訪問令牌
#### 使用个人访问Tokens
1. Go to [GitLab User Settings > Access Tokens](https://gitlab.com/-/user_settings/personal_access_tokens)
2. 單擊**新增新令牌**
2. 单击**添加新Tokens**
3. Name: `opencode`, Scopes: `api`
4. 复制令牌(以 `glpat-` 发起人)
5. 在端中輸入
4. 复制Tokens(以 `glpat-` 发起人)
5. 在端中輸入
3. 执行 `/models` 命令检视可用模型。
3. 执行 `/models` 命令查看可用模型。
```txt
/models
@@ -679,7 +678,7 @@ GitLab Duo 通过 GitLab 的人工代理提供具有本机工具呼叫功能的
:::note
如果您不愿意也可以指定“GITLAB_TOKEN”环境变量
令牌存储在opencode身份验证存储中。
Tokens存储在opencode身份验证存储中。
:::
##### 自托管 GitLab
@@ -725,7 +724,7 @@ export GITLAB_TOKEN=glpat-...
您的 GitLab 管理员必须启用以下功能:
1. [Duo Agent Platform](https://docs.gitlab.com/user/gitlab_duo/turn_on_off/) for the user, group, or instance
2. 功能标志(过Rails控制台
2. 功能标志(过Rails控制台
- `agent_platform_claude_code`
- `third_party_agents_enabled`
:::
@@ -733,8 +732,8 @@ export GITLAB_TOKEN=glpat-...
##### 用于自托管项目的 OAuth
为了使 Oauth 适用于您的自托管项目,您需要建立
新的用程式(設定→應用程
URL `http://127.0.0.1:8080/callback` 和以下范围:
新的用程序(设置→应用程
URL `http://127.0.0.1:8080/callback` 和以下范围:
- api您代表访问API
- read_user读取您的个人信息
@@ -789,7 +788,7 @@ Customize through `opencode.json`:
相当于您的 GitHub Copilot 订阅与 opencode 一起使用:
:::note
某些型可能需要 [Pro+
某些型可能需要 [Pro+
订阅](https://github.com/features/copilot/plans)使用。
Some models need to be manually enabled in your [GitHub Copilot settings](https://docs.github.com/en/copilot/how-tos/use-ai-models/configure-access-to-ai-models#setup-for-individual-use).
@@ -813,7 +812,7 @@ Some models need to be manually enabled in your [GitHub Copilot settings](https:
└ Waiting for authorization...
```
3. 现在执行 `/models` 命令来选择您想要的型
3. 现在执行 `/models` 命令来选择您想要的型。
```txt
/models
@@ -826,16 +825,16 @@ Some models need to be manually enabled in your [GitHub Copilot settings](https:
Google Vertex AI 与 opencode 结合使用:
1. 前往 Google Cloud Console 中的 **模型花园** 并检查
您所在地提供的型
您所在地提供的型。
:::笔记
您需要有一个启用了 Vertex AI API 的 Google Cloud 专案。
:::
2. 設定所需的環境變數
2. 设置所需的环境变量
- `GOOGLE_CLOUD_PROJECT`您的Google云专案ID
- `VERTEX_LOCATION`可选Vertex AI的区域默认为`global`
- 身份驗證(選擇一項):
- 身份验证(选择一項):
- `GOOGLE_APPLICATION_CREDENTIALS`:服务帐户 JSON 密钥文件的路径
- 使用 gcloud CLI 进行身份验证:`gcloud auth application-default login`
@@ -857,7 +856,7 @@ Google Vertex AI 与 opencode 结合使用:
The `global` region improves availability and reduces errors at no extra cost. Use regional endpoints (e.g., `us-central1`) for data residency requirements. [Learn more](https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#regional_and_global_endpoints)
:::
3. 执行`/models`命令选择所需的型
3. 执行`/models`命令选择所需的型。
```txt
/models
@@ -875,7 +874,7 @@ The `global` region improves availability and reduces errors at no extra cost. U
/connect
```
3. 输入结构的API金钥匙
3. 输入结构的API 密钥
```txt
┌ API key
@@ -933,7 +932,7 @@ The `global` region improves availability and reduces errors at no extra cost. U
/connect
```
3. 输入您的 Helicone API 钥。
3. 输入您的 Helicone API 钥。
```txt
┌ API key
@@ -942,7 +941,7 @@ The `global` region improves availability and reduces errors at no extra cost. U
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -952,7 +951,7 @@ For more providers and advanced features like caching and rate limiting, check t
#### 可選配置
如果您发现Helicone的某些功能或型未通过opencode自动配置您始终可以自行配置。
如果您发现Helicone的某些功能或型未通过opencode自动配置您始终可以自行配置。
Here's [Helicone's Model Directory](https://helicone.ai/models), you'll need this to grab the IDs of the models you want to add.
@@ -1003,7 +1002,7 @@ Helicone 支持快速获取、用户跟踪和会话管理等功能的自定义
}
```
##### 會話跟蹤
##### 会话跟蹤
Helicone's [Sessions](https://docs.helicone.ai/features/sessions) feature lets you group related LLM requests together. Use the [opencode-helicone-session](https://github.com/H2Shami/opencode-helicone-session) plugin to automatically log each opencode conversation as a session in Helicone.
@@ -1011,7 +1010,7 @@ Helicone's [Sessions](https://docs.helicone.ai/features/sessions) feature lets y
npm install -g opencode-helicone-session
```
將其新增到您的配置中。
将其添加到您的配置中。
```json title="opencode.json"
{
@@ -1027,7 +1026,7 @@ npm install -g opencode-helicone-session
| -------------------------- | ----------------------------------------------------- |
| `Helicone-Cache-Enabled` | Enable response caching (`true`/`false`) |
| `Helicone-User-Id` | 点击用户跟踪指标 |
| `Helicone-Property-[Name]` | 新增自定义属性(例如`Helicone-Property-Environment` |
| `Helicone-Property-[Name]` | 添加自定义属性(例如`Helicone-Property-Environment` |
| `Helicone-Prompt-Id` | 将请求与提示版本相关联 |
See the [Helicone Header Directory](https://docs.helicone.ai/helicone-headers/header-directory) for all available headers.
@@ -1062,13 +1061,13 @@ You can configure opencode to use local models through [llama.cpp's](https://git
}
```
這個例子中:
这个例子中:
- `llama.cpp` 是自定义创建 ID。这可以是您想要的任何字串。
- `llama.cpp` 是自定义创建 ID。这可以是您想要的任何字串。
- `npm` specifies the package to use for this provider. Here, `@ai-sdk/openai-compatible` is used for any OpenAI-compatible API.
- `name` 是 UI 中提供程序的显示名称。
- `name` 是 UI 中提供的显示名称。
- `options.baseURL` 是本地服务器器的端点。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
---
@@ -1084,7 +1083,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
/connect
```
3. 输入您的 IO.NET API 金钥匙
3. 输入您的 IO.NET API 密钥
```txt
┌ API key
@@ -1093,7 +1092,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
@@ -1125,13 +1124,13 @@ IO.NET提供了17种针对各种例子进行优化的模型
}
```
這個例子中:
这个例子中:
- `lmstudio` 是自定义创建 ID。这可以是您想要的任何字串。
- `lmstudio` 是自定义创建 ID。这可以是您想要的任何字串。
- `npm` specifies the package to use for this provider. Here, `@ai-sdk/openai-compatible` is used for any OpenAI-compatible API.
- `name` 是 UI 中提供程序的显示名称。
- `name` 是 UI 中提供的显示名称。
- `options.baseURL` 是本地服务器器的端点。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
---
@@ -1147,7 +1146,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
/connect
```
3. 输入您的 Moonshot API 金钥匙
3. 输入您的 Moonshot API 密钥
```txt
┌ API key
@@ -1174,7 +1173,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
/connect
```
3. 输入您的 MiniMax API 金钥匙
3. 输入您的 MiniMax API 密钥
```txt
┌ API key
@@ -1183,7 +1182,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
└ enter
```
4. 执行`/models`命令选择*M2.1*等型
4. 执行`/models`命令选择*M2.1*等型。
```txt
/models
@@ -1195,13 +1194,13 @@ IO.NET提供了17种针对各种例子进行优化的模型
1. Head over to the [Nebius Token Factory console](https://tokenfactory.nebius.com/), create an account, and click **Add Key**.
2. 执行`/connect`命令并搜索**Nebius令牌工厂**。
2. 执行`/connect`命令并搜索**NebiusTokens工厂**。
```txt
/connect
```
3. 输入您的 Nebius 令牌工厂 API 钥。
3. 输入您的 Nebius Tokens工厂 API 钥。
```txt
┌ API key
@@ -1210,7 +1209,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
└ enter
```
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型。
```txt
/models
@@ -1218,7 +1217,7 @@ IO.NET提供了17种针对各种例子进行优化的模型
---
### 成
### 成
您可以使用 Ollama 配置 opencode 本地模型。
@@ -1246,13 +1245,13 @@ Ollama can automatically configure itself for opencode. See the [Ollama integrat
}
```
這個例子中:
这个例子中:
- `ollama` 是自定义创建 ID。这可以是您想要的任何字串。
- `ollama` 是自定义创建 ID。这可以是您想要的任何字串。
- `npm` specifies the package to use for this provider. Here, `@ai-sdk/openai-compatible` is used for any OpenAI-compatible API.
- `name` 是 UI 中提供程序的显示名称。
- `name` 是 UI 中提供的显示名称。
- `options.baseURL` 是本地服务器器的端点。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
- `models` 是型 ID 以及配置的对应映射。型名称将显示在型选择列表中。
:::tip
如果工具暂停,请尝试增加 Ollama 中的 `num_ctx`。从 16k - 32k 左右开始。
@@ -1264,11 +1263,11 @@ Ollama can automatically configure itself for opencode. See the [Ollama integrat
相当于 Ollama Cloud 与 opencode 一起使用:
1. 前往 [https://ollama.com/](https://ollama.com/) 并登或建立账户。
1. 前往 [https://ollama.com/](https://ollama.com/) 并登或建立账户。
2. 导航至**设置** > **金钥匙**,然后单击**添加API金钥匙**以生成新的API金钥匙
2. 导航至**设置** > **API 密钥**,然后单击**添加API 密钥**以生成新的API 密钥
3. 复制 API 钥以在 opencode 中使用。
3. 复制 API 钥以在 opencode 中使用。
4. 执行 `/connect` 命令并搜索 **Ollama Cloud**。
@@ -1276,7 +1275,7 @@ Ollama can automatically configure itself for opencode. See the [Ollama integrat
/connect
```
5. 输入您的 Ollama Cloud API 金钥匙
5. 输入您的 Ollama Cloud API 密钥
```txt
┌ API key
@@ -1310,7 +1309,7 @@ We recommend signing up for [ChatGPT Plus or Pro](https://chatgpt.com/pricing).
```
2. 您可以选择 **ChatGPT Plus 或 Pro** 选项,就会在这里开启您的浏览器
要求您行身份驗證
要求您行身份验证
```txt
┌ Select auth method
@@ -1328,7 +1327,7 @@ We recommend signing up for [ChatGPT Plus or Pro](https://chatgpt.com/pricing).
##### 使用 API 键
如果您已安装 API 金钥匙,则可以选择 **手动输入 API 金钥匙** 将其贴到终端中。
如果您已安装 API 密钥,则可以选择 **手动输入 API 密钥** 将其贴到终端中。
---
@@ -1336,7 +1335,7 @@ We recommend signing up for [ChatGPT Plus or Pro](https://chatgpt.com/pricing).
OpenCode Zen 是 opencode 团队提供的经过测试和验证的模型列表。 [了解更多](/docs/zen)。
1. 登 **<a href={console}>OpenCode Zen</a>** 並單擊 **建 API 金鑰**。
1. 登 **<a href={console}>OpenCode Zen</a>** 并单击 **建 API 密钥**。
2. 执行 `/connect` 命令并搜索 **OpenCode Zen**。
@@ -1344,7 +1343,7 @@ OpenCode Zen 是 opencode 团队提供的经过测试和验证的模型列表。
/connect
```
3. 输入您的 opencode API 金钥匙
3. 输入您的 opencode API 密钥
```txt
┌ API key
@@ -1353,7 +1352,7 @@ OpenCode Zen 是 opencode 团队提供的经过测试和验证的模型列表。
└ enter
```
4. 执行`/models`命令选择*Qwen 3 Coder 480B*等型
4. 执行`/models`命令选择*Qwen 3 Coder 480B*等型。
```txt
/models
@@ -1371,7 +1370,7 @@ OpenCode Zen 是 opencode 团队提供的经过测试和验证的模型列表。
/connect
```
3. 输入结构的API金钥匙
3. 输入结构的API 密钥
```txt
┌ API key
@@ -1456,7 +1455,7 @@ SAP AI Core跨统一平台提供对OpenAI、Anthropic、Google、Amazon、Meta
AICORE_SERVICE_KEY='{"clientid":"...","clientsecret":"...","url":"...","serviceurls":{"AI_API_URL":"..."}}' opencode
```
或者将其新增内容添加到您的 bash 配置文件中:
或者将其添加内容添加到您的 bash 配置文件中:
```bash title="~/.bash_profile"
export AICORE_SERVICE_KEY='{"clientid":"...","clientsecret":"...","url":"...","serviceurls":{"AI_API_URL":"..."}}'
@@ -1472,7 +1471,7 @@ SAP AI Core跨统一平台提供对OpenAI、Anthropic、Google、Amazon、Meta
这些设置是可选的,应根据 SAP AI Core 设置进行配置。
:::
5. 执行 `/models` 命令从 40 个多个可用型中进行选择。
5. 执行 `/models` 命令从 40 个多个可用型中进行选择。
```txt
/models
@@ -1490,7 +1489,7 @@ SAP AI Core跨统一平台提供对OpenAI、Anthropic、Google、Amazon、Meta
/connect
```
3. 输入您的 OVHcloud AI 端点 API 金钥匙
3. 输入您的 OVHcloud AI 端点 API 密钥
```txt
┌ API key
@@ -1499,7 +1498,7 @@ SAP AI Core跨统一平台提供对OpenAI、Anthropic、Google、Amazon、Meta
└ enter
```
4. 执行`/models`命令选择*gpt-oss-120b*等型
4. 执行`/models`命令选择*gpt-oss-120b*等型。
```txt
/models
@@ -1519,7 +1518,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
/connect
```
3. 输入您的Scaleway API 金钥匙
3. 输入您的Scaleway API 密钥
```txt
┌ API key
@@ -1546,7 +1545,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
/connect
```
3. 输入您的Together AI API金钥匙
3. 输入您的Together AI API 密钥
```txt
┌ API key
@@ -1555,7 +1554,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
└ enter
```
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型
4. 执行 `/models` 命令以选择类似 _Kimi K2 Instruct_ 的型。
```txt
/models
@@ -1573,7 +1572,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
/connect
```
3. 输入您的威尼斯 AI API 金钥匙
3. 输入您的威尼斯 AI API 密钥
```txt
┌ API key
@@ -1582,7 +1581,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
└ enter
```
4. 执行`/models`命令选择*Llama 3.3 70B*等型
4. 执行`/models`命令选择*Llama 3.3 70B*等型。
```txt
/models
@@ -1592,7 +1591,7 @@ To use [Scaleway Generative APIs](https://www.scaleway.com/en/docs/generative-ap
### Vercel人工智慧闸道器
Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、Google、xAI 等的模型。型按标价提供,不加价。
Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、Google、xAI 等的模型。型按标价提供,不加价。
1. Head over to the [Vercel dashboard](https://vercel.com/), navigate to the **AI Gateway** tab, and click **API keys** to create a new API key.
@@ -1602,7 +1601,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
/connect
```
3. 输入您的 Vercel AI 网关 API 金钥匙
3. 输入您的 Vercel AI 网关 API 密钥
```txt
┌ API key
@@ -1611,13 +1610,13 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
└ enter
```
4. 执行`/models`命令选择型
4. 执行`/models`命令选择型。
```txt
/models
```
您还可以穿透 opencode 配置自定义模型。以下是指定提供路由顺序的示例。
您还可以穿透 opencode 配置自定义模型。以下是指定提供路由顺序的示例。
```json title="opencode.json"
{
@@ -1640,7 +1639,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
| 選項 | 描述 |
| ------------------- | ---------------------- |
| `order` | 提供尝试顺序 |
| `order` | 提供尝试顺序 |
| `only` | 限制特定提供商 |
| `zeroDataRetention` | 仅使用零资料保留的政策 |
@@ -1656,7 +1655,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
/connect
```
3. 输入您的 xAI API 金钥匙
3. 输入您的 xAI API 密钥
```txt
┌ API key
@@ -1685,7 +1684,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
如果您订阅了**GLM编码计划**,请选择**Z.AI编码计划**。
3. 输入您的 Z.AI API 钥。
3. 输入您的 Z.AI API 钥。
```txt
┌ API key
@@ -1712,7 +1711,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
/connect
```
3. 输入结构的API金钥匙
3. 输入结构的API 密钥
```txt
┌ API key
@@ -1746,10 +1745,10 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
## 定製提供商
新增 `/connect` 命令中未列出的任何 **OpenAI 容**提供程式
添加 `/connect` 命令中未列出的任何 **OpenAI 容**提供
:::tip
您可以将任何 OpenAI 容的提供方案与 opencode 一起使用。大多数人工现代智慧工厂都提供 OpenAI 容 API。
您可以将任何 OpenAI 容的提供与 opencode 一起使用。大多数 AI 提供商都提供 OpenAI 容 API。
:::
1. 执行`/connect`命令并逐步升级到**其他**。
@@ -1781,7 +1780,7 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
选择一个容易记住的 ID您将在配置文件中使用它。
:::
3. 输入您的事业的 API 钥。
3. 输入您的事业的 API 钥。
```bash
$ /connect
@@ -1818,14 +1817,14 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
```
以下是配置選項:
- **npm**要使用AI的SDK包`@ai-sdk/openai-compatible`用于OpenAI容的事业
- **npm**要使用AI的SDK包`@ai-sdk/openai-compatible`用于OpenAI容的事业
- **名称**UI中的显示名称。
- **型**:可用型
- **型**:可用型。
- **options.baseURL**API 端点 URL。
- **options.apiKey**如果不使用身份验证可以选择设置API金钥匙
- **options.apiKey**如果不使用身份验证可以选择设置API 密钥
- **options.headers**:可选择设置自定义标头。
有關高階選項的更多資訊,參見下面的示例。
有關高階選項的更多資訊,參見下面的示例。
5. 执行 `/models` 命令,您提供的自定义程序和模型将出现在选择列表中。
@@ -1863,27 +1862,27 @@ Vercel AI Gateway 可以让您跨统一端点访问来自 OpenAI、Anthropic、G
}
```
配置情:
配置情:
- **apiKey**:使用`env`变数语法[了解更多](/docs/config#env-vars)设置。
- ** headers **:随每个请求传送的自定义标头。
- **limit.context**:模型接受的最大输入标记。
- **limit.output**:模型可以生成的最大令牌
- **limit.output**:模型可以生成的最大Tokens
`limit` 栏位允许 opencode 了解您还剩下多少上下文。标准成功会自动从 models.dev 中提取这些内容。
`limit` 栏位允许 opencode 了解您还剩下多少上下文。标准提供商会自动从 models.dev 中提取这些内容。
---
## 故障排除
如果您在配置提供商時遇到問題,請檢查以下內容:
如果您在配置提供商時遇到問題,请检查以下內容:
1. **Check the auth setup**: Run `opencode auth list` to see if the credentials
提供商的配置已新增到您的配置中。
提供商的配置已添加到您的配置中。
这并不利于 Amazon Bedrock 等依赖环境变数进行身份验证的工作。
2. 对于自定义提供的程序,请检查 opencode 配置并:
- 确保 `/connect` 命令中使用的提供方案 ID 与 opencode 配置中的 ID 匹配。
- 正确的 npm 包用于提供程序。例如,对 Cerebras 使用 `@ai-sdk/cerebras`。对于所有其他 OpenAI 相内容的提供程序,请使用 `@ai-sdk/openai-compatible`。
- 确保 `/connect` 命令中使用的提供 ID 与 opencode 配置中的 ID 匹配。
- 正确的 npm 包用于提供。例如,对 Cerebras 使用 `@ai-sdk/cerebras`。对于所有其他 OpenAI 相内容的提供,请使用 `@ai-sdk/openai-compatible`。
- 检查 `options.baseURL` 栏位中使用的 API 端点是否正确。