Model guidesBeginnersUpdated

How to use Grok 4.7 with Claude Code

Configure Claude Code with your I Code Easy API key, root URL https://api.icodeeasy.cc, and model grok-4.7 to use Grok 4.7 through this service. Follow the macOS, Linux and Windows steps below.

Choose the Grok text model

Grok is the model; Claude Code is the coding client. This guide describes the Claude Code integration provided by I Code Easy and requires a service key. An xAI API key, Grok account or subscription does not replace it. Direct xAI API support does not define the interfaces available through this service.

grok-4.7 is a text model ID. Grok Imagine image and video models use separate interfaces. Do not put an Imagine model name into these variables; use the image or video guide instead.

Before you start

  1. Install the client using the Claude Code guide. These instructions apply to the terminal client; see that guide for Desktop’s separate gateway settings.
  2. Register and copy your service key from API Keys. Check current availability and selectable endpoints in the dashboard; the Claude Code display name is Grok-4.7.
  3. Check the pricing page for current prices and the model capability catalog for required features. Official subscription quotas and features do not describe this service.

Configuration reference

VariableValue
ANTHROPIC_AUTH_TOKENyour I Code Easy API key
ANTHROPIC_BASE_URLhttps://api.icodeeasy.cc — Root URL, without /v1 or /v1/messages
ANTHROPIC_MODELgrok-4.7
ANTHROPIC_DEFAULT_HAIKU_MODELgrok-4.7
ANTHROPIC_DEFAULT_SONNET_MODELgrok-4.7
ANTHROPIC_DEFAULT_OPUS_MODELgrok-4.7
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC1

The Haiku, Sonnet and Opus aliases also resolve to grok-4.7; this does not turn Grok into Claude. Existing settings or launch arguments may affect selection, so verify after switching.

macOS / Linux

Paste these values into the terminal where you will launch Claude Code. Replace the key placeholder without adding a Bearer prefix. The settings initially apply to this terminal:

export ANTHROPIC_AUTH_TOKEN="your I Code Easy API key"
export ANTHROPIC_BASE_URL="https://api.icodeeasy.cc"
export ANTHROPIC_MODEL="grok-4.7"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="grok-4.7"
export ANTHROPIC_DEFAULT_SONNET_MODEL="grok-4.7"
export ANTHROPIC_DEFAULT_OPUS_MODEL="grok-4.7"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"

For persistence, add the same export lines to your shell’s ~/.zshrc or ~/.bashrc, then open a new terminal. Keep files containing keys out of repositories. See environment setup for details.

Windows PowerShell

Run this in the same PowerShell window you will use to launch Claude Code:

$env:ANTHROPIC_AUTH_TOKEN = "your I Code Easy API key"
$env:ANTHROPIC_BASE_URL = "https://api.icodeeasy.cc"
$env:ANTHROPIC_MODEL = "grok-4.7"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "grok-4.7"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = "grok-4.7"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = "grok-4.7"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"

These settings apply only to this window and its child processes. To persist them at user level, follow the GLM Windows instructions to save the current values of these seven variables. Then reopen PowerShell; restart your IDE as well if using an integrated terminal.

Verify configuration and the first request

Check the client version and whether the key exists. These commands make no model request and do not print the key:

claude --version

macOS / Linux:

test -n "$ANTHROPIC_AUTH_TOKEN" && echo true || echo false

PowerShell:

[bool]$env:ANTHROPIC_AUTH_TOKEN

Run claude from this terminal and enter /status to inspect the model, URL and credential source. Then send “Reply only OK” yourself and check request logs for success, model and charges. Real requests are billed under current rules.

/status confirms local configuration, rather than successful inference. Claude, Haiku, Sonnet or Opus labels in the interface, and a model’s self-identification in a reply, do not replace the log check.

Troubleshooting

SymptomFirst checks
401Check the service key, whitespace, rotation status and URL. Do not share the full key.
403Check account status and current model access. Keep the error text and time.
404 / wrong URLUse only the root in ANTHROPIC_BASE_URL; remove duplicated /v1 or /messages paths.
429Read the full error, reduce concurrency and retry. A 429 does not always mean insufficient balance.
Wrong model / old settingsCheck the main model and all three defaults, exit the old process and relaunch from the configured terminal.
Timeout / connection failedCheck your proxy and network, then try the backup URLs and recovery guide below.

If the primary URL is slow, replace only ANTHROPIC_BASE_URL, keeping the key and model variables:

https://jp.icodeeasy.cc
https://sg.icodeeasy.cc

Restart Claude Code after switching. For further help, follow connection troubleshooting and share the error code, time with timezone and redacted logs, without your full key.