Kimi Code CLI custom provider: config.toml base_url for Claude, GPT and Chinese models (November 2026)
Yes. As of 2026-11-10, the Kimi Code CLI docs page Providers and models says you add one providers table per protocol in ~/.kimi-code/config.toml, with type set to anthropic, openai or openai_responses, or manage providers by typing /provider in the TUI. Tested with Kimi Code CLI 2.5.2, QCode works without a Kimi account login: anthropic with https://api.qcode.cc/api for Claude, openai with https://api.qcode.cc/openai/v1 for GPT and the Chinese models, and openai_responses with the same https://api.qcode.cc/openai/v1 for GPT. All three pass, and api_key_env reads the key from an environment variable, so the config file holds no key.
Updated 2026-11-10
Point this tool at the QCode endpoint — one key for Claude, GPT and Chinese models.
- Billed per token — live rates on /models
- Pay by card (Visa / Mastercard), Apple Pay, Google Pay or crypto
- Self-service: top up and activate instantly
Four key points: official docs and the 2026-11-10 test
All pass on CLI 2.5.2
As of 2026-11-10, tested with Kimi Code CLI 2.5.2: anthropic with https://api.qcode.cc/api (claude-haiku-5-5), openai with https://api.qcode.cc/openai/v1 (deepseek-v4-flash) and openai_responses with the same address (gpt-6.1-terra) all answered normally, and kimi login was never run.
OpenAI includes /v1; Anthropic stops at /api
Set the anthropic base_url to https://api.qcode.cc/api and the openai and openai_responses base_url to https://api.qcode.cc/openai/v1. Do not append /v1/messages, /chat/completions or /responses, and leave off any trailing slash. The official default base_url for openai and openai_responses is https://api.openai.com/v1; replace it with the QCode address.
No key in the config file
api_key_env names an environment variable that the CLI re-reads on every request; it and api_key are mutually exclusive, so set exactly one, and api_key is stored in the file as plain text. The docs are explicit: except for an explicitly declared api_key_env, the CLI does not fall back to shell environment variables for credentials, so exporting a variable on its own gives no provider its key.
CLI version as of 2026-11-10
The newest CLI changelog entry is 2.5.2 (2026-11-06), and the latest version of @moonshot-ai/kimi-code on npm is also 2.5.2; the newest desktop changelog entry is 1.3.2 (2026-11-06). This page's connection test used CLI 2.5.2.
Can Kimi Code CLI use another model API?
Yes. As of 2026-11-10, Kimi Code CLI is Moonshot AI's coding agent for the terminal; the official README says it works out of the box with Kimi models and can also be configured to use other compatible providers, and the getting-started page says that to connect Anthropic, OpenAI, Google or other providers you edit ~/.kimi-code/config.toml to configure the API key, with details on Providers and models. The type field has 6 values: kimi, anthropic, openai, openai_responses, google-genai and vertexai. QCode's three protocols map to three of them: anthropic for Claude, openai for GPT and the Chinese models, openai_responses for GPT, so one QCode key covers Claude, GPT and the Chinese families in the same tool. QCode does not offer the Gemini family; use Claude, GPT or a Chinese model instead. This page covers the CLI; Kimi Code Desktop shares the ~/.kimi-code/ directory with it (see the FAQ below). Kimi Work is a separate product; see /kimi-work-guide.
As of 2026-11-10: CLI 2.5.2 and Desktop 1.3.2, both released 2026-11-06
As of 2026-11-10, the newest Kimi Code CLI changelog entry is 2.5.2 (2026-11-06), and the latest version of @moonshot-ai/kimi-code on npm is also 2.5.2; the newest desktop changelog entry is 1.3.2 (2026-11-06). The official What's new page states that Kimi Code CLI uses ~/.kimi-code/config.toml, a format incompatible with the ~/.kimi/config.toml of the earlier kimi-cli, and that kimi migrate moves the old config, sessions and MCP declarations in one step; guides written for the old file do not apply to the current config. The same day, a test with Kimi Code CLI 2.5.2 reached QCode with all three types.
Timeline
Kimi Code CLI 2.5.2 enters the official changelog.
Kimi Code Desktop 1.3.2 enters the desktop changelog.
Tested with Kimi Code CLI 2.5.2: anthropic, openai and openai_responses all reach QCode, and kimi login is never run.
What the docs state, and what the 2026-11-10 test fills in
What the Kimi Code docs state
① type has 6 values: kimi, anthropic, openai, openai_responses, google-genai and vertexai. anthropic is for connecting to the Claude API; openai is for the OpenAI Chat Completions protocol and any third-party service compatible with it, overriding base_url as needed; openai_responses is OpenAI's newer Responses interface, always streams, and is configured the same as openai. ② Credentials: api_key and api_key_env are mutually exclusive, so set exactly one; api_key is written in the config file as plain text, and api_key_env is re-read on every request. Except for an explicitly declared api_key_env, the CLI does not fall back to shell environment variables for credentials. ③ Every model alias needs provider, model and max_context_size (at least 1); quote an alias that contains a dot, as in [models."qwen3.8-max"]; default_model must be an alias you defined. ④ The config file is created on first run; KIMI_CODE_HOME changes the data root and the file is still named config.toml; there is a single user-level config file and no project-level config mechanism. ⑤ Type /provider in the TUI to open the provider manager; kimi provider is its non-interactive equivalent in the shell; Kimi Code managed accounts from /login do not appear in /provider. ⑥ kimi -p runs one prompt non-interactively without opening the TUI; -m sets the model alias for that launch, and without it default_model is used. ⑦ kimi doctor validates config.toml and tui.toml without starting the TUI or modifying either file, exiting 0 when every checked file is valid or skipped and 1 when one is missing or invalid; /reload reloads both files. ⑧ Desktop and the CLI can be installed on the same machine and share some local configuration; ~/.kimi-code/ holds configuration, account credentials, sessions and logs, shared with the CLI.
What the docs leave open, filled in by the 2026-11-10 test
As of 2026-11-10, tested with Kimi Code CLI 2.5.2: ① No Kimi account login is needed: with only ~/.kimi-code/config.toml written and kimi login never run, all three types answered; kimi login and /login are for the Kimi Code managed service. ② Stop base_url at the prefix: anthropic with https://api.qcode.cc/api, and openai and openai_responses with https://api.qcode.cc/openai/v1, all passed, and the SDK adds the rest of the API path itself. ③ The Chinese model in this test (deepseek-v4-flash) sat on a provider of type openai, matching the QCode setup docs. ④ The config reference lists auto_session_title as a top-level field, and kimi doctor on 2.5.2 warns Unknown top-level key ignored by the v2 engine: auto_session_title. It is only a warning: the config is still valid, and you can delete that line.
A custom provider versus a /login managed account: QCode uses the first
Custom provider: write config.toml
In ~/.kimi-code/config.toml, add providers of type anthropic, openai or openai_responses, set base_url to the QCode address and point api_key_env at the environment variable that holds your key. As of 2026-11-10, tested with Kimi Code CLI 2.5.2, all three passed without kimi login; check them afterwards with kimi provider list or /provider in the TUI.
/login: the Kimi Code managed service
/login (kimi login in the shell) signs in to the Kimi Code managed service, and the docs say login configures base_url and credentials automatically; a provider of type kimi defaults to https://api.moonshot.ai/v1. These managed accounts do not appear in /provider; manage them with /login and /logout.
How to connect Kimi Code CLI to QCode
① Install: on macOS or Linux run curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash, on Windows PowerShell run irm https://code.kimi.com/kimi-code/install.ps1 | iex; the script needs no pre-installed Node.js (the README asks Windows users to install Git for Windows before the first launch). Or run npm install -g @moonshot-ai/kimi-code, which requires Node.js 22.19.0 or later. ② Edit ~/.kimi-code/config.toml and add three providers: qcode-anthropic with type anthropic and base_url https://api.qcode.cc/api; qcode-openai with type openai and base_url https://api.qcode.cc/openai/v1; qcode-responses with type openai_responses and the same base_url https://api.qcode.cc/openai/v1; give all three api_key_env with the value QCODE_API_KEY. ③ Add one alias per model: qcode-haiku points at qcode-anthropic with model claude-haiku-5-5; qcode-dsflash points at qcode-openai with model deepseek-v4-flash; qcode-terra points at qcode-responses with model gpt-6.1-terra. Give each a max_context_size (the model's own context length), then set default_model to one of the aliases. ④ export QCODE_API_KEY=cr_xxx, then run kimi -p with a short prompt and pick an alias with -m (without it default_model is used); a normal reply means it works. ⑤ Run kimi doctor to check the config files and kimi provider list to see the registered providers; after an edit, restart kimi or run /reload in the session.
Run Kimi Code CLI with one QCode key
As of 2026-11-10, one QCode API key provides both Anthropic-compatible and OpenAI-compatible endpoints, which match Kimi Code CLI's three types: Claude on anthropic with https://api.qcode.cc/api, GPT on openai or openai_responses with https://api.qcode.cc/openai/v1, and GLM, Kimi, DeepSeek and Qwen on openai. Usage is billed per token, with per-model rates on /models; common ids are claude-sonnet-5-5, claude-opus-5-5, claude-haiku-5-5, gpt-6.1-sol, gpt-6.1-terra, deepseek-v4.1-flash, glm-5.3, kimi-k3 and qwen3.8-max. For the Asia and North America access points, swap the host for asia.qcode.cc or us.qcode.cc; the path and the key stay the same. Three steps: ① register and top up (Alipay and other major payment methods are supported); ② buy a Personal Plan or a Pay-as-you-go Pack and copy your API key, which starts with cr_; ③ write ~/.kimi-code/config.toml as above; the QCode docs at https://docs.qcode.cc/en/docs/ide/kimi-code have the complete file. Not ready for a monthly plan? Pay-as-you-go Packs (/pay-as-you-go) start at $4 for a one-time quota you use within 7 days; if you already have a Personal Plan, add a booster pack when you need more quota.
Frequently asked questions
Can Kimi Code CLI use Claude?
Yes. Kimi Code CLI's custom providers support the Anthropic protocol: set type to anthropic and base_url to QCode's https://api.qcode.cc/api, and set the alias model to claude-sonnet-5-5, claude-opus-5-5 or claude-haiku-5-5 to call Claude models. As of 2026-11-10, tested with Kimi Code CLI 2.5.2, claude-haiku-5-5 answered normally. Keep Claude models on the anthropic provider; GPT and the Chinese models go on the openai provider (https://api.qcode.cc/openai/v1).
Where is config.toml, and how do I write it?
It is ~/.kimi-code/config.toml, created on first run; with KIMI_CODE_HOME set it lives in that directory and is still named config.toml, and there is no project-level config file. The file has two kinds of tables: each providers table sets type, base_url and api_key_env (or api_key, never both); each models alias sets provider, model and max_context_size. Quote an alias that contains a dot, as in [models."qwen3.8-max"], and set default_model to an alias you defined. If you would rather not edit the file by hand, use /provider in the TUI or kimi provider in the shell.
Does base_url need /v1?
For OpenAI, yes; for Anthropic, no: openai and openai_responses take https://api.qcode.cc/openai/v1, and anthropic takes https://api.qcode.cc/api. As of 2026-11-10, tested with Kimi Code CLI 2.5.2, all three values passed. Stop there: do not append /v1/messages, /chat/completions or /responses, and leave off the trailing slash, because the SDK builds the API path itself. If you get a 404, check whether base_url has a segment too many or too few.
Do I need to log in to a Kimi account?
No. As of 2026-11-10, tested with Kimi Code CLI 2.5.2, writing ~/.kimi-code/config.toml and supplying the QCode key through api_key_env was enough; kimi login was never run, and all three types answered. kimi login and /login sign in to the Kimi Code managed service, which a QCode setup does not need.
Can the Kimi Code desktop app add a custom provider?
The desktop Settings panel has a Model Providers area for managing models and providers. The official desktop docs say Kimi Code Desktop and the CLI can be installed on the same machine and share some local configuration, and that ~/.kimi-code/ holds the configuration, account credentials, sessions and logs shared with the CLI; the exact shared scope follows each product's settings and configuration files. The docs give no field-by-field desktop setup, so the steps above are the CLI config.toml route. As of 2026-11-10, the newest desktop changelog entry is 1.3.2 (2026-11-06).
How is Kimi Work different from Kimi Code?
They are two products. Kimi Work is Moonshot's local desktop agent for knowledge work, handling folders, browser automation and scheduled tasks; see /kimi-work-guide. Kimi Code is the coding tool, and this page covers connecting custom providers to its CLI in ~/.kimi-code/config.toml. To call DeepSeek, GLM, Kimi and Qwen from Claude Code, see /claude-code-deepseek-glm-kimi-qwen.
Sources
Kimi Code: the Providers and models, getting started, kimi command, environment variables, configuration overrides, What's new, CLI changelog, desktop changelog and desktop settings pages on kimi.com, the README and config-file reference of MoonshotAI/kimi-code on GitHub, and the latest version of @moonshot-ai/kimi-code on npm, all read on 2026-11-10. QCode: the Endpoints & API Paths docs, the Kimi Code CLI setup docs and the live ids on qcode.cc/models. Test: Kimi Code CLI 2.5.2, 2026-11-10.
Run Kimi Code CLI on your own key
Put one QCode API key into Kimi Code CLI custom providers: anthropic for Claude, openai for GPT and Chinese models, openai_responses for GPT; billed per token, with per-model rates on /models.
Related reading
Pay-as-you-go Packs
One-time quota packs valid for 7 days, no subscription; extra packs add to the same key
Kimi Work Guide 2026: Local Agent, Up to 300 Sub-Agents
Kimi Work is Moonshot’s local desktop agent for knowledge work: folders, WebBridge browser automation, Cron, Agent Swarm, finance data. Windows + Apple silicon. K3 needs app ≥ 3.1.0.
Claude Code with Chinese models: setup guide
One cr_ key for DeepSeek, GLM, Kimi and Qwen in Claude Code: same address, switch with /model.
Crypto payment guide
Nine coins, 56 networks, zero platform fee for AI coding API credits.
Checked on 2026-11-10 against the Kimi Code docs; the QCode setup was tested with Kimi Code CLI 2.5.2. QCode.cc is not affiliated with Moonshot AI. Menus and fields follow the version you installed, and model ids follow /models.