Using Kimi in Codex
Codex is OpenAI's coding agent. This guide shows how to connect Codex CLI to Kimi For Coding via CC Switch, with Kimi K3 or Kimi K2.7 Code providing the model inference.
Community third-party integration, for reference only
CC Switch + Codex is a community-provided third-party integration, and this guide is for reference only. It is not officially maintained or supported, and we cannot guarantee its compatibility with every version of Codex / CC Switch. If you run into API compatibility issues, please troubleshoot and adapt based on your actual environment — and you are welcome to share your solution with the community.
Codex CLI currently supports text and image input, but does not provide a native video input channel — you cannot submit a video file directly as multimodal input to the model. To analyze video, extract key frames with ffmpeg and optionally combine with audio transcription before handing them to the model. This is a limitation of Codex CLI's input layer, not of the Kimi K3 model — the Kimi K3 API natively supports video input.
Membership
Before configuring, check your membership tier and pick the models and context-window values that match your plan:
| Tier | Available models | Context window |
|---|---|---|
| Andante | kimi-for-coding | 256K |
| Moderato | k3kimi-for-coding | k3: 256Kkimi-for-coding: 256K |
| Allegretto and above | k3kimi-for-codingkimi-for-coding-highspeed | k3: up to 1Mkimi-for-coding: 256Kkimi-for-coding-highspeed: 256K |
See Model configuration for model capabilities and setup details.
How it works
Codex CLI uses the OpenAI Responses API, while Kimi For Coding provides an OpenAI-compatible Chat Completions API. The two protocols are incompatible, so a local routing layer is needed to translate requests and streaming responses in both directions:
Codex CLI → CC Switch (local router) → Kimi For Coding APIThe steps below use CC Switch as an example. Keep CC Switch and Codex routing running while using the Kimi For Coding provider.
Prerequisites
Before you start:
- Follow the official Codex documentation to install Codex CLI and start it at least once.
- Create and save an API Key in the Kimi Code Console.
- Follow the official CC Switch guide to install the version for your operating system.
WARNING
CC Switch is a third-party open-source tool and is not maintained by Kimi. Evaluate it against your organization's security and compliance requirements before use; your API Key and Codex requests and responses will be processed by its local router.
After installation, open CC Switch and follow the steps below.
Step 1: Enable Codex routing
In CC Switch, go to Settings > Routing:
- Turn on the Routing Master Switch to start the local routing service.
- Under Routing Enabled, turn on Codex.

Step 2: Add the Kimi For Coding provider
- Return to the CC Switch home screen and select the Codex tab at the top.
- Click + in the upper-right corner to add a provider.

- Confirm you are on the Codex Provider page, then select Kimi For Coding from the preset provider list.

- Fill in the following settings:
| Setting | Value |
|---|---|
| API request URL (Base URL) | https://api.kimi.com/coding/v1 |
| API Key | API Key created in the Kimi Code Console |

- Scroll down to Model Mapping and click Fetch Models — CC Switch will pull the three models Kimi For Coding currently supports. Then fill in each model's Menu display name and Context window using the table below:
| Menu display name (suggested) | Actual request model | Context window |
|---|---|---|
K3 | k3 | 1048576 (use 262144 without 1M access) |
K2.7 Code | kimi-for-coding | 262144 |
K2.7 Code HighSpeed | kimi-for-coding-highspeed | 262144 |
Also confirm the following advanced settings:
| Setting | Value |
|---|---|
| Upstream format | Chat Completions (routing required) |
| Prompt cache routing | Auto (recommended) |
| Supports thinking mode | On (must be on — turning it off routes K3 and K2.7 Code to K2.6) |
| Supports reasoning effort | On |
- After confirming the settings, click Add in the lower-right corner.

Step 3: Enable the Kimi For Coding provider
Return to the Codex provider list and click Enable on the Kimi For Coding provider you just added.

Confirm that:
- Kimi For Coding is the active provider under the Codex tab;
- CC Switch Local Routing is running;
- Codex is enabled under the routing settings.
Step 4: Start Codex CLI
If Codex CLI is already running, exit the current session. Then enter the project directory where you want to work and start Codex CLI again:
cd /path/to/your/project
codexRestarting allows Codex CLI to load the latest provider and model configuration written by CC Switch.
After startup, confirm that Codex CLI shows k3 as the current model, then send a simple request:
helloIf Codex CLI returns a response and the status bar shows k3, the configuration is working.

You can also check the CC Switch routing counter or request logs to confirm a new Codex request has appeared.
Switching reasoning effort
K3 supports three reasoning effort levels: low / high / max. In a Codex CLI session, type /model to reselect the current model, then pick a level in the Select Reasoning Level menu:

The levels Codex shows are mapped to K3's actual effort as follows (full mapping rules in Model configuration):
| Codex Reasoning Level | K3 actual effort |
|---|---|
| Low | low |
| Medium (default) | high (recommended) |
| High | high (recommended) |
| Extra high | max |
After switching levels, start a new session to avoid cache-invalidation overhead from the previous context.
FAQ
Codex still uses the original model after launch
CC Switch's config was not applied, or Codex CLI was not restarted. Exit the current Codex session and restart it, and confirm CC Switch local routing is running.
Cannot connect to the local router
CC Switch is not running, or Codex routing is not enabled. Launch CC Switch and check both the master switch and the Codex switch under Settings > Routing.
401 authentication error
The API Key is missing, expired, or your plan lacks permission. Regenerate the API Key in the Kimi Code Console, and confirm your plan supports the selected model (see the Membership table above).
Request format or streaming errors
The upstream format is not set to Chat Completions, or routing is not enabled. In the provider's advanced settings, confirm Upstream format is Chat Completions (routing required).
Model parameter errors
Kimi models have fixed sampling requirements. Do not override temperature, top_p, n, etc. in CC Switch.
Next steps
- Model configuration — Compare the three models and see the full effort mapping table
- Membership Benefits — Confirm which models are available for your plan