Field SOP
Field SOP

Wiring Kimi Open Platform into Codex and Claude Code

Kimi Open Platform (Moonshot AI) now lets OpenAI/Anthropic-compatible tools point natively at Kimi, with no self-built proxy. Two paths: ① OpenAI Responses API for Codex — base_url=https://api.moonshot.cn/v1, with KIMI_API_KEY and wire_api="responses" in ~/.codex/config.toml; ② Anthropic Messages API for Claude Code — base_url=https://api.moonshot.cn/anthropic, with ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN=Kimi Key / ANTHROPIC_MODEL=kimi-k3[1m] (the [1m] selects 1M context) in the env block of ~/.claude/settings.json. Models: kimi-k3(1M) / kimi-k2.7-code(256K forced thinking) / kimi-k2.7-code-highspeed / kimi-k2.6. The Responses API does not yet support video. This SOP gives directly usable config snippets, a minimal verification step, and six gotchas (including never dropping [1m], kimi-k2.7-code's forced thinking, and tiered quotas). Rate limits are tiered; exact numbers are per the console.

Published September 1, 202610 min read
<!-- kimi-openplatform-codex-claude-code-sop | sop | Wiring Kimi Open Platform into Codex and Claude Code -->

Kimi Open Platform (Moonshot AI) now lets you point tools that were built for OpenAI-compatible and Anthropic-compatible endpoints directly at Kimi models, without writing your own proxy, translator, or thin compatibility shim. For teams already running Codex and Claude Code heavily, that means you can drop a strong, long-context, domestically hosted coding model into your existing agent workflows at a price far below US-frontier models. This is an executable SOP: the first half covers the base_url and model identifiers for the two integration paths, and the second half covers the configuration snippets, a minimal verification step, and a gotchas list. For why a cheap but capable coding model matters, see the flagship coding and reasoning model review; for the weights-open-sourcing angle, see Kimi K3 open weights.


1. Why wire Kimi into Codex and Claude Code

The appeal is not novelty. It is cost and context. Kimi's pricing sits well under the US-frontier bands (exact figures unconfirmed; see the Kimi pricing page), and kimi-k3 carries a 1M token context window that fits large repositories and long multi-document sessions without aggressive compaction. Claude Code and Codex are mature agent front ends with permission models, sub-agents, and file-editing loops that you have already tuned. Rather than rebuild that UX around a new SDK, the Open Platform lets you keep the tooling and swap only the model underneath.

This is the same "cheap strong model" thesis discussed in the flagship coding and reasoning model review, and it lines up with the broader "strong models get democratized" trend covered in Kimi K3 open weights. For a lightweight high-speed alternative on the low-cost branch, the Gemini 3.8 Flash hotspot is worth a parallel look.

Note that this is distinct from running your own OpenAI-compatible proxy: the platform endpoint handles translation, auth, and retries server-side, so there is no relay for you to operate and no extra latency hop that you introduced yourself. What you get is a directly usable dual-protocol compatibility layer, not a thin wrapper you have to maintain.


2. The two paths at a glance

Kimi Open Platform exposes two compatible endpoints, one per tool's underlying protocol:

  1. OpenAI Responses API path — for Codex. Codex's underlying calls are OpenAI-style Responses or Chat calls; point them at https://api.moonshot.cn/v1 and the platform translates to Kimi on the back end.
  2. Anthropic Messages API path — for Claude Code. Claude Code's underlying calls are Anthropic-style Messages calls; point them at https://api.moonshot.cn/anthropic and the platform emulates the Anthropic endpoint so Claude Code hits Kimi without knowing it.

These are not either-or. The same Kimi API key can feed both Codex and Claude Code at once, but the configuration lives in each tool's own config file. The table below aligns the objects:

ToolProtocolbase_urlConfig file
CodexOpenAI Responses APIhttps://api.moonshot.cn/v1~/.codex/config.toml
Claude CodeAnthropic Messages APIhttps://api.moonshot.cn/anthropic~/.claude/settings.json

3. Available models

The Kimi models reachable through these paths, and their context and behavior differences:

  • kimi-k3: the 1M-context long-context workhorse, good for large repos, long sessions, and multi-document retrieval.
  • kimi-k2.7-code: 256K context, forced thinking, coding-specialized; it expands a reasoning chain before answering.
  • kimi-k2.7-code-highspeed: the 256K high-speed variant, trading some quality for throughput, good for high-volume low-latency work.
  • kimi-k2.6: the previous stable tier, useful as a fallback or control.

One subtlety: kimi-k2.7-code runs in forced-thinking mode, so every response first emits a reasoning chain and then the result. That is usually good for coding, but if you plan to call it as a pure completion endpoint at high frequency, budget for the extra latency and token cost of the thinking chain.


4. Step 1: get a Kimi API key

Go to the Moonshot Open Platform console and register, then create an API key. There is no proxy or relay here; the key is issued directly by the platform. Treat it as a secret: do not hardcode it in a repo, logs, or front-end code. Put the key in an environment variable or a secrets manager, and reference the variable name from the config files rather than pasting the plaintext into config.toml or settings.json.

If your team sits in a tiered quota plan, different keys have different ceilings. The exact tiers and your visible quota are shown in the console; this article does not invent numbers.


5. Step 2: wire Codex (Responses API)

Edit ~/.codex/config.toml to add your Kimi key and the wiring method. The two key lines are KIMI_API_KEY and wire_api = "responses". Here is a directly usable TOML block:

toml
# ~/.codex/config.toml
[env]
KIMI_API_KEY = "sk-kimi-xxxxxxxxxxxxxxxx"

[model]
# Point at the Kimi Open Platform OpenAI-compatible endpoint
base_url = "https://api.moonshot.cn/v1"
# Use the Responses API wiring
wire_api = "responses"
# Model identifier
model = "kimi-k3"

After saving, every underlying Codex request is rerouted to Kimi's Responses endpoint. Note that wire_api must be the string "responses"; a wrong type will silently fail to apply.


6. Step 3: wire Claude Code (Anthropic Messages API)

Edit ~/.claude/settings.json and write three variables into the env block: ANTHROPIC_BASE_URL points at Kimi's Anthropic-compatible endpoint, ANTHROPIC_AUTH_TOKEN holds your Kimi API key, and ANTHROPIC_MODEL is kimi-k3[1m]. Here is a directly usable JSON block:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.moonshot.cn/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "sk-kimi-xxxxxxxxxxxxxxxx",
    "ANTHROPIC_MODEL": "kimi-k3[1m]"
  }
}

The [1m] suffix is not decoration: it explicitly selects the 1M-context variant. If you write kimi-k3 without [1m], the platform may fall back to the default context window. Claude Code's UX (commands, permissions, sub-agents, file-editing interaction) is fully preserved; only the underlying model changes to Kimi.


7. Step 4: run a minimal verification first

Before pointing your whole agent workflow at Kimi, run one minimal call that depends on no tools and no long context: ask the model to echo a string verbatim. The goal is to confirm three things — the key is valid, the base_url is reachable, and the model identifier is parsed correctly. Any misconfiguration here will otherwise surface as a long series of "looks like it is running but silently failing" agent calls that are painful to debug.

Verification suggestion: use the simplest echo prompt and check that the response is exactly the input string; then try a slightly longer prompt to confirm the reply shape (thinking chain or plain answer) matches expectations. Only after the minimal check passes do you switch the full agent (with tools, multi-turn, long context) over. This matches the "verify small before scaling" discipline emphasized in the flagship coding and reasoning model review.

During the minimal check, watch for three failure shapes. First, an authentication error means the key is wrong or expired — confirm it was copied from the console and not a stale environment variable. Second, a connection error or 404 means the base_url is wrong for that tool's protocol; Codex must use the /v1 OpenAI path and Claude Code must use the /anthropic path, and swapping them is the single most common mistake. Third, a parse error on the model identifier (for example kimi-k3[1m] written with spaces, or a stray bracket) rejects before any completion is produced. At this step, log the raw HTTP status and the first error line from each tool; those two lines are almost always enough to localize the misconfiguration without escalating to a full agent run, where the same error would be buried under tool calls and retries.


8. Gotchas

  1. Responses API does not yet support video input. On the OpenAI Responses path, video input is currently out of scope. If your Codex task carries video frames or video files, confirm the platform has enabled it first, or fall back to another model or preprocess the video into text.
  2. Do not drop the [1m] suffix. In the Claude Code path, ANTHROPIC_MODEL must carry [1m] to get the 1M context; omitting it falls back to the default window and silently truncates long-repo tasks.
  3. kimi-k2.7-code forces thinking. It always runs a reasoning chain first, adding latency and token cost. For latency-sensitive high-frequency calls, consider kimi-k2.7-code-highspeed.
  4. Key plaintext risk. Do not write the API key directly into files that get committed. Use environment variables or a secrets manager; keep only the reference in config.
  5. Quotas are tiered. Rate limits are tiered; the exact ceiling is shown in the console. Verify your tier before production traffic to avoid silent throttling.
  6. The two paths are independent. Codex and Claude Code configs do not affect each other; editing one does not sync the other, so check both during migration.

9. Cost and when it pays off

Kimi Open Platform pricing sits well below US-frontier models (exact rates unconfirmed; see the Kimi pricing page). For cost-sensitive workloads where the task is mostly coding and multi-document understanding, wiring Codex and Claude Code into Kimi can cut per-agent-call unit cost by roughly an order of magnitude while quality stays acceptable for most everyday coding tasks.

This echoes the "strong models get democratized" thread in Kimi K3 open weights and matches the conclusion in the flagship coding and reasoning model review about why a cheap strong coding model matters. As a parallel low-cost branch, the Gemini 3.8 Flash hotspot is also worth evaluating.

For production traffic, add a thin logging layer that records which model identifier actually served each request and the per-call token count. Because the Open Platform proxies the traffic, the responding model is Kimi even though the tool believes it called OpenAI or Anthropic, and your cost dashboards should reflect that rather than assuming a US-frontier bill. Pair that with a hard ceiling on daily spend so a misconfigured loop cannot run unnoticed; the tiered quotas make an unexpected bill more likely than a hard outage, and the cheapest model is also the one most tempting to leave running.


10. One-page cheat sheet

ItemCodex pathClaude Code path
ProtocolOpenAI Responses APIAnthropic Messages API
base_urlhttps://api.moonshot.cn/v1https://api.moonshot.cn/anthropic
Config file~/.codex/config.toml~/.claude/settings.json
Key variablesKIMI_API_KEY, wire_api="responses"ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL
Model idkimi-k3 etc.kimi-k3[1m]
Known limitResponses API no video input yet[1m] suffix sets context window

References

  • Kimi Open Platform (Moonshot AI) documentation: OpenAI-compatible endpoint https://api.moonshot.cn/v1, Anthropic-compatible endpoint https://api.moonshot.cn/anthropic, model identifiers (kimi-k3 / kimi-k2.7-code / kimi-k2.7-code-highspeed / kimi-k2.6), kimi-k2.7-code forced thinking with 256K context, kimi-k3 1M context and the [1m] suffix convention. Exact doc URLs unconfirmed.
  • Kimi Open Platform console: API key issuance, tiered quota plans, rate-limit ceilings. Exact numbers shown in the console; this article does not confirm them.
  • Kimi pricing page: unit pricing well below US-frontier models. Exact rates unconfirmed; see the official pricing page.
  • Codex config conventions (~/.codex/config.toml env/model sections and the wire_api field) and Claude Code config conventions (~/.claude/settings.json env block and ANTHROPIC_* variable names) follow each tool's own configuration format; parameter names per the current tool version.

Frequently Asked Questions

Q1: Which configs change to wire Claude Code to Kimi? A1: Only the env block in ~/.claude/settings.json changes, with three variables: set ANTHROPIC_BASE_URL to https://api.moonshot.cn/anthropic, set ANTHROPIC_AUTH_TOKEN to your Kimi API key, and set ANTHROPIC_MODEL to kimi-k3[1m]. Claude Code's interface, permissions, and sub-agents stay untouched; once saved, the underlying traffic goes to Kimi.

Q2: What are the base_urls for the Codex vs Claude Code paths? A2: Codex uses the OpenAI Responses path with base_url https://api.moonshot.cn/v1; Claude Code uses the Anthropic Messages path with base_url https://api.moonshot.cn/anthropic. These are two distinct compatible endpoints the platform provides, mapped to each tool's underlying protocol; do not mix them up.

Q3: What does [1m] mean in kimi-k3[1m]? A3: [1m] is a suffix on the model identifier that explicitly selects the 1M (one million token) context variant. If you write just kimi-k3 without the suffix, the platform may fall back to the default context window, and large-repo or long-session work will be silently truncated. Keep [1m] in the Claude Code path.

Q4: What are the current limits of the Responses API? A4: The main known limit is that the Responses API path (the OpenAI-compatible endpoint used by Codex) does not yet support video input. If your task carries video frames or files, confirm the platform has enabled that capability first, or fall back to another model or preprocess the video into text before sending. Other modalities and capabilities follow the platform docs.

Q5: How do I verify the integration works? A5: Run a minimal verification: use the simplest prompt asking the model to echo a string verbatim, confirming the key is valid, the base_url is reachable, and the model identifier is parsed correctly. Then try a slightly longer prompt to confirm the reply shape matches expectations. Only after the minimal check passes do you switch the full agent workflow (with tools and long context) to Kimi, avoiding a large silent failure on the first big task.

This article is AI-assisted and human-edited. Last updated: 2026-09-01

FAQ

Which configs change to wire Claude Code to Kimi?
Only the `env` block in `~/.claude/settings.json` changes, with three variables: set `ANTHROPIC_BASE_URL` to `https://api.moonshot.cn/anthropic`, set `ANTHROPIC_AUTH_TOKEN` to your Kimi API key, and set `ANTHROPIC_MODEL` to `kimi-k3[1m]`. Claude Code's interface, permissions, and sub-agents stay untouched; once saved, the underlying traffic goes to Kimi.
What are the base_urls for the Codex vs Claude Code paths?
Codex uses the OpenAI Responses path with base_url `https://api.moonshot.cn/v1`; Claude Code uses the Anthropic Messages path with base_url `https://api.moonshot.cn/anthropic`. These are two distinct compatible endpoints the platform provides, mapped to each tool's underlying protocol; do not mix them up.
What does [1m] mean in kimi-k3[1m]?
`[1m]` is a suffix on the model identifier that explicitly selects the 1M (one million token) context variant. If you write just `kimi-k3` without the suffix, the platform may fall back to the default context window, and large-repo or long-session work will be silently truncated. Keep `[1m]` in the Claude Code path.
What are the current limits of the Responses API?
The main known limit is that the Responses API path (the OpenAI-compatible endpoint used by Codex) does not yet support video input. If your task carries video frames or files, confirm the platform has enabled that capability first, or fall back to another model or preprocess the video into text before sending. Other modalities and capabilities follow the platform docs.
How do I verify the integration works?
Run a minimal verification: use the simplest prompt asking the model to echo a string verbatim, confirming the key is valid, the base_url is reachable, and the model identifier is parsed correctly. Then try a slightly longer prompt to confirm the reply shape matches expectations. Only after the minimal check passes do you switch the full agent workflow (with tools and long context) to Kimi, avoiding a large silent failure on the first big task.

Related

Field SOP

428B Weights Are Out, Budget 8 H100s: M3.1 Flash Local Deploy

A deployment log for M3.1 Flash (428B, 23B active). Cold water first: there is no consumer or single-GPU recipe anywhere official - the smallest validated tiers are 4x Blackwell (B200/B300/GB200/GB300, TP4), 4x AMD MI355X (TP4), or a full node of 8x H100/H200 (TP8, FP8 path). Weights come from HF or ModelScope (public, not gated); three size calibers coexist: community-count 252.4GB over 48 shards plus a 2.3GB DSpark head, and the vLLM recipe listing NVFP4 at 285GB, MXFP4 at 293GB, FP8 at 533GB; there is no official quantized repo. vLLM needs 0.33.0 or newer (absent from PyPI on release day, so use the vllm/vllm-openai:minimax-m31-flash Docker image or nightly); three official commands transcribed verbatim - H100/H200 TP8, GB200 TP4, MI355X TP4 - all forcing --block-size 128 and --disable-hybrid-kv-cache-manager (omit it and you get No common block size for 16); 1M context opens via --max-model-len (the Hopper sample caps at 262144). SGLang is not merged to main yet (Blackwell needs the MSA kernel at a pinned commit plus nvcc 13.4 minimum - cu130 does not count). The memory ledger: BF16 at roughly 856GB is an inference, not an official figure; 23B active lowers compute, not the VRAM floor - all 428B experts must stay resident, which is exactly why consumer cards are out; total KV cache for 1M context is unpublished. Domestic compute rides FlagOS Day-0 across nine chips (Huawei Ascend included, via SGLang-plugin-FL), numbers flagged as FlagOS official. Thirteen official error notes collected with fixes: HugeTLB 560GiB, B200 OOM, parser spelling, and more. License: MiniMax Community License, commercial attribution plus the 20-million-dollar threshold. One line of reality: 428B weights are out - budget 8 H100s.

Oct 24, 20269 min read
Field SOP

Nemotron 3.5 Bolt Local Deployment: 74B on a 24GB Card

NVIDIA released Nemotron 3.5 Bolt 74B-A9B 24GB on October 15, 2026: a compression of the 120B Super VL via Star Elastic budget-conditioned architecture search (expert top-K down from 22 to 9, distilled recovery training over 120B tokens), on a hybrid Mamba-2 and Transformer architecture. The quantization plan is the story - the expert layers that dominate the weights drop to IQ2_XXS at 2.0625 bits per element (about 19GB), Mamba linear layers use NVFP4, and lm_head, embeddings, and attention stay at Q8_0, landing the full model at 22-24GB with accuracy recovered through quantization-aware distillation from the compression stage onward. Four deployment routes, with commands: Ollama (supported since 0.40.5, ollama run nemotron-3.5-bolt, a 25GB download, verify 100 percent GPU via ollama ps); Unsloth (UD-IQ2_XXS about 22GB, UD-IQ1_M about 20.3GB, ctx from a conservative 4096); llama.cpp official recipes (builds after October 15 to recognize nemotron_h_moe; the 28GB recipe runs 65K context with 8-bit KV and 6 draft tokens, the 32GB recipe reaches 262K; llama-server defaults to port 9931 since b11521); and vLLM (Blackwell SM120 with the LiLiCorr drafter for multi-user serving). Two context starting points coexist: 16K-32K for bare weights, 4K for Unsloth whose default drafter eats another 1-2GB. Eight troubleshooting entries cover OOM context cuts, layers spilling to system RAM, the missing --mmproj flag, and the shared 16384 max_tokens budget. OpenMDW-1.1 grants free unrestricted commercial use, leaves outputs unencumbered, requires notices only on redistribution, and carries a patent-retaliation clause. Vendor-reported: GPQA Diamond 86.4, Terminal-Bench 2.1 at 51.0, PinchBench first in class (83.99 TPS on RTX Spark; no official consumer-card figure). The 4GB Bolt E4B followed on October 23.

Oct 23, 20268 min read
Field SOP

Xing4.0-29B-Intent Local Deploy: 4B Active, Which Command?

Getting Xing4.0-29B-Intent running hinges on a detail that trips most people up: the official deployment instructions do not live in the intent repository but in the base model repository. The intent README only says to replace the model path with the Xing4.0-29B-Intent weights and set --served-model-name to Xing4.0-29B-Intent, so the full vLLM and SGLang launch commands must be taken from the Xing4.0-29B-A4B base repo. Several flags are hard requirements: --trust-remote-code is mandatory because model_type is the in-house xing4_0 architecture, neither llama nor qwen; --tensor-parallel-size 2 implies at least two cards; --max-model-len 262144 matches the 256K context; --reasoning-parser xing4_0 and --tool-call-parser xing4_0 supply the matching parsers; --speculative-config uses the mtp method; and --gpu-memory-utilization 0.90 with --max-num-seqs 4 is the official example ratio. The weights ship as 41 safetensors shards totaling 62.43 GB, and the only official quantizations are FP8 (33.17 GB, e4m3) and GGUF (a single IQ4_NL file at 17.75 GB) - there is no AWQ, GPTQ, or INT8 safetensors. Minimum VRAM is not published at all; the official line is to configure GPU memory, parallelism, and context length for your environment. What the base repo does spell out: bfloat16 is required because the mHC path errors out on FP16 or quantized weights, --pipeline-parallel-size greater than 1 is not yet supported, the CUDA mHC path needs tilelang installed, and the host needs Docker 24.0 or newer with driver 535 or newer. The Ascend route explicitly wants 910B2 NPUs with at least two cards, with three official quay.io images (none of which bundle the weights). Consumer and CPU paths appear only in the base llama.cpp docs: int4 weights quantized with IQ4_NL come to about 19 GB and fit on a single consumer GPU, with an RTX 3090 24 GB as the example. The SDK is just an httpx HTTP client and is not on PyPI, and structured output comes in two layers - the model's native category plus args array, and SDK-guided JSON Schema constraints through vLLM response_format. The license is Apache-2.0, yet the weight side has no standalone LICENSE file, the repository LICENSE is an unfilled placeholder template, and the original terms of the 61 upstream datasets still need checking.

Oct 22, 20269 min read