LLM API Guide

How to Use Kimi K3.1 Pro in Claude Code

Set ANTHROPIC_BASE_URL to an Anthropic-format endpoint, ANTHROPIC_AUTH_TOKEN to your key and ANTHROPIC_MODEL to kimi-k3.1-pro, then check /status.

Editorial illustration: How to Use Kimi K3.1 Pro in Claude Code
Photo-style image, AI-generated

Summary

  1. Claude Code needs three variables for Kimi K3.1 Pro: ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN and ANTHROPIC_MODEL set to kimi-k3.1-pro.
  2. Run /status after launch to confirm the base URL and model; Kimi will not appear in the /model menu.
  3. Moonshot's own K3.1 Pro price, context length and Claude Code model id were not published on a page we read as of 2026-10-24.
On this page

What you need

An API key from a provider that serves Kimi K3.1 Pro over the Anthropic Messages format, because that is the format Claude Code speaks. Moonshot's page on Kimi K3 pricing announces K3.1 Pro with upgrades for programming and agent tasks. OpenRouter lists it as moonshotai/kimi-k3.1-pro with tools and tool_choice among its accepted parameters, which a coding agent depends on.

The OpenRouter page also says the model is not available through EU in-region routing. If your data has to stay in the EU, check that before you pick a provider.

Set the variables

Claude Code reads ANTHROPIC_MODEL from the shell, and it overrides the model setting in any settings file. The base URL and token variables are the ones Moonshot-compatible setups for K3 use too, as reported for Kimi K3. Replace the base URL with the Anthropic-format address of whichever provider you chose:

bash
unset ANTHROPIC_API_KEY
export ANTHROPIC_BASE_URL="https://your-provider.example/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
export ANTHROPIC_MODEL="kimi-k3.1-pro"
claude

Unset ANTHROPIC_API_KEY first. The K3 guide above reports that a leftover key conflicts with ANTHROPIC_AUTH_TOKEN and causes authentication errors. For a similar Claude Code setup with Muse Ember, see Muse Ember setup.

To make it permanent, put the same names in an env block in ~/.claude/settings.json, which Claude Code documents as an ordinary settings key:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://your-provider.example/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "sk-your-key",
    "ANTHROPIC_MODEL": "kimi-k3.1-pro"
  }
}

Settings files are strict JSON, so a comment or trailing comma makes Claude Code report a Settings Error at the next start.

Check that it worked

Start claude and run /status. The base URL and model should show your provider and kimi-k3.1-pro. Then send a small prompt such as "list the files in this folder" and watch that a tool call runs.

Kimi will not show up in the /model menu, because that list is made of Claude aliases. The K3 guide says this is expected and that /status is the way to check.

If the model still answers as Claude or the request goes to Anthropic, something with higher precedence is setting the model or key. Run /status to see which settings files loaded, and look for a model key in a project .claude/settings.json.

Using SeedRouter as the endpoint

SeedRouter, the gateway we run, lists kimi-k3.1-pro. Its Claude Code setup uses ANTHROPIC_BASE_URL=https://seedrouter.net with no /v1, and your SeedRouter key in ANTHROPIC_AUTH_TOKEN. Check the live price table in the dashboard for the current rate before you run a long session. It is a third-party gateway, not an official Moonshot channel, and your prompts pass through it.

bash
export ANTHROPIC_BASE_URL="https://seedrouter.net"
export ANTHROPIC_AUTH_TOKEN="$SEEDROUTER_API_KEY"
export ANTHROPIC_MODEL="kimi-k3.1-pro"

For other ways to connect Kimi and similar models, see Claude Code with DeepSeek, GLM and Kimi and Claude Code with a third-party API.

K3.1 Pro or K3

The model id differs from K3. The K3 setup guide uses kimi-k3[1m], and sets every ANTHROPIC_DEFAULT_*_MODEL variable and CLAUDE_CODE_SUBAGENT_MODEL to it. If subagents or background tasks should also run on K3.1 Pro, set those the same way with the id your provider gives; otherwise Claude Code may call a different model for them.

Not confirmed yet

  • Price. No Moonshot page we read lists a K3.1 Pro rate. The OpenRouter page shows no per-token price either.
  • Context length. The OpenRouter page states none, so do not copy K3's CLAUDE_CODE_AUTO_COMPACT_WINDOW value of 1048576 until a source gives K3.1 Pro's window.
  • Moonshot's direct model id. The K3 guide uses kimi-k3[1m] with a [1m] suffix. Whether K3.1 Pro uses kimi-k3.1-pro or a suffixed id on Moonshot's own endpoint is not stated on the pages we read, so use the id your provider's model list shows.
  • Release details. The OpenRouter page gives no release date or model description.

Prices on this page are left out until a vendor page publishes them.

Sources and checks

  1. Kimi K3.1 Pro (moonshotai/kimi-k3.1-pro) on OpenRouter
  2. Settings files and precedence - Claude Code Docs
  3. How to Use Kimi K3 in Claude Code
  4. Kimi K3 Pricing Explained: Plans and API Costs