EcoToken

Connect OpenCode

Add an OpenAI-compatible EcoToken provider and select the model in the terminal or Web UI.

Base URLAuthenticationProtocol
https://ecotoken.ecophase-ai.com/v1Bearer API KeyOpenAI Chat Completions

01 Prepare access details

Create an API key that can access deepseek-v4.1-flash. Supply the key through an environment variable.

02 Install OpenCode

Version v1.18.18 or newer is recommended.

bash
npm install -g opencode-ai

03 Option one: EcoToken configuration tool

The tool updates ~/.config/opencode/opencode.json, or an existing opencode.jsonc, and appends .ecotoken.bak to the backup name.

bash
npm install -g @ecophase-ai/ecotoken

04 Option two: manual configuration

Create opencode.json in the project root.

json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "ecotoken/deepseek-v4.1-flash",
  "provider": {
    "ecotoken": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "EcoToken",
      "options": {
        "baseURL": "https://ecotoken.ecophase-ai.com/v1",
        "apiKey": "{env:ECOTOKEN_API_KEY}"
      },
      "models": {
        "deepseek-v4.1-flash": {
          "name": "deepseek-v4.1-flash"
        }
      }
    }
  }
}
bash
export ECOTOKEN_API_KEY="YOUR_API_KEY"
opencode

05 Launch and verify

Select ecotoken/deepseek-v4.1-flash and send a short prompt. A response and a matching entry under Usage & costs → Request records confirm the integration.

06 Common errors

  • 401: Confirm that ECOTOKEN_API_KEY is set in the same session that launches OpenCode.
  • 403: Check the key group, model permission, and account state.
  • model not found: The selected model, provider model key, and EcoToken model ID must match exactly.
EcoPhase Docs - Connect OpenCode - EcoPhase.AI