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

# OpenCode CLI 設定指南

> AceDataCloud Coding Plan 整合指南 - Ace Data Cloud

## 1. 取得 API Key

開啟 [Ace Data Cloud 應用程式列表](https://platform.acedata.cloud/console/applications)，進入可用的應用程式並複製 API Key。

![取得 Ace Data Cloud API Key](https://cdn.acedata.cloud/dvc3cg.jpg)

## 2. 安裝 OpenCode

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

也可以使用 npm：

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

## 3. 設定 API Key

```bash theme={null}
export ACEDATACLOUD_API_KEY="你的 API Key"
```

如需長期生效，把這一行加入 `~/.zshrc` 或 `~/.bashrc` 後重新開啟終端機。

## 4. 設定 Provider

編輯 `~/.config/opencode/opencode.json`：

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "acedatacloud": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ace Data Cloud",
      "options": {
        "baseURL": "https://api.acedata.cloud/v1",
        "apiKey": "{env:ACEDATACLOUD_API_KEY}"
      },
      "models": {
        "MODEL_ID": { "name": "MODEL_ID" }
      }
    }
  }
}
```

前往 [模型目錄](https://platform.acedata.cloud/models) 查看模型名稱（例如 `claude-opus-5`、`gpt-6-sol`），並將所有 `MODEL_ID` 替換為同一個名稱；精確驗證時，以 `/v1/models` 回應中的 `id` 值為準。該值就是 API `model` 參數使用的模型名稱，不是服務或 API 的 UUID。Ace Data Cloud 這裡使用 Chat Completions，所以 adapter 是 `@ai-sdk/openai-compatible`。

## 5. 驗證並啟動

```bash theme={null}
opencode auth list
opencode models acedatacloud
opencode run --model acedatacloud/MODEL_ID "Reply only OK"
```

然後在專案目錄執行 `opencode`。如果模型未出現，檢查設定檔路徑、JSON 語法和環境變數；401 表示 Key 無效或未匯出。

IDE 擴充功能重複使用同一份 OpenCode runtime 設定，請參見 [OpenCode IDE Extension](https://platform.acedata.cloud/documents/opencode-ide-integration)。

## 官方參考

* [OpenCode Providers](https://opencode.ai/docs/providers/)
* [OpenCode 設定](https://opencode.ai/docs/config/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.