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>
This commit is contained in:
77
scripts/install.sh
Executable file
77
scripts/install.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
# Plexum-kimi-provider installer (Phase v0.1).
|
||||
#
|
||||
# Builds + installs:
|
||||
# ~/.plexum/plugins/plexum-kimi-provider/plexum-kimi-provider-plugin
|
||||
# ~/.plexum/plugins/plexum-kimi-provider/manifest.json
|
||||
#
|
||||
# Operator then writes the per-profile config:
|
||||
# ~/.plexum/plugins/plexum-kimi-provider/config.json
|
||||
# {"api_key": "sk-kimi-..."}
|
||||
#
|
||||
# Re-runnable. Profile data + config.json are never touched.
|
||||
#
|
||||
# Flags:
|
||||
# --profile <p> Override profile root (default ~/.plexum)
|
||||
set -euo pipefail
|
||||
|
||||
REPO="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
PROFILE_DIR="${HOME}/.plexum"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--profile) PROFILE_DIR="$2"; shift 2 ;;
|
||||
-h|--help) sed -n '2,/^set -euo/p' "$0" | sed -n '/^#/p' | sed 's/^# \{0,1\}//'; exit 0 ;;
|
||||
*) echo "unknown flag: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
log() { printf '\033[1;34m[kimi-install]\033[0m %s\n' "$*"; }
|
||||
command -v go >/dev/null || { echo "go not found on PATH" >&2; exit 1; }
|
||||
|
||||
PLUGIN_DIR="${PROFILE_DIR}/plugins/plexum-kimi-provider"
|
||||
mkdir -p "${PLUGIN_DIR}"
|
||||
|
||||
cd "${REPO}"
|
||||
VERSION="$(git describe --tags --always 2>/dev/null || echo dev)"
|
||||
LDFLAGS="-X main.Version=${VERSION}"
|
||||
log "building plexum-kimi-provider-plugin (v=${VERSION})"
|
||||
CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" \
|
||||
-o "${PLUGIN_DIR}/plexum-kimi-provider-plugin" \
|
||||
./cmd/plexum-kimi-provider-plugin
|
||||
|
||||
cat > "${PLUGIN_DIR}/manifest.json" <<'EOF'
|
||||
{
|
||||
"name": "plexum-kimi-provider",
|
||||
"version": "0.1.0",
|
||||
"activation": "lazy",
|
||||
"executable": "plexum-kimi-provider-plugin",
|
||||
"contracts": {
|
||||
"provider": {
|
||||
"models": ["kimi-for-coding", "kimi-code", "k2p5"]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
|
||||
[kimi-install] done.
|
||||
plugin binary: ${PLUGIN_DIR}/plexum-kimi-provider-plugin
|
||||
manifest: ${PLUGIN_DIR}/manifest.json
|
||||
models: kimi-for-coding (+ legacy aliases: kimi-code, k2p5)
|
||||
endpoint: https://api.kimi.com/coding/v1/messages
|
||||
|
||||
Next steps:
|
||||
1. Write API key:
|
||||
cat > ${PLUGIN_DIR}/config.json <<JSON
|
||||
{"api_key": "sk-kimi-..."}
|
||||
JSON
|
||||
chmod 600 ${PLUGIN_DIR}/config.json
|
||||
2. Allow plugin:
|
||||
Add "plexum-kimi-provider" to ${PROFILE_DIR}/plexum.json's
|
||||
.plugins.allow array
|
||||
3. Point an agent at Kimi:
|
||||
plexum agent-add --model kimi-for-coding <agent-id>
|
||||
4. systemctl --user restart plexum
|
||||
EOF
|
||||
Reference in New Issue
Block a user