OpenCode CLI Configuration Guide

1. Obtain an API Key

Open the Ace Data Cloud application list, enter an available application, and copy the API Key.

Obtain Ace Data Cloud API Key

2. Install OpenCode

curl -fsSL https://opencode.ai/install | bash

You can also use npm:

npm install -g opencode-ai

3. Set the API Key

export ACEDATACLOUD_API_KEY="your API Key"

To make it effective long-term, add this line to ~/.zshrc or ~/.bashrc and reopen the terminal.

4. Configure the Provider

Edit ~/.config/opencode/opencode.json:

{
  "$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" }
      }
    }
  }
}

Go to the model catalog to view model names (for example, claude-opus-5, gpt-6-sol), and replace all MODEL_ID values with the same name; for precise verification, use the id value in the /v1/models response. This value is the model name used by the API model parameter, not the UUID of the service or API. Ace Data Cloud uses Chat Completions here, so the adapter is @ai-sdk/openai-compatible.

5. Verify and Start

opencode auth list
opencode models acedatacloud
opencode run --model acedatacloud/MODEL_ID "Reply only OK"

Then run opencode in the project directory. If the model does not appear, check the configuration file path, JSON syntax, and environment variables; 401 indicates that the Key is invalid or has not been exported.

The IDE extension reuses the same OpenCode runtime configuration; see OpenCode IDE Extension.

Official References