Repository navigation
Add user-defined provider presets + migrate zhipu/moonshot/minimax to presets - #11
Merged
codeking-ai merged 2 commits intoOct 15, 2026
Conversation
…x to presets - Load user-defined provider presets from ~/.cligate/provider-presets.json at module init; validated entries merge additively after built-ins and become first-class (add-key form, model mapping, discovery, protocols, pricing). Invalid entries are skipped with warnings; built-in ids are protected from collision. - Migrate Zhipu/Moonshot/MiniMax from bespoke classes to declarative presets served by the generic OpenAI-compatible provider. Existing api-keys.json entries keep working (same ids, base URLs, pricing). New preset field validateModel: Zhipu key validation probes a 1-token chat request instead of GET /models (which Zhipu does not serve). - Zhipu/Moonshot/MiniMax gain tier maps + static model lists: non-native models now remap via tiers instead of passing through verbatim. - Fix settings-page normalizeModelMappingProvider: stop folding zhipu/moonshot/minimax into 'openai' — provider identity in the mapping UI is now 1:1 with runtime resolveModel(providerType, ...). - Add docs/CUSTOM_PROVIDERS.md and unit tests for the loader, the migration, and the normalization fix. Co-Authored-By: Claude Code <noreply@anthropic.com>
…2026) Model ids verified against OpenRouter vendor listings (z-ai, moonshotai, minimax) and official pricing pages (platform.kimi.ai, platform.minimax.io, docs.z.ai). - zhipu: glm-5.3 family (flagship glm-5.3, standard glm-5.2, fast glm-5.3-flash); drop retired glm-5-turbo/glm-4-plus/glm-4-air* - moonshot: kimi-k3 flagship, kimi-k2.6 standard, kimi-k2.7-code highspeed fast; drop retired kimi-k2.5/kimi-k2-thinking - minimax: MiniMax-M3 flagship, M2.7 standard; fix M2.7-highspeed input price (0.60, was 0.30) - pricing tables synced: new cacheRead rates and 2026 prices; glm-4.7-flash/glm-4-flash are free Co-Authored-By: Claude Code <noreply@anthropic.com>
Owner
|
Thanks for this — the preset-driven approach is a clear improvement, and moving zhipu/moonshot/minimax onto the generic provider also fixes a real bug (the old classes inherited A few follow-ups worth addressing (happy to take a follow-up PR, or I'll handle them):
|
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
Two related changes in one PR (the second is a follow-up data fix to the first):
1. User-defined provider presets (
~/.cligate/provider-presets.json)Adding an OpenAI-compatible vendor previously required hardcoding a provider class. Now any vendor can be described declaratively in
~/.cligate/provider-presets.json(same schema as built-in presets:id,label,baseUrl,apiFormat, optionalmodels/tiers/nativeModelPrefixes/passthroughModelMatch/pricing/validateModel) and it becomes a first-class provider everywhere: add-key form, model mapping with its own tier map, model discovery, protocol compatibility, pricing.validateModel: for vendors withoutGET /models, key validation probes a 1-token chat request with this model (used by Zhipu).openai_chatprovider serves chat + Anthropic bridge (/v1/messagesworks for Claude Code via translation); Codex goes through the Responses→chat fallback.2. Zhipu (GLM) / Moonshot (Kimi) / MiniMax migrated to presets + catalogs actualized
The three bespoke provider classes are replaced by declarative presets served by the generic OpenAI-compatible class (like qwen/openrouter before them). Behavior changes:
validateModel: glm-4-flash) — previously there was no/modelsvalidation for Zhipu at all, so no regression./v1/chat/completionsand the Codex Responses fallback (they previously only served/v1/messages).settings-page.js normalizeModelMappingProvider).z-ai/glm-5.3,moonshotai/kimi-k3,minimax/minimax-m3): zhipu glm-5.3 family, moonshot kimi-k3/k2.7-code/k2.6, minimax MiniMax-M3/M2.7; pricing tables synced.Test plan
npm run test:unit: no new failures vs master (existingmodel-mapper.test.jsfailures are pre-existing on master and unrelated).tests/unit/provider-user-presets.test.js(subprocess-based, freshCLIGATE_CONFIG_DIRper case: merge, collision, invalid entries, duplicates),tests/unit/model-mapping-provider-normalization.test.js(UI provider identity 1:1 with runtime), extendedtests/unit/provider-presets.test.js(migrated presets addable, tier remaps, validateModel).🤖 Generated with Claude Code