refactor: move model pattern defaults to get-ai-gateway.sh#241
Merged
Conversation
- Move all model pattern defaults from ai-gateway.sh (container) to get-ai-gateway.sh (host script) - Add model pattern defaults in resetEnv() function for easy updates - Update writeConfiguration() to persist all *_MODELS variables to config file - Simplify ai-gateway.sh to use environment variables directly - Enables updating model patterns without rebuilding the container image Benefits: - Single source of truth for default model patterns - Easier to update when new models are released - Better maintainability through version control - Backward compatible with existing installations
- Add glm-* pattern to ZHIPUAI_MODELS (case-insensitive) - Add minimax-* pattern to MINIMAX_MODELS (case-insensitive) - Users can now use both GLM-4 and glm-4 style model names - Aligns with mixed naming conventions from different API endpoints
- Add configureClaudeCodeProvider() function in get-ai-gateway.sh - Add Claude Code to Top 10 commonly used providers list - Support --claude-code-key and --claude-code-models CLI flags - Add CLAUDE_CODE_MODELS default pattern: claude-code-* - Add claudeCodeMode=true configuration in ai-gateway.sh - Claude Code uses OAuth token (Bearer auth) instead of x-api-key - Enables Claude Code CLI token authentication for AI Gateway Claude Code mode differences: - Uses Bearer token authorization - Sets x-app: cli header - Adds anthropic-beta headers for OAuth/Claude Code features - Adds ?beta=true query parameter - Auto-injects default system prompt and Bash tool
Add user-friendly prompt when configuring Claude Code mode: - Inform users to run 'claude setup-token' to get OAuth token - Clear instructions for token acquisition - Improves user experience during interactive setup
This was referenced Feb 7, 2026
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.
Motivation
Currently, model pattern defaults (e.g.,
MOONSHOT_MODELS="moonshot-*,kimi-*") are hardcoded inai-gateway.shwhich runs inside the container. When new models are released, updating these defaults requires rebuilding and redistributing the container image.Changes
1. Move defaults to get-ai-gateway.sh
resetEnv()function2. Update writeConfiguration()
*_MODELSvariables to the config file--env-file3. Simplify ai-gateway.sh
${MOONSHOT_MODELS:-moonshot-*,kimi-*})${MOONSHOT_MODELS})Benefits
✅ No container rebuild needed - Update model patterns by editing
get-ai-gateway.sh✅ Single source of truth - Defaults managed in one place (get-ai-gateway.sh)
✅ Version controlled - Model updates tracked in git history
✅ Backward compatible - Existing installations continue to work
✅ User override supported - Users can still pass
--xxx-modelsflagsExample
Testing
Related Issue
Addresses the need to update model patterns frequently without image rebuilds (e.g., when providers release new models like Kimi-K1).