feat: add Kimi/Moonshot and Opencode provider support#933
Open
putueddy wants to merge 2 commits intosipeed:mainfrom
Open
feat: add Kimi/Moonshot and Opencode provider support#933putueddy wants to merge 2 commits intosipeed:mainfrom
putueddy wants to merge 2 commits intosipeed:mainfrom
Conversation
- Add "kimi", "kimi-code", "moonshot" provider cases in factory.go with default API base https://api.kimi.com/coding/v1 - Add Kimi Code API User-Agent header (KimiCLI/0.77) for api.kimi.com - Add "opencode" provider with default API base https://opencode.ai/zen/v1 - Add "opencode" to recognized HTTP-compatible protocols in factory_provider - Add Opencode field to ProvidersConfig, IsEmpty, HasProvidersConfig - Add opencode migration entry in ConvertProvidersToModelList - Update moonshot fallback API base from api.moonshot.cn to api.kimi.com
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for additional OpenAI-compatible providers (Kimi/Moonshot and Opencode) across provider selection, defaults, and legacy-config migration so users can configure these backends similarly to existing HTTP-compat providers.
Changes:
- Add Kimi/Moonshot aliases in provider selection and set a Kimi Code-specific
User-Agentforapi.kimi.comrequests. - Add
opencodeas a supported protocol/provider with a default API base (https://opencode.ai/zen/v1). - Extend legacy
providersconfig + migration (ConvertProvidersToModelList) to includeproviders.opencode.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/providers/openai_compat/provider.go | Adds Kimi Code User-Agent header behavior for Kimi endpoints. |
| pkg/providers/factory_provider.go | Registers opencode as an OpenAI-compatible protocol and adds its default API base. |
| pkg/providers/factory.go | Extends legacy provider selection to recognize opencode and Kimi/Moonshot aliases; adjusts moonshot default base behavior. |
| pkg/config/migration.go | Migrates legacy providers.opencode into model_list. |
| pkg/config/config.go | Adds Opencode to ProvidersConfig and includes it in IsEmpty() / HasProvidersConfig(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Allow APIBase-only config for opencode provider selection (like VLLM) - Keep moonshot provider on moonshot.cn/v1 default, only use kimi.com/coding/v1 for kimi/kimi-code - Use url.Parse hostname match for Kimi User-Agent check instead of strings.Contains - Add opencode to DefaultAPIBase test cases in factory_provider_test.go - Add opencode migration tests (full config + APIBase-only) in migration_test.go - Update AllProviders test count to include opencode (18 -> 19) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
"kimi","kimi-code","moonshot"as recognized provider names inresolveProviderSelection(), with default API basehttps://api.kimi.com/coding/v1(Kimi Code API)KimiCLI/0.77) forapi.kimi.comendpoints, required by the Kimi Code APICreateProviderFromConfig, default API basehttps://opencode.ai/zen/v1, migration entry forConvertProvidersToModelListOpencodefield toProvidersConfigstruct with properIsEmpty()andHasProvidersConfig()supportTest plan
provider: "moonshot"configgo build ./pkg/...passes