Add Moonshot Kimi K3 computer-use provider#66
Conversation
Expose kimi-k3 as moonshotai:kimi-k3 (alias moonshot:), streaming through pi-ai's builtin OpenAI-compatible chat completions transport with MOONSHOT_API_KEY. Kimi grounding emits 0-1 width/height fractions, so the provider declares a fractional normalized coordinate contract and disables parallel tool calls via payload middleware. Bump pi packages to 0.80.10 for the Kimi K3 registry entry, adapting to the Models auth surface and the sessionAffinityFormat compat rename, and accept the new max thinking level in the CLI.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: K3 thinking map uses nulls
- Added a Kimi K3 route override that maps all non-max thinking levels to "max" and updated the unit test to assert the new mapping.
Or push these changes by commenting:
@cursor push d66ee77a5a
Preview (d66ee77a5a)
diff --git a/packages/ai/src/models.ts b/packages/ai/src/models.ts
--- a/packages/ai/src/models.ts
+++ b/packages/ai/src/models.ts
@@ -234,6 +234,12 @@
compat: { supportsDeveloperRole: false, sessionAffinityFormat: "openai-nosession", supportsLongCacheRetention: false },
};
}
+ if (model.provider === "moonshotai" && model.id === "kimi-k3") {
+ return {
+ ...model,
+ thinkingLevelMap: { ...model.thinkingLevelMap, off: "max", minimal: "max", low: "max", medium: "max", high: "max", xhigh: "max" },
+ };
+ }
return model;
}
diff --git a/packages/ai/test/models.test.ts b/packages/ai/test/models.test.ts
--- a/packages/ai/test/models.test.ts
+++ b/packages/ai/test/models.test.ts
@@ -87,9 +87,10 @@
expect(kimi.input).toContain("image");
expect(kimi.contextWindow).toBe(1_048_576);
expect(kimi.maxTokens).toBe(131_072);
- // K3 launched with max-only thinking effort; pi-ai clamps the rest away.
+ // K3 only accepts max reasoning effort, so every level maps to max.
expect(kimi.thinkingLevelMap?.max).toBe("max");
- expect(kimi.thinkingLevelMap?.high).toBeNull();
+ expect(kimi.thinkingLevelMap?.high).toBe("max");
+ expect(kimi.thinkingLevelMap?.low).toBe("max");
});
it("accepts the moonshot: alias for moonshotai refs", () => {You can send follow-ups to the cloud agent here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.
Reviewed by Cursor Bugbot for commit 70404a8. Configure here.
| // google:gemini-3-flash-preview GOOGLE_API_KEY | ||
| // meta:muse-spark-1.1 META_API_KEY | ||
| // xai:grok-4.5 XAI_API_KEY | ||
| // moonshotai:kimi-k3 MOONSHOT_API_KEY |
There was a problem hiding this comment.
Quickstart starves K3 thinking budget
Medium Severity
The quickstart now advertises moonshotai:kimi-k3 but still caps maxTokens at 1024. K3 always runs max-only thinking, so reasoning can consume the budget before a tool call is emitted. The integration case already raises this to 8192 for the same reason; following the documented quickstart with Kimi is likely to return text-only or truncated replies instead of a click.
Reviewed by Cursor Bugbot for commit 70404a8. Configure here.
| // google:gemini-3-flash-preview GOOGLE_API_KEY | ||
| // meta:muse-spark-1.1 META_API_KEY | ||
| // xai:grok-4.5 XAI_API_KEY | ||
| // moonshotai:kimi-k3 MOONSHOT_API_KEY |
There was a problem hiding this comment.
Example skips Moonshot payload hook
Medium Severity
Moonshot’s serial-tool constraint lives only in providerModule.onPayload (parallel_tool_calls: false), unlike Meta/xAI where the transport enforces it. The quickstart resolves a runtime spec that includes that hook, then calls cuaModels().complete without passing spec.onPayload, so the advertised Moonshot path never applies the constraint.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 70404a8. Configure here.



Summary
Adds
moonshotaias a CUA provider so Kimi K3 can drive Kernel browsers:cua -p --model moonshotai:kimi-k3 "..."(moonshot:accepted as an alias, barekimi-k3resolves too). RequiresMOONSHOT_API_KEY.How it works
kimi-k3rides pi-ai 0.80.10's builtinmoonshotaiprovider (openai-completions), whose registry entry already carries K3's compat quirks (deepseek-style thinking format, reasoning-content replay for K3's preserved-thinking-history requirement, max-only thinking effort).(0.927, 0.293)for a link centered at that exact fraction of the screenshot, consistent across repeated runs. The translator scales fractions to viewport pixels at execution.parallel_tool_calls: falsesince browser actions mutate shared state.pi bump 0.80.6 → 0.80.10
Needed for the Kimi K3 registry entry. Adaptations:
Modelsdecorators in cua-agent delegate the newcheckAuth/getAvailable/login/logoutmethods and the widenedgetAuthoverload.sendSessionIdHeadercompat flag renamed tosessionAffinityFormat.openai-responses(cua reroutes it anyway; test expectation updated).--thinkingaccepts pi's newmaxlevel (the only level K3 supports).Testing
cua-ai164,cua-agent160,cua-cli88). ptywright dist tests fail locally on main too (native build) — unrelated.update-modelsdiscovery smoke:kimi-k3emits aclickfunction call.computer-tool.integration.test.tsmoonshotaicase: canonical click with in-range fractional coordinates.e2e.live.test.ts:CuaAgentandCuaAgentHarnessboth execute browser steps against a live Kernel browser withmoonshotai:kimi-k3.kimi-k2.5/k2.6/k2.7via the discovery script (all pass the click smoke).CI uses the new org-wide
MOONSHOT_API_KEYsecret for the integration/e2e jobs.Note
Medium Risk
Touches multi-package model routing and a pi-ai bump with new live-provider CI paths; coordinate scaling and Kimi-specific thinking/tool-call behavior need correct runtime behavior.
Overview
Adds Moonshot Kimi K3 as a first-class CUA provider so agents and
cuacan runmoonshotai:kimi-k3(aliasmoonshot:, barekimi-k3) withMOONSHOT_API_KEY.In
@onkernel/cua-ai, the newmoonshotmodule follows the Meta/xAI pattern: canonical browser function tools (no native computer API), a 0–1 fractional coordinate contract with prompts/middleware, andparallel_tool_calls: false.kimi-k3is annotated inmodels.tsand uses pi-ai’s builtinopenai-completionstransport (no custom stream adapter). Auth and ref aliases are wired throughapi-keys,runtime-spec, exports, docs, and tests.@earendil-works/pi-ai/ pi-agent-core go 0.80.6 → 0.80.10 for the Kimi registry entry. AgentModelswrappers forwardcheckAuth/getAvailable/login/logoutand the widenedgetAuth; compat usessessionAffinityFormatinstead ofsendSessionIdHeader. CLI--thinkinggainsmaxfor K3.CI, README/CLI help, and update-models discovery/drift scripts include Moonshot. Workspace versions bump (cua-ai 0.7.0, cua-agent 0.7.0, cua-cli 0.5.0) with integration and live e2e coverage for Kimi.
Reviewed by Cursor Bugbot for commit 70404a8. Bugbot is set up for automated code reviews on this repo. Configure here.