openclaw/extensions/kimi-coding
Peter Steinberger 4fe4725efa
refactor(providers): deslop provider plumbing
## What Problem This Solves

Provider plugins and their runtime glue still repeat small pieces of auth resolution, catalog defaults, stream construction, and validation that already have shared owners.

## User Impact

No user-visible behavior change is intended. Provider requests, credential precedence, catalog contents, usage, failover classification, and error text retain their existing contracts.

## Why This Change Was Made

- Reuse the existing C0/DEL predicate in failover command validation.
- Resolve catalog environment/config auth through one private helper while preserving the API-key resolver's direct-first order and the full-auth resolver's profile-first order and lazy store access.
- Use shared catalog request headers in Chutes, DeepInfra, and Kilo, and the identical manifest-owned Kimi default.
- Use the existing assistant envelope builder in Bedrock and Google, the timeout owner in OpenRouter music streaming, and one equivalent final-visible-text validation in Ollama.
- Reuse prepared route-fact inheritance and inline a single-use stream-handle forwarding closure.

Measured reduction: 54 net production lines. Existing boundary tests are retained; no new tests or dependencies are added.

## Evidence

- Independent Codex review: no actionable P0-P2 findings. Follow-up source context confirmed that Ollama's pending value is the entire sanitized response and that the single check covers the effective final text.
- `git diff --check` passes.
- Blacksmith Testbox: full touched-provider selection passed 1,868 tests in 112 files; plugin contracts passed 1,153 tests in 48 files, plus focused core, manifest-auth and string-normalization suites. Runtime proof is retained across type-only corrections.
- Final source tree `fd8c8933094d864d57153d139433ffb086fc6006`: core TypeScript passes; both cycle checks report zero. `check-changed` passed its guards, import boundaries and core types, then the SSH connection ended with exit 255 during core-test types. Remaining hosted checks are the exact-head gate.
- The final patch does not expand the Plugin SDK. The separate API comparison did not execute after the interrupted remote gate.
2026-10-01 02:18:11 +00:00
..
assets improve(plugins): give bundled logos consistent white icon tiles (#155259) 2026-09-23 19:09:26 -07:00
api.ts
implicit-provider.test.ts test(plugins,net-policy): remove low-value tests (batch d046) (#159181) 2026-09-26 21:51:57 +00:00
index.test.ts refactor(providers): deslop model-provider plugins fifth pass (#161903) 2026-09-30 07:02:48 -07:00
index.ts refactor(providers): deslop provider plumbing 2026-10-01 02:18:11 +00:00
kimi-coding.live.test.ts refactor(models): preserve selected identities and centralize thinking policy (#150509) 2026-09-16 20:18:50 -07:00
onboard.test.ts test(plugins,net-policy): remove low-value tests (batch d046) (#159181) 2026-09-26 21:51:57 +00:00
onboard.ts refactor(providers): deslop small provider plugins (#158437) 2026-09-26 00:32:31 -07:00
openclaw.plugin.json feat(models): use the v2 catalog and price each route by who bills it (#156535) 2026-09-24 21:20:57 +05:30
package.json chore(release): close out 2026.9.7 on main (#161587) 2026-09-29 22:39:14 -07:00
provider-catalog.test.ts test(plugins,net-policy): remove low-value tests (batch d046) (#159181) 2026-09-26 21:51:57 +00:00
provider-catalog.ts
provider-policy-api.ts
README.md
stream.test.ts test(plugins,net-policy): remove low-value tests (batch d046) (#159181) 2026-09-26 21:51:57 +00:00
stream.ts refactor(providers): deslop model-provider plugins fifth pass (#161903) 2026-09-30 07:02:48 -07:00
tsconfig.json

OpenClaw Kimi Coding Provider

Official OpenClaw provider plugin for Kimi Coding.

Install from OpenClaw:

openclaw plugins install @openclaw/kimi-provider
openclaw gateway restart

See https://docs.openclaw.ai/providers/moonshot for setup and configuration.

Quota errors

Kimi can return HTTP 403 when a weekly usage limit is exhausted. OpenClaw treats explicit weekly, seven-day, or quota-reset errors as rate limits. Wait for the provider's quota window to reset or use another configured provider; replacing a valid API key does not restore quota. Invalid keys and access restrictions keep their authentication error handling.

Catalog notes

Model rows live in openclaw.plugin.json under modelCatalog.providers.kimi.

  • k3 serves up to 1M context, tier-gated server-side; k3-256k is the cheaper 256K variant of the same weights. Both point at moonshot/kimi-k3 through upstreamModel, which keeps their compat capability tiers aligned with the moonshot catalog for the same model.
  • Legacy k3[1m] was retired upstream and normalizes to k3 for shipped configurations.
  • KIMI_K3_MODEL_IDS in provider-policy-api.ts must cover exactly the catalog rows that carry a K3 thinkingLevelMap; provider-catalog.test.ts asserts it.