Skip to content

🤖 feat: add native Kimi K3 support via a new Moonshot AI provider#3737

Open
ibetitsmike wants to merge 4 commits into
mainfrom
mike/kimi-k3-openrouter
Open

🤖 feat: add native Kimi K3 support via a new Moonshot AI provider#3737
ibetitsmike wants to merge 4 commits into
mainfrom
mike/kimi-k3-openrouter

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Kimi K3 as a first-class built-in model backed by a new moonshotai direct provider (official @ai-sdk/moonshotai package), with aliases, token/cost metadata, a fixed thinking policy, and reasoning options matching what the model actually accepts. OpenRouter routing for Moonshot models keeps working as a gateway route.

Background

Kimi K3 is Moonshot AI's flagship open-weight reasoning model (released July 16, 2026). The first iteration of this PR registered it as an OpenRouter gateway model; per review direction it now uses the AI SDK's official Moonshot provider directly (MOONSHOT_API_KEY, api.moonshot.ai), which types K3's reasoningEffort as the literal "max".

Implementation

  • New moonshotai provider: registered in PROVIDER_DEFINITIONS (direct, createMoonshotAI), providers config schema, MOONSHOT_API_KEY env wiring, Settings key URL, provider icon, and OpenRouter routes so openrouter:moonshotai/... still canonicalizes and routes correctly.
  • KIMI_K3 registry entry is now moonshotai:kimi-k3 (aliases kimi, k3, kimi-k3); tokenizer falls back to moonshotai/kimi-k2 until K3 lands in ai-tokenizer.
  • Metadata keyed as moonshotai/kimi-k3: 1M context / 128K output, $3/M in, $15/M out, $0.30/M cache read, vision + reasoning + function calling.
  • Reasoning: exact-match isKimiK3Model() predicate; fixed ["max"] thinking policy; buildProviderOptions sends { moonshotai: { reasoningEffort: "max" } } for direct requests and the explicit OpenRouter effort: "max" payload when routed through OpenRouter (Codex round-1 fix; enabled: true alone falls back to OpenRouter's default medium effort).
  • Regenerated docs/config/models.mdx, docs/config/providers.mdx, and built-in skill content.

Validation

  • Full suite green (10023 pass; 2 unrelated WorkspaceStore timing tests flaked under load and pass in isolation); make static-check green.
  • Behavioral tests: alias resolution, direct + legacy-gateway stats/capability lookups, gateway-to-direct canonicalization, fixed policy (variant ids excluded), and exact provider-options payloads for direct vs OpenRouter-routed K3.
  • Runtime smoke test: createMoonshotAI instantiates kimi-k3 (spec v4) under our ai@7 stack.

Risks

Low-to-moderate. Registering moonshotai as a direct provider changes canonicalization of openrouter:moonshotai/* strings (they now normalize to the direct provider for metadata, and stay on OpenRouter only via explicit gateway routing). Covered by routing/normalization tests; the non-K3 OpenRouter payload path is unchanged.


Generated with mux • Model: anthropic:claude-fable-5 • Thinking: xhigh • Cost: $19.36

@mintlify

mintlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Jul 17, 2026, 5:55 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd15daa74b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/common/utils/ai/providerOptions.ts Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 9c6cf78177

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike ibetitsmike changed the title 🤖 feat: add native support for Kimi K3 via OpenRouter 🤖 feat: add native Kimi K3 support via a new Moonshot AI provider Jul 17, 2026
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 9c234f928a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike force-pushed the mike/kimi-k3-openrouter branch from 9c234f9 to eef38f9 Compare July 17, 2026 18:45
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: eef38f90f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike
ibetitsmike added this pull request to the merge queue Jul 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 17, 2026
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.

1 participant