pi-provider-kimi-code 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +66 -0
  2. package/index.ts +13 -4
  3. package/package.json +3 -2
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # pi-provider-kimi-code
2
+
3
+ [![npm](https://img.shields.io/npm/v/pi-provider-kimi-code)](https://www.npmjs.com/package/pi-provider-kimi-code)
4
+
5
+ A [pi-coding-agent](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent) custom provider extension that adds [Kimi Code](https://kimi.com) models with OAuth device-code login.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pi install npm:pi-provider-kimi-code
11
+ ```
12
+
13
+ Or load without installing:
14
+
15
+ ```bash
16
+ pi -e /path/to/pi-provider-kimi-code
17
+ ```
18
+
19
+ ## Authentication
20
+
21
+ ### OAuth (recommended)
22
+
23
+ Inside pi, run:
24
+
25
+ ```
26
+ /login kimi-coding
27
+ ```
28
+
29
+ This starts the device-code flow — a browser window opens, you authorize, and credentials are stored automatically.
30
+
31
+ ### API Key
32
+
33
+ Set the `KIMI_API_KEY` environment variable:
34
+
35
+ ```bash
36
+ KIMI_API_KEY=sk-... pi
37
+ ```
38
+
39
+ ## Models
40
+
41
+ | ID | Name | Reasoning | Input | Context | Max Output |
42
+ |--------------------|------------------|-----------|-------------|----------|------------|
43
+ | `kimi-k2-thinking` | Kimi K2 Thinking | yes | text | 262 144 | 32 768 |
44
+ | `k2p5` | Kimi K2.5 | yes | text, image | 262 144 | 32 768 |
45
+
46
+ Select a model inside pi:
47
+
48
+ ```
49
+ /model kimi-coding/kimi-k2-thinking
50
+ ```
51
+
52
+ ## How It Works
53
+
54
+ - Registers provider `kimi-coding` with base URL `https://api.kimi.com/coding`
55
+ - Uses `api: "anthropic-messages"` — Kimi's API is wire-compatible with the Anthropic Messages format, so no custom streaming logic is needed
56
+ - OAuth uses [RFC 8628](https://datatracker.ietf.org/doc/html/rfc8628) device authorization grant against `https://auth.kimi.com`
57
+ - Zero dependencies — types from `@mariozechner/pi-ai` and `@mariozechner/pi-coding-agent` are provided by the pi runtime
58
+ - Zero build step — pi loads TypeScript directly via jiti
59
+
60
+ ## Credits
61
+
62
+ This extension is based on the OAuth implementation from [kimi-cli](https://github.com/MoonshotAI/kimi-cli) by Moonshot AI.
63
+
64
+ ## License
65
+
66
+ MIT
package/index.ts CHANGED
@@ -277,16 +277,16 @@ export default function (pi: ExtensionAPI) {
277
277
 
278
278
  models: [
279
279
  {
280
- id: "kimi-k2-thinking",
281
- name: "Kimi K2 Thinking",
280
+ id: "kimi-code",
281
+ name: "Kimi Code (powered by kimi-k2.5)",
282
282
  reasoning: true,
283
- input: ["text"],
283
+ input: ["text", "image"],
284
284
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
285
285
  contextWindow: 262144,
286
286
  maxTokens: 32768,
287
287
  },
288
288
  {
289
- id: "k2p5",
289
+ id: "kimi-k2.5",
290
290
  name: "Kimi K2.5",
291
291
  reasoning: true,
292
292
  input: ["text", "image"],
@@ -294,6 +294,15 @@ export default function (pi: ExtensionAPI) {
294
294
  contextWindow: 262144,
295
295
  maxTokens: 32768,
296
296
  },
297
+ {
298
+ id: "kimi-k2-thinking-turbo",
299
+ name: "Kimi K2 Thinking Turbo",
300
+ reasoning: true,
301
+ input: ["text"],
302
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
303
+ contextWindow: 262144,
304
+ maxTokens: 32768,
305
+ },
297
306
  ],
298
307
 
299
308
  oauth: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-provider-kimi-code",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "pi custom provider extension for Kimi Code models with OAuth device-code login",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,7 +18,8 @@
18
18
  ],
19
19
  "files": [
20
20
  "index.ts",
21
- "package.json"
21
+ "package.json",
22
+ "README.md"
22
23
  ],
23
24
  "scripts": {
24
25
  "clean": "echo 'nothing to clean'",