Add an OpenAI-compatible EcoToken provider and select the model in the terminal or Web UI.
| Base URL | Authentication | Protocol |
|---|---|---|
https://ecotoken.ecophase-ai.com/v1 | Bearer API Key | OpenAI 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.
npm install -g opencode-ai03 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.
npm install -g @ecophase-ai/ecotoken04 Option two: manual configuration
Create opencode.json in the project root.
{
"$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"
}
}
}
}
}export ECOTOKEN_API_KEY="YOUR_API_KEY"
opencode05 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 thatECOTOKEN_API_KEYis 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.
