EcoToken

Connect Claude Code

Use EcoToken models from Claude Code through the Anthropic Messages-compatible endpoint.

Base URLAuthenticationProtocol
https://ecotoken.ecophase-ai.comBearer API KeyAnthropic Messages

01 Prepare access details

Create an API key in the EcoToken console and confirm that its group can access the model you intend to use.

ParameterExample
API KeyYOUR_API_KEY
Model ID / namedeepseek-v4.1-flash
Do not store a real key in a repository. YOUR_API_KEY is a placeholder. Prefer environment variables and never paste a key into Git or a public channel.

02 Install Claude Code

Skip installation if Claude Code is already present. Version v2.1.234 or newer is recommended.

bash
npm install -g @anthropic-ai/claude-code

03 Option one: EcoToken configuration tool

ecotoken is a one-time local configuration tool, not a resident proxy. It preserves unrelated settings and updates ~/.claude/settings.json. An existing file is backed up as ~/.claude/settings.json.ecotoken.bak when a change is required.

bash
npm install -g @ecophase-ai/ecotoken
Shell history may retain the key. Use the interactive menu when key secrecy is more important.

Close Claude Code completely before restoring the neighboring .ecotoken.bak file. No backup exists when the target file did not exist before first setup.

04 Option two: manual configuration

Claude Code appends /v1/messages, so use the site root and do not append /v1 yourself.

bash
export ANTHROPIC_BASE_URL="https://ecotoken.ecophase-ai.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4.1-flash"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4.1-flash"

05 Launch and verify

bash
cd /path/to/your-project
claude

Send a short prompt. The integration is working when the Agent returns model output and the corresponding request appears under Usage & costs → Request records in the EcoToken console.

06 Common errors

  • 401: Check that the API key is complete and active, and that the variables are set in the same terminal session that launches Claude Code.
  • 403: Check the key group, model permission, account state, and gateway policy.
  • model not found: The model ID must exactly match the EcoToken console value.
  • Base URL: Claude Code uses https://ecotoken.ecophase-ai.com and appends /v1/messages itself; do not add /v1 again.
EcoPhase Docs - Connect Claude Code - EcoPhase.AI