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