EcoToken

Connect Codex CLI

Register an EcoToken model with config.toml and models.json, using the OpenAI Responses API.

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

01 Prepare access details

Create an API key that can access deepseek-v4.1-flash. Keep the real key only in local configuration.

02 Install Codex CLI

Version v0.147.0 or newer is recommended.

bash
npm install -g @openai/codex

03 Option one: EcoToken configuration tool

The tool updates ~/.codex/config.toml and ~/.codex/models.json. It creates a matching <original-filename>.ecotoken.bak in the same directory only when the target already contains non-empty content and this configuration will change that content. If a file is missing or empty, the tool writes the target file directly without creating a backup. For example, if models.json does not exist, the tool creates models.json, not models.json.ecotoken.bak. Running the configuration again may overwrite an existing backup with the same name. It respects CODEX_HOME and reports the paths it changes and backs up.

bash
npm install -g @ecophase-ai/ecotoken

To restore the previous configuration, copy each .ecotoken.bak file created by EcoToken back to its corresponding original filename. If a file did not exist before the first configuration, delete the file created by the tool to return fully to the original state.

04 Option two: manual configuration

Codex CLI, the ChatGPT desktop app, and the VS Code Codex extension share ~/.codex/config.toml and ~/.codex/models.json. Launch Codex once, exit, then open both files.

powershell
Set-Location "$env:USERPROFILE\.codex"
notepad config.toml
notepad models.json
toml
model = "deepseek-v4.1-flash"
model_provider = "ecotoken"
preferred_auth_method = "apikey"
forced_login_method = "api"
model_reasoning_effort = "high"
model_catalog_json = "~/.codex/models.json"

[model_providers.ecotoken]
name = "ecotoken"
base_url = "https://ecotoken.ecophase-ai.com/v1"
wire_api = "responses"
experimental_bearer_token = "YOUR_API_KEY"

Download the complete models.json used by the previous EcoToken Portal. It contains the model metadata Codex needs to recognize context and reasoning capabilities.

experimental_bearer_token stores the key in local config.toml. Restrict the file to the current user and never commit it.

Restart every Codex client after editing the files.

05 Launch and verify

bash
cd /path/to/your-project
codex

The integration is active when startup shows deepseek-v4.1-flash or a custom model, requests succeed, and Usage & costs → Request records contains the call.

06 Common errors

  • 401: Check experimental_bearer_token, the key state, and fully restart Codex.
  • 403: Check the key group, model permission, account state, and gateway policy.
  • model not found: The model name must match both models.json and the EcoToken console.
EcoPhase Docs - Connect Codex CLI - EcoPhase.AI