Command-line agents
Kimi Code
Add NoviaHub to Kimi Code CLI's config.toml as an OpenAI-compatible provider.
Kimi Code CLI is Moonshot AI’s terminal AI agent. In its own words, it runs in the terminal and helps with software development and everyday terminal work: reading and modifying code, running shell commands, searching files, fetching web pages, and planning its next steps based on feedback. It is written in TypeScript and distributed via npm.
Prerequisites
Section titled “Prerequisites”- A NoviaHub account with an API key. See API keys.
- Funds in your account. See Wallet and top-ups.
Install Kimi Code CLI
Section titled “Install Kimi Code CLI”The install script is the recommended method and doesn’t need Node.js installed first:
curl -fsSL https://code.kimi.com/kimi-code/install.sh | bashBefore the first launch, install Git for Windows; Kimi Code CLI uses its bundled Git Bash as the shell. Then run in PowerShell:
irm https://code.kimi.com/kimi-code/install.ps1 | iexInstalling with npm needs Node.js 22.19.0 or later:
npm install -g @moonshot-ai/kimi-code# orbrew install kimi-codeConfigure NoviaHub
Section titled “Configure NoviaHub”In Kimi Code CLI, a “provider” decides which protocol to use and where to connect; a “model” is an alias defined on top of a provider. The steps below add NoviaHub as a provider that uses the OpenAI Chat Completions protocol.
-
Store the key in the environment variable
NOVIAHUB_API_KEY.终端窗口 # macOS uses zsh by default; with bash on Linux, use ~/.bashrc instead of ~/.zshrcecho 'export NOVIAHUB_API_KEY="sk-..."' >> ~/.zshrcsource ~/.zshrc终端窗口 setx NOVIAHUB_API_KEY "sk-..."setxdoes not affect the current window; close the terminal and open a new one. -
Edit the config file
~/.kimi-code/config.toml. It is created automatically the first time you runkimi; if it isn’t there, create it. Add:~/.kimi-code/config.toml default_model = "noviahub/deepseek-v4-flash"[providers.noviahub]type = "openai"base_url = "https://noviahub.com/v1"api_key_env = "NOVIAHUB_API_KEY"[models."noviahub/deepseek-v4-flash"]provider = "noviahub"model = "deepseek-v4-flash"max_context_size = 1000000Setting Purpose default_modelThe model alias new sessions use. It must be defined in a [models."..."]table below. If the file already has adefault_model, change its value instead of adding a second line.typeThe protocol. openaimeans OpenAI Chat Completions.base_urlThe API address, including /v1:https://noviahub.com/v1.api_key_envWhich environment variable to read the key from. It is read again on every request. [models."noviahub/deepseek-v4-flash"]The model alias. The name contains /, so it must be quoted.providerWhich provider to use; matches [providers.noviahub]above.modelThe model ID sent to NoviaHub. It must match the model ID on NoviaHub exactly. max_context_sizeRequired. The model’s context length in tokens, shown as Context on the model’s page under Models & Pricing ( deepseek-v4-flashlisted 1,000,000 on 2026-09-28). -
Check the config file:
终端窗口 kimi doctorIt only validates
config.tomlandtui.toml; it doesn’t start the interface or change either file. -
Run
kimi. New sessions use the model set indefault_model.
Verify
Section titled “Verify”-
Send one message in non-interactive mode; the answer is printed straight to the terminal:
终端窗口 kimi -p "Introduce yourself in one sentence" -
You can also run
kimi provider listto see the configured providers. -
Check the call and its cost under Usage Logs in the NoviaHub console.
Switch and add models
Section titled “Switch and add models”- Add a model: add another
[models."<alias>"]table withproviderset tonoviahub,modelset to the NoviaHub model ID andmax_context_sizeset to that model’s context length. - Switch models: run
/modelin the interface, or pass an alias at launch, for examplekimi -m noviahub/deepseek-v4-flash. - Which models:
type = "openai"uses the Chat Completions API, so pick models that carry the Chat label under Models & Pricing. Every model on the site carried it on 2026-09-28. - Use the Responses API: Kimi Code CLI also supports
type = "openai_responses"(the OpenAI Responses API, configured the same way asopenai). Only models whose page shows the Response label work with such a provider.
/loginis only for signing in to the Kimi Code managed service or entering a Kimi Platform API key. It is not how you connect NoviaHub; editconfig.tomlas above.- Set exactly one of
api_keyandapi_key_env.api_keywrites the key into the config file in plain text, which isn’t recommended. - To keep the data directory elsewhere, set the environment variable
KIMI_CODE_HOME; the config file is then$KIMI_CODE_HOME/config.toml.
References
Section titled “References”Checked on 2026-09-28:
- Getting started (install, first launch): https://moonshotai.github.io/kimi-code/en/guides/getting-started
- Providers and models: https://moonshotai.github.io/kimi-code/en/configuration/providers
- Config file fields: https://moonshotai.github.io/kimi-code/en/configuration/config-files
kimicommand reference (-p,-m,doctor,provider list): https://moonshotai.github.io/kimi-code/en/reference/kimi-command- Kimi Code repository: https://github.com/MoonshotAI/kimi-code
- Old Kimi CLI (archived): https://github.com/MoonshotAI/kimi-cli