detached 07c0730

Document Kimi provider support

commit
07c073055da9e4475e40e2f01b146e87fb5ebc1b
author
patriceckhart · · 2026-05-05 09:04 UTC
parent
a41cda5
signature
unsigned
refs
tag: v0.1.52
1 file · +42 -9
M README.md +42 -9
@@ -5,7 +5,7 @@
55 Yet another coding agent harness, lightweight and written (vibe-slopped) in go.
66
77 - one static binary.
8-- two providers atm (anthropic, openai/codex).
8+- built-in providers for anthropic, openai/codex, kimi, and ollama/openai-compatible local models.
99 - four tools (read, write, edit, bash).
1010 - three run modes (interactive tui, print, json).
1111 - built-in telegram bot.
@@ -61,7 +61,7 @@ The easiest way is to just run `zot` and type `/login`. The TUI opens even witho
6161 ### Credential lookup order
6262
6363 1. `--api-key` flag
64-2. `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` env var
64+2. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `KIMI_API_KEY`, or `MOONSHOT_API_KEY` env var
6565 3. `$ZOT_HOME/auth.json` (API key or OAuth token; mode 0600)
6666
6767 `$ZOT_HOME` defaults to:
@@ -73,12 +73,14 @@ The easiest way is to just run `zot` and type `/login`. The TUI opens even witho
7373
7474 Run `zot` and type `/login`. Pick one of two methods:
7575
76-- **API key**: a small local web server starts on `127.0.0.1:<free-port>`, your browser opens a form, you paste your `sk-ant-...` or `sk-...` key. zot probes the provider once and saves it to `auth.json` if accepted.
77-- **Subscription**: use your Claude Pro/Max or ChatGPT Plus/Pro subscription. The OAuth flow pins the callback to a fixed port per provider (`localhost:53692` for Anthropic, `localhost:1455` for OpenAI) because those are the only ports their auth servers will redirect to.
76+- **API key**: a small local web server starts on `127.0.0.1:<free-port>`, your browser opens a form, you paste your `sk-ant-...`, `sk-...`, or Kimi/Moonshot key. zot probes the provider once and saves it to `auth.json` if accepted.
77+- **Subscription**: use your Claude Pro/Max, ChatGPT Plus/Pro, or Kimi Code subscription.
78+ - Anthropic and OpenAI pin the browser callback to fixed provider-specific ports (`localhost:53692` for Anthropic, `localhost:1455` for OpenAI) because those are the only ports their auth servers will redirect to.
7879 - Anthropic uses the Claude Code OAuth flow. Messages go to `api.anthropic.com` with a bearer token and the Claude Code identity headers.
7980 - OpenAI uses the Codex CLI OAuth flow. Messages go to `chatgpt.com/backend-api/codex/responses` with the `chatgpt-account-id` extracted from the returned id_token.
81+ - Kimi uses the Kimi Code device-code OAuth flow. zot opens the verification URL, polls until you approve it in the browser, then sends messages to `api.kimi.com/coding/v1` with the Kimi Code identity headers.
8082
81-> **Note on subscription login.** The OAuth client IDs used are the ones published in Anthropic's Claude Code CLI and OpenAI's Codex CLI. Reusing them from a third-party tool is against their terms of service and may be revoked at any time. Use it at your own risk; the API-key flow is the safe default.
83+> **Note on subscription login.** The OAuth client IDs used are the ones published in Anthropic's Claude Code CLI, OpenAI's Codex CLI, and Kimi Code CLI. Reusing them from a third-party tool may be against their terms of service and may be revoked at any time. Use it at your own risk; the API-key flow is the safe default.
8284
8385 ### Token refresh
8486
@@ -125,7 +127,7 @@ zot --help
125127
126128 | Flag | Description |
127129 |---|---|
128-| `--provider anthropic\|openai` | Pick the provider. |
130+| `--provider anthropic\|openai\|kimi\|ollama` | Pick the provider. |
129131 | `--model <id>` | Pick the model (see `--list-models`). |
130132 | `--api-key <key>` | Override the API key. |
131133 | `--base-url <url>` | Override the provider base URL (tests, self-hosted). |
@@ -179,7 +181,7 @@ Type `/` in the TUI to open the autocomplete popup. Available commands:
179181 |---|---|
180182 | `/help` | Show key bindings and commands. |
181183 | `/login` | Log in via API key or subscription (opens a dialog). |
182-| `/logout [provider]` | Clear credentials for `anthropic`, `openai`, or all when omitted. |
184+| `/logout [provider]` | Clear credentials for `anthropic`, `openai`, `kimi`, or all when omitted. `/logout kimi` also disables fallback to the official Kimi Code CLI token until you log in to Kimi through zot again. |
183185 | `/model` | Pick a model from a list (or `/model <id>` to set directly). |
184186 | `/sessions` | Resume a previous session for this directory. |
185187 | `/session` | Four ops on the current session: `export` to a portable `.zotsession` file, `import` one back in, `fork` from a past user message into a new branch, `tree` to switch between branches. Opens a picker without an argument; direct forms: `/session export [path]`, `/session import <path>`, `/session fork`, `/session tree`. Default export destination is `~/Downloads`. |
@@ -284,10 +286,41 @@ Place a `models.json` in `$ZOT_HOME` (macOS: `~/Library/Application Support/zot/
284286
285287 Supported fields per model: `id` (required), `name`, `reasoning`, `contextWindow`, `maxTokens`, `baseUrl`, `priceInput`, `priceOutput`, `priceCacheRead`, `priceCacheWrite`.
286288
287-Provider keys are normalized: `openai-codex` and `openai-responses` map to `openai`, `anthropic-messages` maps to `anthropic`.
289+Provider keys are normalized: `openai-codex` and `openai-responses` map to `openai`, `anthropic-messages` maps to `anthropic`, and `moonshot`, `moonshot-ai`, and `kimi-code` map to `kimi`.
288290
289291 User-defined models show `source: user` in `--list-models` and take precedence over both the baked-in catalog and live-discovered models. Missing or invalid files are silently ignored.
290292
293+### Kimi Code
294+
295+zot has built-in Kimi support through Kimi's OpenAI-compatible chat API.
296+
297+```bash
298+zot --provider kimi
299+```
300+
301+By default this uses:
302+
303+- model: `kimi-for-coding`
304+- base URL: `https://api.kimi.com/coding/v1`
305+
306+Credential lookup order for Kimi:
307+
308+1. `--api-key`
309+2. `KIMI_API_KEY`
310+3. `MOONSHOT_API_KEY`
311+4. `$ZOT_HOME/auth.json`
312+5. the official Kimi Code CLI token at `~/.kimi/credentials/kimi-code.json`, unless disabled by `/logout kimi`
313+
314+Use `/login` for either API-key login or Kimi Code subscription login. The subscription flow uses Kimi Code's device-code OAuth flow: zot opens the verification URL, waits for browser approval, stores the token in `auth.json`, and refreshes it automatically.
315+
316+For direct Moonshot API keys or a custom compatible endpoint:
317+
318+```bash
319+zot --provider kimi --model kimi-k2-0905-preview --base-url https://api.moonshot.ai/v1 --api-key "$KIMI_API_KEY"
320+```
321+
322+You can add additional Kimi/Moonshot model IDs to `models.json` under the `kimi` provider.
323+
291324 ### Local models with ollama
292325
293326 zot works with [ollama](https://ollama.com) out of the box. Ollama serves an OpenAI-compatible API locally, so any model you have pulled works with zot.
@@ -495,7 +528,7 @@ internal/agent/tools/ read, write, edit, bash, sandbox
495528 internal/auth/ credential store, api-key probe, oauth, login server
496529 internal/core/ agent loop, sessions, cost tracking
497530 internal/extproto/ extension wire-format types
498-internal/provider/ anthropic + openai streaming clients, model catalog
531+internal/provider/ anthropic + openai-compatible streaming clients, model catalog
499532 internal/skills/ skill discovery, frontmatter parser, skill tool
500533 internal/tui/ terminal raw-mode, input parser, editor, renderer, markdown, view
501534 pkg/zotcore/ public Go SDK for embedding zot in-process
@@ -5,7 +5,7 @@
5 Yet another coding agent harness, lightweight and written (vibe-slopped) in go.5 Yet another coding agent harness, lightweight and written (vibe-slopped) in go.
6 6
7 - one static binary.7 - one static binary.
8-- two providers atm (anthropic, openai/codex).8+- built-in providers for anthropic, openai/codex, kimi, and ollama/openai-compatible local models.
9 - four tools (read, write, edit, bash).9 - four tools (read, write, edit, bash).
10 - three run modes (interactive tui, print, json).10 - three run modes (interactive tui, print, json).
11 - built-in telegram bot.11 - built-in telegram bot.
@@ -61,7 +61,7 @@ The easiest way is to just run `zot` and type `/login`. The TUI opens even witho
61 ### Credential lookup order61 ### Credential lookup order
62 62
63 1. `--api-key` flag63 1. `--api-key` flag
64-2. `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` env var64+2. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `KIMI_API_KEY`, or `MOONSHOT_API_KEY` env var
65 3. `$ZOT_HOME/auth.json` (API key or OAuth token; mode 0600)65 3. `$ZOT_HOME/auth.json` (API key or OAuth token; mode 0600)
66 66
67 `$ZOT_HOME` defaults to:67 `$ZOT_HOME` defaults to:
@@ -73,12 +73,14 @@ The easiest way is to just run `zot` and type `/login`. The TUI opens even witho
73 73
74 Run `zot` and type `/login`. Pick one of two methods:74 Run `zot` and type `/login`. Pick one of two methods:
75 75
76-- **API key**: a small local web server starts on `127.0.0.1:<free-port>`, your browser opens a form, you paste your `sk-ant-...` or `sk-...` key. zot probes the provider once and saves it to `auth.json` if accepted.76+- **API key**: a small local web server starts on `127.0.0.1:<free-port>`, your browser opens a form, you paste your `sk-ant-...`, `sk-...`, or Kimi/Moonshot key. zot probes the provider once and saves it to `auth.json` if accepted.
77-- **Subscription**: use your Claude Pro/Max or ChatGPT Plus/Pro subscription. The OAuth flow pins the callback to a fixed port per provider (`localhost:53692` for Anthropic, `localhost:1455` for OpenAI) because those are the only ports their auth servers will redirect to.77+- **Subscription**: use your Claude Pro/Max, ChatGPT Plus/Pro, or Kimi Code subscription.
78+ - Anthropic and OpenAI pin the browser callback to fixed provider-specific ports (`localhost:53692` for Anthropic, `localhost:1455` for OpenAI) because those are the only ports their auth servers will redirect to.
78 - Anthropic uses the Claude Code OAuth flow. Messages go to `api.anthropic.com` with a bearer token and the Claude Code identity headers.79 - Anthropic uses the Claude Code OAuth flow. Messages go to `api.anthropic.com` with a bearer token and the Claude Code identity headers.
79 - OpenAI uses the Codex CLI OAuth flow. Messages go to `chatgpt.com/backend-api/codex/responses` with the `chatgpt-account-id` extracted from the returned id_token.80 - OpenAI uses the Codex CLI OAuth flow. Messages go to `chatgpt.com/backend-api/codex/responses` with the `chatgpt-account-id` extracted from the returned id_token.
81+ - Kimi uses the Kimi Code device-code OAuth flow. zot opens the verification URL, polls until you approve it in the browser, then sends messages to `api.kimi.com/coding/v1` with the Kimi Code identity headers.
80 82
81-> **Note on subscription login.** The OAuth client IDs used are the ones published in Anthropic's Claude Code CLI and OpenAI's Codex CLI. Reusing them from a third-party tool is against their terms of service and may be revoked at any time. Use it at your own risk; the API-key flow is the safe default.83+> **Note on subscription login.** The OAuth client IDs used are the ones published in Anthropic's Claude Code CLI, OpenAI's Codex CLI, and Kimi Code CLI. Reusing them from a third-party tool may be against their terms of service and may be revoked at any time. Use it at your own risk; the API-key flow is the safe default.
82 84
83 ### Token refresh85 ### Token refresh
84 86
@@ -125,7 +127,7 @@ zot --help
125 127
126 | Flag | Description |128 | Flag | Description |
127 |---|---|129 |---|---|
128-| `--provider anthropic\|openai` | Pick the provider. |130+| `--provider anthropic\|openai\|kimi\|ollama` | Pick the provider. |
129 | `--model <id>` | Pick the model (see `--list-models`). |131 | `--model <id>` | Pick the model (see `--list-models`). |
130 | `--api-key <key>` | Override the API key. |132 | `--api-key <key>` | Override the API key. |
131 | `--base-url <url>` | Override the provider base URL (tests, self-hosted). |133 | `--base-url <url>` | Override the provider base URL (tests, self-hosted). |
@@ -179,7 +181,7 @@ Type `/` in the TUI to open the autocomplete popup. Available commands:
179 |---|---|181 |---|---|
180 | `/help` | Show key bindings and commands. |182 | `/help` | Show key bindings and commands. |
181 | `/login` | Log in via API key or subscription (opens a dialog). |183 | `/login` | Log in via API key or subscription (opens a dialog). |
182-| `/logout [provider]` | Clear credentials for `anthropic`, `openai`, or all when omitted. |184+| `/logout [provider]` | Clear credentials for `anthropic`, `openai`, `kimi`, or all when omitted. `/logout kimi` also disables fallback to the official Kimi Code CLI token until you log in to Kimi through zot again. |
183 | `/model` | Pick a model from a list (or `/model <id>` to set directly). |185 | `/model` | Pick a model from a list (or `/model <id>` to set directly). |
184 | `/sessions` | Resume a previous session for this directory. |186 | `/sessions` | Resume a previous session for this directory. |
185 | `/session` | Four ops on the current session: `export` to a portable `.zotsession` file, `import` one back in, `fork` from a past user message into a new branch, `tree` to switch between branches. Opens a picker without an argument; direct forms: `/session export [path]`, `/session import <path>`, `/session fork`, `/session tree`. Default export destination is `~/Downloads`. |187 | `/session` | Four ops on the current session: `export` to a portable `.zotsession` file, `import` one back in, `fork` from a past user message into a new branch, `tree` to switch between branches. Opens a picker without an argument; direct forms: `/session export [path]`, `/session import <path>`, `/session fork`, `/session tree`. Default export destination is `~/Downloads`. |
@@ -284,10 +286,41 @@ Place a `models.json` in `$ZOT_HOME` (macOS: `~/Library/Application Support/zot/
284 286
285 Supported fields per model: `id` (required), `name`, `reasoning`, `contextWindow`, `maxTokens`, `baseUrl`, `priceInput`, `priceOutput`, `priceCacheRead`, `priceCacheWrite`.287 Supported fields per model: `id` (required), `name`, `reasoning`, `contextWindow`, `maxTokens`, `baseUrl`, `priceInput`, `priceOutput`, `priceCacheRead`, `priceCacheWrite`.
286 288
287-Provider keys are normalized: `openai-codex` and `openai-responses` map to `openai`, `anthropic-messages` maps to `anthropic`.289+Provider keys are normalized: `openai-codex` and `openai-responses` map to `openai`, `anthropic-messages` maps to `anthropic`, and `moonshot`, `moonshot-ai`, and `kimi-code` map to `kimi`.
288 290
289 User-defined models show `source: user` in `--list-models` and take precedence over both the baked-in catalog and live-discovered models. Missing or invalid files are silently ignored.291 User-defined models show `source: user` in `--list-models` and take precedence over both the baked-in catalog and live-discovered models. Missing or invalid files are silently ignored.
290 292
293+### Kimi Code
294+
295+zot has built-in Kimi support through Kimi's OpenAI-compatible chat API.
296+
297+```bash
298+zot --provider kimi
299+```
300+
301+By default this uses:
302+
303+- model: `kimi-for-coding`
304+- base URL: `https://api.kimi.com/coding/v1`
305+
306+Credential lookup order for Kimi:
307+
308+1. `--api-key`
309+2. `KIMI_API_KEY`
310+3. `MOONSHOT_API_KEY`
311+4. `$ZOT_HOME/auth.json`
312+5. the official Kimi Code CLI token at `~/.kimi/credentials/kimi-code.json`, unless disabled by `/logout kimi`
313+
314+Use `/login` for either API-key login or Kimi Code subscription login. The subscription flow uses Kimi Code's device-code OAuth flow: zot opens the verification URL, waits for browser approval, stores the token in `auth.json`, and refreshes it automatically.
315+
316+For direct Moonshot API keys or a custom compatible endpoint:
317+
318+```bash
319+zot --provider kimi --model kimi-k2-0905-preview --base-url https://api.moonshot.ai/v1 --api-key "$KIMI_API_KEY"
320+```
321+
322+You can add additional Kimi/Moonshot model IDs to `models.json` under the `kimi` provider.
323+
291 ### Local models with ollama324 ### Local models with ollama
292 325
293 zot works with [ollama](https://ollama.com) out of the box. Ollama serves an OpenAI-compatible API locally, so any model you have pulled works with zot.326 zot works with [ollama](https://ollama.com) out of the box. Ollama serves an OpenAI-compatible API locally, so any model you have pulled works with zot.
@@ -495,7 +528,7 @@ internal/agent/tools/ read, write, edit, bash, sandbox
495 internal/auth/ credential store, api-key probe, oauth, login server528 internal/auth/ credential store, api-key probe, oauth, login server
496 internal/core/ agent loop, sessions, cost tracking529 internal/core/ agent loop, sessions, cost tracking
497 internal/extproto/ extension wire-format types530 internal/extproto/ extension wire-format types
498-internal/provider/ anthropic + openai streaming clients, model catalog531+internal/provider/ anthropic + openai-compatible streaming clients, model catalog
499 internal/skills/ skill discovery, frontmatter parser, skill tool532 internal/skills/ skill discovery, frontmatter parser, skill tool
500 internal/tui/ terminal raw-mode, input parser, editor, renderer, markdown, view533 internal/tui/ terminal raw-mode, input parser, editor, renderer, markdown, view
501 pkg/zotcore/ public Go SDK for embedding zot in-process534 pkg/zotcore/ public Go SDK for embedding zot in-process

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close