
Kimi officially provides a Responses API configuration for Codex. Getting connected takes three things: prepare an API Key, specify it in the global ~/.codex/config.toml with kimi-k3 as the Provider and fill in the Key, then run a read-only task to verify that a request is actually sent. This article does not claim that your account has been tested successfully, and it does not treat a configuration with no call records as a completed integration.
Kimi has released K3.1 Pro. If you want to use Kimi in Claude Code, see Kimi K3.1 Pro Setup Guide for Claude Code.
Prepare four things before configuring
- You have launched the Codex CLI at least once, or installed the Codex desktop app;
- An API Key created in AI Code With;
- The Codex configuration file in your current user directory;
- A test task that does not modify any project files.
This guide uses the AI Code With Responses endpoint. If you switch to another Provider, do not mix in the base_url, Provider name, or wire_apibelow. Copy that Provider's current Codex configuration instead.
Configure in this order
1. Prepare the API Key
Create an API Key in the AI Code With console. In the next step, write it directly into the config.toml of the global experimental_bearer_token. No environment variable is needed.
config.toml stores the Key in plain text, so set appropriate file permissions (for example chmod 600 ~/.codex/config.toml) and do not commit it to a code repository.
2. Write the Codex Provider configuration
Open ~/.codex/config.toml. On Windows, the path is %USERPROFILE%\.codex\config.toml. Add or replace the following fields:
model = "kimi-k3"
model_provider = "aicodewith"
model_context_window = 1048576
[model_providers.aicodewith]
name = "aicodewith"
base_url = "https://api.aicodewith.ai/chatgpt/v1"
wire_api = "responses"
experimental_bearer_token = "<your API Key>"
wire_api = "responses" is the key field in this direct-connection configuration. Do not treat the display name shown on a web page as the Model ID, and do not manually append any other path to base_url .
3. Restart and run a minimal verification
After saving the configuration, restart your terminal or the Codex app, then have Codex run a read-only task, such as "Read only the README and explain how to start the project." If you use both the CLI and the desktop app, verify each one separately. Success in one does not automatically prove the other read the same configuration.
How to prove it's really connected
/status showing kimi-k3 only means the configuration was read. It does not, on its own, prove that the request reached the intended Provider. At a minimum, check all of the following:
- The read-only task returns a normal response;
- The Provider shows a matching call record at the same time (if your account offers this);
- The Key and model in the call record match this test.
If you want to publish a claim of "connected" or "measured cost," you should also provide a redacted screenshot of the real configuration and call record, including the test time, model, and call result. A conceptual cover image cannot serve as this evidence.
Common errors, troubleshooting layer by layer
| Symptom | Check first | Next step |
| 401 | experimental_bearer_token contains a valid Key | Re-enter the Key and restart the current entry point |
| 404 | base_url and the API path | Restore the official configuration and do not assemble the path by hand |
| model not found | model = "kimi-k3" and model_provider = "aicodewith" | Check field by field against the same configuration |
| Model responds but no call record | Whether the current request actually goes through the aicodewith Provider | Verify again with a short read-only task |
Model selection and cost optimization come after verification
Get the minimal Kimi K3 verification working first, then decide which tasks are worth using it for. Analyzing an unfamiliar project, refactoring across files, tracking down hard-to-locate bugs, or making architecture decisions usually calls for a stronger model. For simple lookups, bulk renames, and fixed-format work, you can compare another model against K3 on the same task. The point here is not to declare in advance which model is "better value," but to choose based on task results, number of calls, and the day's pricing.
Four optimization steps that don't rely on slogans
- Narrow the scope of each task: Break "analyze the whole repo and finish the changes" into reading the directory first, then locating the module, and finally making the changes, so unrelated context doesn't keep entering the request.
- Write clear stopping conditions into the task: For example, "list only three suspicious files and do not modify code." The more specific the end condition, the easier it is to avoid follow-up questions just to get extra explanation.
- Record input, output, cache, and number of calls: For the same type of task, observe at least these dimensions to learn whether cost comes from context, output length, or multi-turn calls.
- Change only one variable at a time before comparing: For example, keep the same prompt and swap only the model, or keep the same model and shorten only the context. This gives you an explainable basis for your choice, rather than a conclusion drawn from a single experience.
If you need to publish a "measured cost" or claim "how much was saved," keep the redacted call records, test tasks, test times, and calculation method. Without these materials, this article can only provide configuration and optimization methods, and cannot substitute for real test results.
For the complete Codex third-party integration instructions, see AI Code With's Codex integration guide.



