Skip to content

OpenCode 接入

1. 前提条件

  • 已注册并获取本平台 API Key
  • 已安装 Node.js 环境。

2. 安装与配置

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

3. 修改配置

bash
# 打开文件 ~/.config/opencode/opencode.json
# 在对应字段增加以下配置
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "aiwith.chat": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "aiwith.chat",
      "options": {
        "baseURL": "https://aiwith.chat/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "claude-opus-4-6": {
          "name": "claude-opus-4-6"
        },
        "gpt-5.3-codex": {
          "name": "gpt-5.3-codex"
        }
      }
    }
  }
}

4. 启动

bash
opencode