Files
Plexum-kimi-provider/README.md
hzhang 01577ddfe8 feat: Plexum-kimi-provider v0.1 — Moonshot Kimi via coding endpoint
Plexum ProviderPlugin that serves Moonshot Kimi K2.6 ("Kimi for
Coding") via Kimi's Anthropic-compatible coding endpoint at
https://api.kimi.com/coding/v1/messages. Port of openclaw's
extensions/kimi-coding/provider-catalog.ts to Go + Plexum SDK.

Repo structure parallels Plexum-minimax-provider:
- internal/anthropic/    HTTP+SSE Anthropic Messages client, with new
                         UserAgent field (Kimi expects "claude-code/
                         0.1.0" — openclaw plugin parity)
- internal/translate/    canonical ↔ Anthropic translator (re-used
                         shape from MiniMax — no Kimi-specific quirks
                         needed for v1 plain-text path)
- cmd/plexum-kimi-provider-plugin/  ProviderPlugin entry

Declared models (Kimi server accepts all three; plugin normalizes
legacy aliases to the canonical id on the wire):
  kimi-for-coding      (current, default)
  kimi-code            (legacy alias)
  k2p5                 (legacy alias)

HostConfig: api_key (required), base_url (override), user_agent
(default "claude-code/0.1.0"), max_tokens_default (default 8192).

End-to-end verified against the live `sk-kimi-` subscription key:

1. CLI embedded turn 1:    "Hi there! I'm Kimi."
2. CLI embedded turn 2:    "I said hi, I'm Kimi." (multi-turn context OK)
3. Via gateway socket:     {"outcome":"text","text":"...pong"}
4. Via Fabric channel:     alice → bt2-clean → kimi agent → Kimi K2.6 →
                           outbound REST → reply in channel seq=15:
                           "Concise concurrency: goroutines and channels
                            make parallel code readable, safe, and
                            efficient without the usual threading
                            complexity."

Test the bidirectional channel pipeline works with a fresh provider:
Fabric (channel plugin) + Kimi (provider plugin) wired through Plexum
agentloop, MiniMax-style plugin packaging.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 16:23:18 +01:00

80 lines
2.1 KiB
Markdown

# Plexum-kimi-provider
Plexum ProviderPlugin that serves **Moonshot Kimi K2.6 ("Kimi for Coding")**
via Kimi's Anthropic-compatible coding endpoint
(`https://api.kimi.com/coding/v1/messages`).
Port of `openclaw/extensions/kimi-coding/provider-catalog.ts` to Go +
Plexum SDK.
## Status
**v0.1 — current**: API key auth (Kimi subscription `sk-kimi-...`),
streaming SSE, models `kimi-for-coding` / `kimi-code` / `k2p5`. Sends
`User-Agent: claude-code/0.1.0` (mirrors openclaw plugin) for parity
with Kimi's coding subscription auth path.
## Install
```bash
cd ~/Plexum-kimi-provider
./scripts/install.sh
```
Then:
1. **Write API key** to `~/.plexum/plugins/plexum-kimi-provider/config.json`:
```json
{"api_key": "sk-kimi-..."}
```
(`chmod 600` it.)
2. **Allow the plugin** in `~/.plexum/plexum.json`:
```json
{"plugins": {"allow": ["plexum-kimi-provider"]}}
```
3. **Point an agent at Kimi**:
```bash
plexum agent-add --model kimi-for-coding my-agent
```
4. **Restart** and talk:
```bash
systemctl --user restart plexum
plexum say --agent-id my-agent --session-id $(plexum new-session --agent-id my-agent) "hello"
```
## Config options
| Field | Default | Notes |
|---|---|---|
| `api_key` | (required) | `sk-kimi-...` subscription key |
| `base_url` | `https://api.kimi.com/coding` | override only if you proxy |
| `user_agent` | `claude-code/0.1.0` | matches openclaw plugin |
| `max_tokens_default` | `8192` | used when TurnRequest.MaxTokens unset |
## Model id aliases
Kimi server accepts all three; the plugin normalizes to
`kimi-for-coding` on the wire for consistent logs:
| advertised id | wire id |
|---|---|
| `kimi-for-coding` | `kimi-for-coding` |
| `kimi-code` (legacy) | `kimi-for-coding` |
| `k2p5` (legacy) | `kimi-for-coding` |
## Architecture
Same shape as `Plexum-minimax-provider`:
- `internal/anthropic/` — HTTP+SSE Messages client (now with `UserAgent`
field; can be shared by future Anthropic-compat providers)
- `internal/translate/` — canonical ↔ Anthropic translator
- `cmd/plexum-kimi-provider-plugin/` — ProviderPlugin entry
## License
Same as Plexum.