Skip to content

feat(models): add kimi-k3 - #3092

Merged
steebchen merged 1 commit into
mainfrom
feat/add-kimi-k3
Jul 16, 2026
Merged

steebchen merged 1 commit into
mainfrom
feat/add-kimi-k3

Conversation

@smakosh

@smakosh smakosh commented Jul 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds Moonshot's Kimi K3 flagship model to the catalogue, released today (2026-07-16). Docs: pricing, quickstart, thinking effort, tool choice.

Model definition (packages/models)

  • kimi-k3 on the moonshot provider (same api.moonshot.ai/v1 endpoint)
  • 1,048,576-token context window and max output (per docs, max_completion_tokens can be set up to 1048576)
  • $3.00/M input (cache miss), $0.30/M cached input (cache hit), $15.00/M output — lands in the premium fair-use category automatically via the $15/M output threshold
  • reasoning: true with reasoningEfforts: ["max"] — K3 always thinks; effort is set via the top-level reasoning_effort field which currently accepts only "max" (more levels announced as coming)
  • Vision (images + video input), tools with all tool_choice modes (auto/none/required/named function — K3 lifts the K2-era forced-tool-choice restriction), strict JSON schema output, streaming with separate reasoning_content deltas
  • supportedParameters excludes temperature/top_p/penalties (K3 fixes them at 1.0/0.95/0), so the gateway strips them instead of forwarding

Gateway request mapping (packages/actions)

K3's API differs from the K2 generation in two ways, handled in the moonshot case of prepareRequestBody:

  • reasoning_effort is forwarded natively for K3 (K2-era models get the binary thinking: { type } toggle, which K3 does not accept); disable requests (none/minimal) collapse onto the provider default since K3 cannot turn thinking off
  • max_tokens is translated to max_completion_tokens (the only output-cap parameter K3 documents)

Unit tests added for all three behaviors.

Models directory (packages/shared)

  • Added kimi-k3 to the curated coding category
  • Marked closed-source: API-only at launch with no published weights, while the moonshot family otherwise defaults to open-source

Testing

  • pnpm exec vitest run packages/actions packages/models packages/shared/src/model-categories.spec.ts — all pass (including 3 new K3 tests)
  • pnpm build — 17/17 tasks successful
  • Live verification not possible locally (no LLM_MOONSHOT_API_KEY in local env); behavior is per the official K3 docs and should be smoke-tested once deployed with a key

https://claude.ai/code/session_01XETTwBHG4TF4gHDFR4VU2G

Summary by CodeRabbit

  • New Features
    • Added support for the Kimi K3 model, including a 1M-token context window, vision, tools, streaming, JSON output, and reasoning capabilities.
    • Added Kimi K3 to the coding model category.
    • Added native reasoning controls and optimized token handling for Kimi K3.
  • Bug Fixes
    • Corrected token limit mapping for Kimi K3 requests.
    • Ensured disabled or unspecified reasoning uses provider defaults.

Add Moonshot's Kimi K3 flagship model (released 2026-07-16):

- 1M-token context window (1,048,576) with matching max output
- $3.00/M input, $0.30/M cached input, $15.00/M output
- Always-on thinking configured via the native top-level
  reasoning_effort field (currently only "max"), unlike the K2-era
  binary thinking toggle; the moonshot handler now forwards the
  effort as-is for K3 and collapses disable requests onto the
  provider default
- K3 documents max_completion_tokens (not max_tokens), so translate
- Vision, tools (all tool_choice modes), strict JSON schema output
- Curated into the coding category; marked closed-source (API-only
  at launch, no open weights published)

Claude-Session: https://claude.ai/code/session_01XETTwBHG4TF4gHDFR4VU2G
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds Kimi K3 to Moonshot model metadata and model-directory categories. Its request builder maps token limits to max_completion_tokens and forwards supported reasoning settings, with tests covering these behaviors.

Changes

Kimi K3 Moonshot integration

Layer / File(s) Summary
Model registration and categorization
packages/models/src/models/moonshot.ts, packages/shared/src/components/models-directory/model-category-filters.ts
Registers Kimi K3 with its capabilities, pricing, limits, and supported parameters, then adds it to the coding and closed-source model sets.
Provider request translation
packages/actions/src/prepare-request-body.ts
Maps Kimi K3 max_tokens to max_completion_tokens and forwards active reasoning_effort natively while retaining existing handling for other Moonshot models.
Request-body validation
packages/actions/src/prepare-request-body.spec.ts
Tests Kimi K3 reasoning-effort behavior, default handling for "none", and completion-token mapping; extends the helper to accept maxTokens.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: steebchen, ratchaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: adding kimi-k3.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/add-kimi-k3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/actions/src/prepare-request-body.ts (1)

2013-2013: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Defensively support future Kimi K3 variants.

Consider using .startsWith("kimi-k3") instead of an exact match. This ensures that future variants (e.g., kimi-k3-turbo or kimi-k3.5) automatically inherit the max_completion_tokens mapping and native reasoning_effort routing without requiring further updates to this conditional logic, similar to how gpt-5 models are handled above.

💡 Proposed refactor
-			const isKimiK3 = usedInternalModel === "kimi-k3";
+			const isKimiK3 = usedInternalModel.startsWith("kimi-k3");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/actions/src/prepare-request-body.ts` at line 2013, Update the
isKimiK3 check in the request-body preparation logic to use a prefix match for
model names beginning with “kimi-k3” rather than an exact equality check, so
variants such as kimi-k3-turbo receive the same token mapping and reasoning
routing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/actions/src/prepare-request-body.ts`:
- Line 2013: Update the isKimiK3 check in the request-body preparation logic to
use a prefix match for model names beginning with “kimi-k3” rather than an exact
equality check, so variants such as kimi-k3-turbo receive the same token mapping
and reasoning routing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8ac59a0d-cadd-410d-b08f-55f5bfa233c7

📥 Commits

Reviewing files that changed from the base of the PR and between e9f65de and 1d7630b.

📒 Files selected for processing (4)
  • packages/actions/src/prepare-request-body.spec.ts
  • packages/actions/src/prepare-request-body.ts
  • packages/models/src/models/moonshot.ts
  • packages/shared/src/components/models-directory/model-category-filters.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants