Skip to Content
aicentos

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).

The configuration file lives at ~/.kimi/config.toml by default and is created automatically the first time Kimi Code runs.

Configuration to fill in

FieldValue
provider typeopenai_legacy (Chat Completions protocol)
base_urlhttps://aicentos.com/v1
api_keyThe key created in the console
modelA 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_model refers 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 /provider in 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_key field > the [providers.<name>.env] sub-table > a startup error. Except for openai_legacy / openai_responses, credentials in the configuration file are not auto-filled from shell environment variables.
  • type = "kimi" is for Moonshot's official endpoint; use openai_legacy or openai_responses for aicentos.
  • Do not set max_context_size below 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/completions path.
  • Model names follow the Model Gallery in the console (see Supported models).