feat: add Moonshot AI, Z.AI, MiniMax, and OpenRouter providers#15
Open
AhmedOsman101 wants to merge 9 commits intomainfrom
Open
feat: add Moonshot AI, Z.AI, MiniMax, and OpenRouter providers#15AhmedOsman101 wants to merge 9 commits intomainfrom
AhmedOsman101 wants to merge 9 commits intomainfrom
Conversation
- Add moonshotService.ts (Kimi models via @ai-sdk/moonshotai) - Add zaiService.ts (GLM models via @ai-sdk/openai with Z.AI base URL) - Add minimaxService.ts (MiniMax-M2.x via vercel-minimax-ai-provider) - Add openrouterService.ts (meta-provider via @openrouter/ai-sdk-provider) - Extend ProviderType union with moonshotai, zai, minimax, openrouter - Extend ApiService union with MoonshotAI, Zai, MiniMax, OpenRouter - Add OpenRouterConfig type and openrouter section to Config type - Update DEFAULT_CONFIG with openrouter section and new provider defaults - Update providerRegistry.ts with all four new providers - Add OpenRouter special-case dispatch in aiService.ts - Update configValidationService.ts SUPPORTED_PROVIDERS and schema - Update configService.ts migrateConfig (modelMap + prefix detection) - Add validateApiKey cases for new providers in configService.ts - Add validateOpenRouterApiKey (sk-or-v1- prefix check) to keyValidationService.ts - Update config.schema.json with new provider enums and openrouter section - Update CHANGELOG.md with all new provider details
The openrouter config section is optional for users - it should only be required when using the openrouter provider, not for all users. Kept openrouter as required in TypeScript Config type since DEFAULT_CONFIG always includes it and all service code expects it.
Root cause: load() was calling migrateConfig() then recursively calling load() again, creating an infinite loop. The fix converts the parsed config directly to Config type instead of re-loading from disk.
- logDebug checks DEBUG_ENABLED (cached at module load, no env lookup per call) - Added logDebug calls to all major async operations: - aiService: generateCommitMessage, generateAndApplyMessage - All provider services: moonshot, zai, minimax, openrouter - gitService: initialize, getDiff, getChangedFiles - promptService: generatePrompt - gitBlameAnalyzer: analyzeChanges - Format: [timestamp] [functionName] EVENT details - Timestamp format: 2026-03-11@02:00AM
Ollama and OpenRouter now read model from provider.model instead of ollama.model / openrouter.model. Only baseUrl stays in its own section.
- OpenRouter and Ollama now throw clear error if provider.model is missing - Optional baseUrl falls back to DEFAULT_CONFIG values instead of hardcoded - Added debug logging to OllamaService
- Updated config types to allow optional baseUrl - Modified config service to handle optional values - Adjusted Ollama/OpenRouter services to use default baseUrl if not provided - Updated AGENTS.md header
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
DEBUG=1environment variableprovider.modelinstead of separate config sectionsNew Providers
Debug Logging
Set
DEBUG=1before running to enable verbose debug output with timestamps.Test Plan