> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode 接入 PPIO LLM API

OpenCode 是一款 AI 编程工具，支持通过自定义提供商连接 OpenAI-compatible endpoint。您可以在 OpenCode 中配置 PPIO 派欧云的大语言模型 API，用于代码生成、调试、重构和项目问答。

## 前置准备

开始前，请先准备以下信息：

* **API Key**：前往 [API 密钥管理](https://ppio.com/settings/key-management) 创建或复制 API Key。
* **Base URL**：`https://api.ppio.com/openai/v1`
* **Model ID**：前往模型广场或模型详情页，复制需要使用的模型 ID，例如 `deepseek/deepseek-v3.1`。

## 安装 OpenCode

OpenCode 提供命令行与桌面端。您可以选择其中一种方式安装。

### Linux / macOS / WSL2

任选一种安装方式：

```bash theme={null}
curl -fsSL https://opencode.ai/install | bash
```

```bash theme={null}
brew install anomalyco/tap/opencode
```

```bash theme={null}
npm i -g opencode-ai
```

### Desktop

您也可以访问 OpenCode 下载页面安装桌面端：

```text theme={null}
https://opencode.ai/download
```

## 配置自定义提供商

打开 OpenCode 设置页，找到提供商配置入口。不同版本入口名称可能略有差异，通常位于 **Settings** → **Providers** → **Custom Provider**。

填写以下信息：

| 配置项          | 值                                |
| :----------- | :------------------------------- |
| Display name | `PPIO`                           |
| Base URL     | `https://api.ppio.com/openai/v1` |
| API Key      | 您的 PPIO API Key                  |
| Model ID     | 例如 `deepseek/deepseek-v3.1`      |

<Tip>
  请确保 Model ID 与 PPIO 模型详情页中的名称完全一致。不同模型的上下文长度、价格和能力以模型详情页为准。
</Tip>

## 验证模型

完成配置后，在 OpenCode 中选择刚添加的 PPIO 模型，并输入一条测试消息：

```text theme={null}
请用一句话介绍你可以帮助我完成哪些编程任务。
```

如果模型可以正常回复，说明配置已生效。若验证失败，请检查：

* API Key 是否正确且账户余额可用。
* Base URL 是否填写为 `https://api.ppio.com/openai/v1`。
* Model ID 是否正确。
* 当前网络是否可以访问 PPIO API endpoint。
