Skip to content

Commit 98ce964

Browse files
authored
feat(auth): enable OAuth login for Kimi account (#719)
Signed-off-by: Richard Chien <[email protected]>
1 parent 540fa8e commit 98ce964

File tree

16 files changed

+118
-40
lines changed

16 files changed

+118
-40
lines changed

.github/ISSUE_TEMPLATE/1-bug-report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ body:
2626
id: plan
2727
attributes:
2828
label: Which open platform/subscription were you using?
29-
description: The one you selected when running `/setup`
29+
description: The one you selected when running `/login` or `/setup`
3030
validations:
3131
required: true
3232
- type: input
3333
id: model
3434
attributes:
3535
label: Which model were you using?
36-
description: The one you selected when running `/setup`, like `kimi-k2-turbo-preview`, `kimi-for-coding`, etc.
36+
description: The one you can see on the bottom status line, like `kimi-k2-turbo-preview`, `kimi-for-coding`, etc.
3737
- type: input
3838
id: platform
3939
attributes:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Only write entries that are worth mentioning to users.
1111

1212
## Unreleased
1313

14+
- Shell: Add `/login` and `/logout` slash commands for login and logout
15+
- CLI: Add `kimi login` and `kimi logout` subcommands
1416
- Core: Fix subagent approval request handling
1517

1618
## 0.88 (2026-01-26)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Kimi Code CLI supports [Agent Client Protocol] out of the box. You can use it to
3434

3535
[Agent Client Protocol]: https://github.com/agentclientprotocol/agent-client-protocol
3636

37-
To use Kimi Code CLI with ACP clients, make sure to run Kimi Code CLI in the terminal and send `/setup` to complete the setup first. Then, you can configure your ACP client to start Kimi Code CLI as an ACP agent server with command `kimi acp`.
37+
To use Kimi Code CLI with ACP clients, make sure to run Kimi Code CLI in the terminal and send `/login` to complete the login first. Then, you can configure your ACP client to start Kimi Code CLI as an ACP agent server with command `kimi acp`.
3838

3939
For example, to use Kimi Code CLI with [Zed](https://zed.dev/) or [JetBrains](https://blog.jetbrains.com/ai/2025/12/bring-your-own-ai-agent-to-jetbrains-ides/), add the following configuration to your `~/.config/zed/settings.json` or `~/.jetbrains/acp.json` file:
4040

docs/en/guides/getting-started.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ cd your-project
7575
kimi
7676
```
7777

78-
On first launch, you need to configure the API platform and model. Enter the `/setup` command to start the configuration wizard:
78+
On first launch, you need to configure your API source. The recommended approach is to use the `/login` command to log in to your Kimi account, which automatically configures available models:
79+
80+
```
81+
/login
82+
```
83+
84+
This will automatically open a browser. Complete the Kimi account authorization and you're ready to go. After successful login, Kimi Code CLI will automatically reload the configuration.
85+
86+
If you prefer using an API key instead, enter the `/setup` command to start the configuration wizard:
7987

8088
1. Select an API platform (e.g., Kimi Code, Moonshot AI Open Platform)
8189
2. Enter your API key

docs/en/reference/kimi-command.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,25 @@ When not specified, Kimi Code CLI automatically discovers user-level and project
144144

145145
| Subcommand | Description |
146146
|------------|-------------|
147+
| [`kimi login`](#kimi-login) | Log in to your Kimi account |
148+
| [`kimi logout`](#kimi-logout) | Log out from your Kimi account |
147149
| [`kimi info`](./kimi-info.md) | Display version and protocol information |
148150
| [`kimi acp`](./kimi-acp.md) | Start multi-session ACP server |
149151
| [`kimi mcp`](./kimi-mcp.md) | Manage MCP server configuration |
150152
| [`kimi term`](./kimi-term.md) | Launch the Toad terminal UI |
153+
154+
### `kimi login`
155+
156+
Log in to your Kimi account. This automatically opens a browser; complete account authorization and available models will be automatically configured.
157+
158+
```sh
159+
kimi login
160+
```
161+
162+
### `kimi logout`
163+
164+
Log out from your Kimi account. This clears stored OAuth credentials and removes related configuration from the config file.
165+
166+
```sh
167+
kimi logout
168+
```

docs/en/reference/slash-commands.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@ Alias: `/release-notes`
2828

2929
Open the GitHub Issues page to submit feedback.
3030

31-
## Configuration and debugging
31+
## Account and configuration
32+
33+
### `/login`
34+
35+
Log in to your Kimi account. This automatically opens a browser; complete account authorization and available models will be automatically configured. After successful login, Kimi Code CLI will automatically reload the configuration.
36+
37+
::: tip
38+
This command is only available when using the default configuration file. If a configuration was specified via `--config` or `--config-file`, this command cannot be used.
39+
:::
40+
41+
### `/logout`
42+
43+
Log out from your Kimi account. This clears stored OAuth credentials and removes related configuration from the config file. After logout, Kimi Code CLI will automatically reload the configuration.
3244

3345
### `/setup`
3446

35-
Start the configuration wizard to set up API platform and model.
47+
Start the configuration wizard to set up API platform and model using an API key.
3648

3749
Configuration flow:
3850
1. Select an API platform (Kimi Code, Moonshot AI Open Platform, etc.)

docs/en/release-notes/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This page documents the changes in each Kimi Code CLI release.
44

55
## Unreleased
66

7+
- Shell: Add `/login` and `/logout` slash commands for login and logout
8+
- CLI: Add `kimi login` and `kimi logout` subcommands
79
- Core: Fix subagent approval request handling
810

911
## 0.88 (2026-01-26)

docs/zh/guides/getting-started.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ cd your-project
7575
kimi
7676
```
7777

78-
首次启动时,你需要配置 API 平台和模型。输入 `/setup` 命令进入配置向导:
78+
首次启动时,你需要配置 API 来源。推荐使用 `/login` 命令登录 Kimi 账号,登录后会自动配置可用的模型:
79+
80+
```
81+
/login
82+
```
83+
84+
执行后会自动打开浏览器,完成 Kimi 账号授权即可。登录成功后 Kimi Code CLI 会自动重新加载配置。
85+
86+
如果你更倾向于使用 API 密钥,可以输入 `/setup` 命令进入配置向导:
7987

8088
1. 选择 API 平台(如 Kimi Code、Moonshot AI 开放平台)
8189
2. 输入你的 API 密钥

docs/zh/reference/kimi-command.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,25 @@ Thinking 模式需要模型支持。如果不指定,使用上次会话的设
144144

145145
| 子命令 | 说明 |
146146
|--------|------|
147+
| [`kimi login`](#kimi-login) | 登录 Kimi 账号 |
148+
| [`kimi logout`](#kimi-logout) | 登出 Kimi 账号 |
147149
| [`kimi info`](./kimi-info.md) | 显示版本和协议信息 |
148150
| [`kimi acp`](./kimi-acp.md) | 启动多会话 ACP 服务器 |
149151
| [`kimi mcp`](./kimi-mcp.md) | 管理 MCP 服务器配置 |
150152
| [`kimi term`](./kimi-term.md) | 启动 Toad 终端 UI |
153+
154+
### `kimi login`
155+
156+
登录 Kimi 账号。执行后会自动打开浏览器,完成账号授权后自动配置可用的模型。
157+
158+
```sh
159+
kimi login
160+
```
161+
162+
### `kimi logout`
163+
164+
登出 Kimi 账号。会清理存储的 OAuth 凭据并移除配置文件中的相关配置。
165+
166+
```sh
167+
kimi logout
168+
```

docs/zh/reference/slash-commands.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828

2929
打开 GitHub Issues 页面提交反馈。
3030

31-
## 配置与调试
31+
## 账号与配置
32+
33+
### `/login`
34+
35+
登录 Kimi 账号。执行后会自动打开浏览器,完成账号授权后自动配置可用的模型。登录成功后 Kimi Code CLI 会自动重新加载配置。
36+
37+
::: tip 提示
38+
此命令仅在使用默认配置文件时可用。如果通过 `--config``--config-file` 指定了配置,则无法使用此命令。
39+
:::
40+
41+
### `/logout`
42+
43+
登出 Kimi 账号。会清理存储的 OAuth 凭据并移除配置文件中的相关配置。登出后 Kimi Code CLI 会自动重新加载配置。
3244

3345
### `/setup`
3446

35-
启动配置向导,设置 API 平台和模型
47+
启动配置向导,通过 API 密钥配置平台和模型
3648

3749
配置流程:
3850
1. 选择 API 平台(Kimi Code、Moonshot AI 开放平台等)

0 commit comments

Comments
 (0)