feat: add Moonshot AI (Kimi) as native provider#25
Merged
jamiepine merged 3 commits intospacedriveapp:mainfrom Feb 20, 2026
Merged
feat: add Moonshot AI (Kimi) as native provider#25jamiepine merged 3 commits intospacedriveapp:mainfrom
jamiepine merged 3 commits intospacedriveapp:mainfrom
Conversation
3 tasks
cc1eb75 to
6e1998e
Compare
Add Moonshot AI as a new LLM provider with full ProviderConfig integration: legacy key auto-mapping, API routing (OpenAI-compatible), routing defaults (kimi-k2.5), and onboarding flow. The Kimi Coding API (api.kimi.com) requires a User-Agent: KimiCLI/1.3 header, added conditionally in call_openai when the endpoint URL contains "kimi.com". Frontend gains a Moonshot entry in the provider list with Kimi brand icon from lobehub.
… handling for moonshot.ai - Added moonshot_key to the TomlLlmConfig struct for enhanced configuration options. - Updated the user-agent header condition to include moonshot.ai endpoints alongside kimi.com for proper API requests.
9cc66f0 to
1302f6b
Compare
Member
|
I accidentally merged #26 before this PR, so I had to rebase and fix, all good. merging this too now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #24 — this PR includes those commits and adds the Moonshot provider on top.
Motivation
Moonshot AI builds Kimi, one of the most widely used AI assistants internationally. Their models (Kimi K2, Kimi K2.5) compete with frontier models at lower cost. Adding native support eliminates routing through OpenRouter (~15-20% markup).
Moonshot offers two API surfaces:
api.moonshot.ai/v1) — pay-per-token with a standard API keyapi.kimi.com/coding/v1) — subscription-based, same key, dedicated endpoint for coding workloadsBoth are supported via the
base_urlinfrastructure from #24. The web UI offers a preset selector so users can switch between Standard and Coding Plan without knowing the URLs.Changes
moonshot_key/MOONSHOT_API_KEYconfig and env varcall_openai_compatible(OpenAI-compatible format)api.moonshot.ai/v1/chat/completionsmoonshot/model prefixBreaking Changes
None. New provider — no existing behavior affected.
How to Test
Verified
Tested with a Kimi Coding Plan subscription (
sk-kimi-key). WithMOONSHOT_BASE_URLpointed at the Kimi Coding endpoint (api.kimi.com/coding/v1/chat/completions), chat completions return successfully. Using the same key against the standard Moonshot endpoint (api.moonshot.ai/v1) returns the expected authentication error — confirming the Coding Plan key is scoped to its dedicated endpoint. Endpoint preset selector in the web UI correctly switches between Standard and Coding Plan URLs.Diff stats