Register an EcoToken model with config.toml and models.json, using the OpenAI Responses API.
| Base URL | Authentication | Protocol |
|---|---|---|
https://ecotoken.ecophase-ai.com/v1 | Bearer API Key | OpenAI 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.
npm install -g @openai/codex03 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.
npm install -g @ecophase-ai/ecotokenTo 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.
Set-Location "$env:USERPROFILE\.codex"
notepad config.toml
notepad models.jsonmodel = "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_tokenstores the key in localconfig.toml. Restrict the file to the current user and never commit it.
Restart every Codex client after editing the files.
05 Launch and verify
cd /path/to/your-project
codexThe 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: Checkexperimental_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 bothmodels.jsonand the EcoToken console.
