Kimi
Use aicentos in Kimi Code CLI — register an OpenAI-compatible provider through config.toml
Last updated:
Kimi Code CLI lets you register any OpenAI-compatible service as a provider. Point base_url at aicentos and fill in the API Key, and the models aicentos offers become callable straight from the terminal interface.
Prerequisites
First create a dedicated key for Kimi Code on the console's "API Keys" page (naming it kimi-cli makes usage easier to track).
- Console: https://aicentos.com
- Create a key: https://aicentos.com/keys
- Top up when the balance runs out: https://aicentos.com/wallet
- Docs site: https://docs.aicentos.com
The configuration file lives at ~/.kimi/config.toml by default and is created automatically the first time Kimi Code runs.
Configuration to fill in
| Field | Value |
|---|---|
| provider type | openai_legacy (Chat Completions protocol) |
| base_url | https://aicentos.com/v1 |
| api_key | The key created in the console |
| model | A model name from the Model Gallery in the console |
If the aicentos side uses the Responses protocol, switch the type to openai_responses.
Setup steps
Open ~/.kimi/config.toml and append a custom provider plus a model alias:
default_model = "aicentos-gpt-4o"
[providers.aicentos]
type = "openai_legacy"
base_url = "https://aicentos.com/v1"
api_key = "sk-your-key"
[models.aicentos-gpt-4o]
provider = "aicentos"
model = "gpt-4o"
max_context_size = 128000- The provider name (
aicentos) and the model alias (aicentos-gpt-4o) are both customizable;default_modelrefers to the alias, not the server-side model ID. - If the alias contains a
.(e.g.gpt-4.1), it must be quoted in TOML:[models."gpt-4.1"], otherwise the.is parsed as a table separator. - If you would rather not hand-write TOML, type
/providerin the TUI to open the provider manager, press Enter on the[ Add New Platform ]line and follow the wizard.
Environment variables alone also work (for the openai_legacy / openai_responses types):
export OPENAI_BASE_URL="https://aicentos.com/v1"
export OPENAI_API_KEY="sk-your-key"Test
Start kimi and send a simple prompt in the TUI; a normal response means the integration works. Use /model to confirm the alias you just configured is selected.
Notes
- Provider credentials are resolved in the order: the
api_keyfield > the[providers.<name>.env]sub-table > a startup error. Except foropenai_legacy/openai_responses, credentials in the configuration file are not auto-filled from shell environment variables. type = "kimi"is for Moonshot's official endpoint; useopenai_legacyoropenai_responsesfor aicentos.- Do not set
max_context_sizebelow the model's actual window; a value that is too small triggers context compaction early. - The Base URL only goes up to
/v1; do not extend it to the full/v1/chat/completionspath. - Model names follow the Model Gallery in the console (see Supported models).