Kimi Code Setup: API Key, K3.1 Pro, and Claude Code
To use an I Code Easy API key in Kimi Code CLI, add the key and a URL ending in /v1 to ~/.kimi-code/config.toml, then select k3.1-pro. In Claude Code, use ANTHROPIC_* variables and the domain alone. The two clients use different configuration formats.
Choose your client and setup path
| Client / goal | Configuration | URL |
|---|---|---|
| Kimi Code CLI, persistent setup | TOML configuration below | https://api.icodeeasy.cc/v1 |
| Kimi Code CLI, current-terminal trial | KIMI_MODEL_* variables below | https://api.icodeeasy.cc/v1 |
| Kimi in Claude Code | ANTHROPIC_* configuration below | https://api.icodeeasy.cc |
Register, copy your site key from API Keys, and select an endpoint for Kimi in Endpoint selection. An I Code Easy API key and an official Kimi account are separate credentials. /login signs in to the official account; it is not where you enter this site’s key.
1. Install Kimi Code
macOS / Linux:
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash
Windows PowerShell:
irm https://code.kimi.com/kimi-code/install.ps1 | iex
Kimi Code on Windows also requires Git for Windows; check the official installation instructions for requirements.
Open a new terminal after installation, then run the version command. If kimi is not found, resolve installation or PATH before changing API settings.
kimi --version
Check the official Kimi Code page for installation and update instructions. If your version rejects these settings, compare its documentation and installed version before repeatedly replacing the key.
2. Configure the I Code Easy API
Create ~/.kimi-code/config.toml if needed; on Windows this is .kimi-code/config.toml under your current user’s home directory. Merge into an existing file, preserving other providers, MCP settings, and permission rules. Keep one top-level default_model before any TOML tables, and do not append duplicate provider or model tables.
If KIMI_CODE_HOME is set, it changes the configuration directory. default_model takes the model table alias, such as icodeeasy/k3.1-pro, rather than the wire model name alone.
default_model = "icodeeasy/k3.1-pro"
[providers.icodeeasy]
type = "kimi"
base_url = "https://api.icodeeasy.cc/v1"
api_key = "Your I Code Easy API key"
[models."icodeeasy/k3.1-pro"]
provider = "icodeeasy"
model = "k3.1-pro"
max_context_size = 1048576
capabilities = ["thinking", "always_thinking", "image_in", "video_in", "tool_use"]
display_name = "Kimi K3.1 Pro (I Code Easy)"
support_efforts = ["low", "high", "max"]
default_effort = "high"
[models."icodeeasy/k3.1-pro-highspeed"]
provider = "icodeeasy"
model = "k3.1-pro-highspeed"
max_context_size = 1048576
capabilities = ["thinking", "always_thinking", "image_in", "video_in", "tool_use"]
display_name = "Kimi K3.1 Pro Highspeed (I Code Easy)"
support_efforts = ["low", "high", "max"]
default_effort = "high"
[models."icodeeasy/k3"]
provider = "icodeeasy"
model = "k3"
max_context_size = 1048576
capabilities = ["thinking", "tool_use"]
display_name = "Kimi K3 (I Code Easy)"
[models."icodeeasy/k3-256k"]
provider = "icodeeasy"
model = "k3-256k"
max_context_size = 262144
capabilities = ["thinking", "tool_use"]
display_name = "Kimi K3 256K (I Code Easy)"
On macOS / Linux, restrict file permissions:
chmod 600 ~/.kimi-code/config.toml
If the primary domain is slow, use https://jp.icodeeasy.cc/v1 or https://sg.icodeeasy.cc/v1 as base_url. Do not append /v1 twice.
Choose among the four models
| Public model | Context | Selection notes |
|---|---|---|
k3.1-pro | 1,048,576 | Default tier; thinking required |
k3.1-pro-highspeed | 1,048,576 | Highspeed tier; thinking required |
k3 | 1,048,576 | Independent K3; thinking can be disabled |
k3-256k | 262,144 | Independent 256K tier; thinking can be disabled |
See pricing and usage for current prices, balance, and usage, and the model catalog for supported capabilities. Image and video input are not publicly promised for K3 or K3-256K.
Legacy names do not all select the same model. Legacy K2 names, kimi, and kimi-for-coding route to K3.1 Pro; Highspeed aliases such as kimi-for-coding-highspeed select Highspeed. kimi-k3 and k3[1m] remain K3, while kimi-k3-256k remains K3-256K. The corresponding kimi--prefixed names for all four tiers retain their model selection.
When K3-256K exceeds its context limit, the existing mechanism upgrades the request to K3 and bills that request at K3 prices. Start a new session after switching models to avoid carrying over previously compressed context.
Temporary test configuration
Current Kimi Code does not automatically read ordinary KIMI_API_KEY. Use the dedicated KIMI_MODEL_* variables for a temporary trial. This is a separate setup path from the config file; identify which path you are testing first.
Setting KIMI_MODEL_NAME activates the environment model and requires KIMI_MODEL_API_KEY. These variables do not write back to the file and take priority over its default_model; the command-line -m option takes priority over the environment model.
macOS / Linux:
export KIMI_MODEL_NAME="k3.1-pro"
export KIMI_MODEL_API_KEY="Your I Code Easy API key"
export KIMI_MODEL_PROVIDER_TYPE="kimi"
export KIMI_MODEL_BASE_URL="https://api.icodeeasy.cc/v1"
export KIMI_MODEL_MAX_CONTEXT_SIZE="1048576"
export KIMI_MODEL_CAPABILITIES="thinking,always_thinking,image_in,video_in,tool_use"
kimi
Windows PowerShell (current session only):
$env:KIMI_MODEL_NAME="k3.1-pro"
$env:KIMI_MODEL_API_KEY="Your I Code Easy API key"
$env:KIMI_MODEL_PROVIDER_TYPE="kimi"
$env:KIMI_MODEL_BASE_URL="https://api.icodeeasy.cc/v1"
$env:KIMI_MODEL_MAX_CONTEXT_SIZE="1048576"
$env:KIMI_MODEL_CAPABILITIES="thinking,always_thinking,image_in,video_in,tool_use"
kimi
For a temporary Highspeed trial, change KIMI_MODEL_NAME to k3.1-pro-highspeed. Closing this terminal removes the variables set here. Any values previously saved in user-level settings or startup scripts must be removed separately. Test TOML settings in a new terminal without these temporary variables.
3. Start and verify
Enter your project directory and run:
cd your-project-directory
kimi
Run /model in the interface and confirm Kimi K3.1 Pro (I Code Easy) or your intended tier. A version string or model list alone does not prove a successful API call.
Send a simple message such as “Reply only: connection successful” before asking the client to read or edit your project. After a reply, check status and actual model in request logs, then check usage details for usage and charges. Hide the key in any troubleshooting screenshots.
Use Kimi K3.1 Pro through Claude Code
For general installation and configuration, see the Claude Code guide. On macOS / Linux, add these Kimi settings to the ~/.bashrc or ~/.zshrc that your shell uses:
export ANTHROPIC_AUTH_TOKEN="your I Code Easy API key"
export ANTHROPIC_BASE_URL="https://api.icodeeasy.cc"
export ANTHROPIC_MODEL="k3.1-pro"
export ANTHROPIC_SMALL_FAST_MODEL="k3.1-pro"
export ANTHROPIC_DEFAULT_SONNET_MODEL="k3.1-pro"
export ANTHROPIC_DEFAULT_OPUS_MODEL="k3.1-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="k3.1-pro"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
Save, run source ~/.bashrc or source ~/.zshrc, and start claude. ANTHROPIC_BASE_URL uses the domain alone; alternatives are https://jp.icodeeasy.cc and https://sg.icodeeasy.cc. Start a new session after changing models.
On Windows, set the same variables as $env:VARIABLE="value" in PowerShell and launch claude from that window. If you save user-level permanent variables, open a new PowerShell window; running clients do not automatically receive them. Do not paste Bash export commands unchanged into PowerShell.
$env:ANTHROPIC_AUTH_TOKEN="your I Code Easy API key"
$env:ANTHROPIC_BASE_URL="https://api.icodeeasy.cc"
$env:ANTHROPIC_MODEL="k3.1-pro"
$env:ANTHROPIC_SMALL_FAST_MODEL="k3.1-pro"
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="k3.1-pro"
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="k3.1-pro"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="k3.1-pro"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
claude
Troubleshoot 401, model selection, and URL errors
| Symptom | Check and fix |
|---|---|
| 401 / authentication failure | Use this site’s API key, not official Kimi account credentials. Check the active provider key or session variables. Rotate a leaked key in API Keys and update the client. |
| Model selection does not change | Match top-level default_model to the model table ID and confirm with /model. Remove leftover KIMI_MODEL_* session variables, restart the client, and begin a new session. |
| Connection or path error | Kimi CLI base_url includes /v1; Claude Code ANTHROPIC_BASE_URL uses the domain alone. Check for duplicated paths and try JP / SG with the corresponding URL format. |
| Duplicate TOML key or table | Merge the existing file instead of pasting the whole block again. Keep one top-level default_model and one table for each provider or model ID. |
| A legacy name selects an unexpected model | Check the alias mapping above and prefer the four public model names. In particular, kimi-k3 does not mean K3.1 Pro. |
| New Windows settings have no effect | Set variables in the window that launches the client. Reopen the terminal after changing user-level variables; current-session variables end when that window closes. |
Configure another client
Claude Code · GLM setup · Pricing, balance, and usage · Model capabilities
Official references
Related guides
Install Claude Code, Configure a Custom API, and Troubleshoot Windows
Install Claude Code, configure a custom API key and URL, verify Windows or Unix settings, and troubleshoot authentication, rate limits, and connections.
How to use GLM-5.3 with Claude Code
Use GLM-5.3 in Claude Code: set an API key, Base URL and model, check Windows or Unix settings, and fix authentication, model selection and connection errors.
Doubao Seed 2.1 Turbo with Claude Code
Use an I Code Easy API key to configure Doubao Seed 2.1 Turbo in Claude Code on macOS, Linux or Windows. Verify requests and distinguish text from image and video models.