feat: sync all AI providers from ai-proxy plugin#219
Conversation
- Add all providers supported by higress ai-proxy plugin - Reorder providers with commonly used ones at top: 1. Qwen (Dashscope) 2. DeepSeek 3. Moonshot (Kimi) 4. Zhipu AI 5. Minimax 6. Azure OpenAI 7. AWS Bedrock 8. Google Vertex AI 9. OpenAI 10. OpenRouter - Add new providers: - AWS Bedrock (with AK/SK and Bearer Token auth) - Google Vertex AI (with Service Account and Express Mode) - OpenRouter - Cloudflare Workers AI - DeepL (translation) - Dify (workflow platform) - iFlyTek Spark - Tencent Hunyuan - Together AI - Fireworks AI - Github Models - Grok - Groq - Add custom configuration functions for complex providers
1. Fix Hunyuan provider never showing as configured - Add HUNYUAN_CONFIGURED placeholder when credentials provided 2. Fix configured status ignoring missing credentials - Bedrock: Check access key/secret or bearer token before marking configured - Vertex: Check auth key and service name before marking configured - Add similar checks for Cloudflare and DeepL providers 3. Fix multi-line JSON input issue for Vertex - Change from direct JSON paste to file path input - Read and compact JSON file content to single line
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| read -r -u 3 -p "→ Enter Dify input variable name: " DIFY_INPUT_VARIABLE | ||
| read -r -u 3 -p "→ Enter Dify output variable name: " DIFY_OUTPUT_VARIABLE | ||
| LLM_ENVS+=("DIFY_INPUT_VARIABLE" "DIFY_OUTPUT_VARIABLE") | ||
| fi |
There was a problem hiding this comment.
Case-sensitive Workflow check skips required variable collection
Low Severity
The configureDifyProvider function uses a case-sensitive comparison [ "$DIFY_BOT_TYPE" == "Workflow" ] to determine whether to prompt for input/output variable names. If a user enters "workflow" (lowercase) when intending to use Workflow mode, the condition fails and the required DIFY_INPUT_VARIABLE and DIFY_OUTPUT_VARIABLE prompts are skipped. The configuration will be incomplete, potentially causing runtime failures when the Workflow feature is used without these required variables.
This commit completes the AI Gateway template configuration by adding initialization for all new providers introduced in PR higress-group#219: **New providers added:** - AWS Bedrock (with region and auth configuration) - Google Vertex AI (with project/region/service account) - OpenRouter (multi-provider router) - Cloudflare Workers AI (with account ID) - DeepL (translation service with target language) - Dify (AI workflow platform with bot type and variables) - iFlyTek Spark - Tencent Hunyuan (with auth ID/key) - Fireworks AI - GitHub Models - Grok (xAI) - Groq - Together AI **Key improvements:** 1. Added conditional initialization for all new providers based on configuration markers set in get-ai-gateway.sh 2. Implemented support for custom model patterns via environment variables (e.g., BEDROCK_MODELS, VERTEX_MODELS, etc.) for providers with non-deterministic model sets 3. Properly configured extra configs (regions, auth keys, account IDs) for providers requiring additional parameters 4. Maintained alphabetical ordering for better readability 5. Added comprehensive comments for each provider section **Environment variable pattern:** For providers with uncertain model sets, users can now customize the model matching pattern, e.g.: - BEDROCK_MODELS="claude-.*" for AWS Bedrock Claude models - VERTEX_MODELS="gemini-.*" for Vertex AI Gemini models - Default: ".*" (matches all models) Fixes the issue where PR higress-group#219 added provider configurations in get-ai-gateway.sh but the actual template generation in ai-gateway.sh was missing the corresponding initialization.
…n support (#234) * feat: complete AI provider configurations in ai-gateway template This commit completes the AI Gateway template configuration by adding initialization for all new providers introduced in PR #219: **New providers added:** - AWS Bedrock (with region and auth configuration) - Google Vertex AI (with project/region/service account) - OpenRouter (multi-provider router) - Cloudflare Workers AI (with account ID) - DeepL (translation service with target language) - Dify (AI workflow platform with bot type and variables) - iFlyTek Spark - Tencent Hunyuan (with auth ID/key) - Fireworks AI - GitHub Models - Grok (xAI) - Groq - Together AI **Key improvements:** 1. Added conditional initialization for all new providers based on configuration markers set in get-ai-gateway.sh 2. Implemented support for custom model patterns via environment variables (e.g., BEDROCK_MODELS, VERTEX_MODELS, etc.) for providers with non-deterministic model sets 3. Properly configured extra configs (regions, auth keys, account IDs) for providers requiring additional parameters 4. Maintained alphabetical ordering for better readability 5. Added comprehensive comments for each provider section **Environment variable pattern:** For providers with uncertain model sets, users can now customize the model matching pattern, e.g.: - BEDROCK_MODELS="claude-.*" for AWS Bedrock Claude models - VERTEX_MODELS="gemini-.*" for Vertex AI Gemini models - Default: ".*" (matches all models) Fixes the issue where PR #219 added provider configurations in get-ai-gateway.sh but the actual template generation in ai-gateway.sh was missing the corresponding initialization. * feat: add model pattern configuration support for all new providers This commit adds comprehensive model pattern configuration support: **Interactive mode improvements:** - Added model pattern configuration prompts to all provider config functions - For providers with known model patterns (Vertex=gemini-.*, Bedrock=.*, etc.), provided sensible defaults - Users can specify custom regex patterns during interactive setup **CLI parameter support:** Added new CLI arguments for model pattern configuration: - --bedrock-models, --vertex-models, --openrouter-models - --cloudflare-models, --deepl-models, --dify-models - --fireworks-models, --github-models, --grok-models - --groq-models, --spark-models, --hunyuan-models - --togetherai-models **New configuration functions:** Added dedicated config functions for providers that previously only supported API key input: - configureOpenRouterProvider() - configureFireworksProvider() - configureGitHubProvider() - configureGrokProvider() - configureGroqProvider() - configureTogetherAIProvider() **Usage examples:** CLI mode: ```bash ./get-ai-gateway.sh start --bedrock-key="xxx" --bedrock-models="claude-.*" ./get-ai-gateway.sh start --openrouter-key="xxx" --openrouter-models=".*" ``` Interactive mode: Users are now prompted to enter model patterns after API credentials, with helpful examples and sensible defaults. All model pattern environment variables are properly passed to the ai-gateway.sh template via LLM_ENVS array. * feat: add model pattern configuration for ALL providers This commit extends model pattern configuration to ALL providers, not just the newly added ones. **Template changes (ai-gateway.sh):** All providers now support custom model patterns via environment variables: - DASHSCOPE_MODELS (default: qwen) - DEEPSEEK_MODELS (default: deepseek) - MOONSHOT_MODELS (default: moonshot-.*|kimi-.*) - ZHIPUAI_MODELS (default: GLM-) - MINIMAX_MODELS (default: abab) - AZURE_MODELS (default: gpt-.*|o1-.*|o3-.*) - OPENAI_MODELS (default: gpt-.*|o1-.*|o3-.*) - YI_MODELS (default: yi-) - AI360_MODELS (default: 360GPT) - BAICHUAN_MODELS (default: Baichuan) - BAIDU_MODELS (default: ERNIE-) - CLAUDE_MODELS (default: claude-) - COHERE_MODELS (default: command|command-.*) - DOUBAO_MODELS (default: doubao-) - GEMINI_MODELS (default: gemini-) - MISTRAL_MODELS (default: open-mistral-.*|mistral-.*) - OLLAMA_MODELS (default: codellama.*|llama.*) - STEPFUN_MODELS (default: step-) - (Plus all previously added providers) **CLI parameter support:** Added corresponding --xxx-models parameters for all providers: --dashscope-models, --deepseek-models, --moonshot-models, --zhipuai-models, --minimax-models, --azure-models, --openai-models, --yi-models, --ai360-models, --baichuan-models, --baidu-models, --claude-models, --cohere-models, --doubao-models, --gemini-models, --mistral-models, --ollama-models, --stepfun-models **Interactive configuration functions:** Added/updated configuration functions for all providers: - configureDashscopeProvider() - configureDeepSeekProvider() - configureMoonshotProvider() - configureZhipuAIProvider() - configureOpenAIProvider() - configureYiProvider() - configureAI360Provider() - configureBaichuanProvider() - configureBaiduProvider() - configureCohereProvider() - configureDoubaoProvider() - configureGeminiProvider() - configureMistralProvider() - configureStepfunProvider() Updated existing functions with model pattern support: - configureAzureProvider() - configureMinimaxProvider() - configureClaudeProvider() - configureOllamaProvider() Each function now prompts for model patterns with sensible defaults matching the template configuration. **Usage examples:** ```bash # Customize models for standard providers ./get-ai-gateway.sh start \ --openai-key="$KEY" --openai-models="gpt-4.*" \ --dashscope-key="$KEY" --dashscope-models="qwen-.*" # Mix and match providers by model ./get-ai-gateway.sh start \ --deepseek-key="$KEY" --deepseek-models="deepseek-coder.*" \ --moonshot-key="$KEY" --moonshot-models="kimi.*" ``` Now EVERY provider supports custom model pattern configuration, enabling fine-grained control over model routing. * feat: add universal model pattern normalization function This commit adds a unified model pattern normalization system that supports multiple flexible input formats and intelligently converts them to optimal match types. **New normalizeModelPattern() function:** Supports the following input formats: 1. **Wildcard suffix**: `qwen-*` → PRE `qwen-` - Converts to prefix match for efficiency 2. **Exact model name**: `qwen3-max` → PRE `qwen3-max` - Uses prefix match for exact names 3. **Multiple wildcards**: `kimi-*,moonshot-*` → REGULAR `kimi-.*|moonshot-.*` - Comma-separated patterns with wildcards - Converts to regex with OR operator 4. **Multiple exact names**: `kimi-2.5,moonshot-k1` → REGULAR `kimi-2.5|moonshot-k1` - Comma-separated exact model names - Creates regex OR pattern 5. **Mixed patterns**: `qwen-*,gpt-4` → REGULAR `qwen-.*|gpt-4` - Supports mixing wildcards and exact names 6. **Match all**: `*` → REGULAR `.*` - Universal wildcard for all models **Smart type detection:** - Single pattern with `-*` suffix → PRE (prefix match, more efficient) - Multiple patterns (comma-separated) → REGULAR (regex with OR) - Complex wildcards → REGULAR (full regex power) - Empty pattern → REGULAR `.*` (match all) **Updated all provider configurations:** All providers now use normalizeModelPattern() to process their model patterns, enabling: - Consistent user experience across all providers - Flexible configuration via environment variables - Automatic optimization (PRE vs REGULAR) - Support for complex multi-model routing **Default pattern updates:** Changed defaults to use the more intuitive wildcard syntax: - `qwen-*` instead of `qwen` - `gpt-*,o1-*,o3-*` instead of `gpt-.*|o1-.*|o3-.*` - `moonshot-*,kimi-*` instead of `moonshot-.*|kimi-.*` Users can now configure models in the most natural way: ```bash # Simple prefix match DASHSCOPE_MODELS="qwen-*" # Multiple models OPENAI_MODELS="gpt-4-turbo,gpt-4o" # Mix exact and wildcard CLAUDE_MODELS="claude-3-5-sonnet-*,claude-opus-4" # Comma-separated wildcards MOONSHOT_MODELS="moonshot-*,kimi-*" ``` The normalization function handles all conversion automatically! * docs: add comprehensive model pattern configuration help Added detailed documentation for model pattern configurations in the --help output, including: **Format Documentation:** Documented all 6 supported input formats with examples: 1. Wildcard prefix: `qwen-*` (matches qwen-max, qwen-plus, etc.) 2. Exact model name: `gpt-4-turbo` (matches only this model) 3. Multiple wildcards: `moonshot-*,kimi-*` (matches multiple series) 4. Multiple exact names: `gpt-4-turbo,gpt-4o,gpt-4o-mini` 5. Mixed patterns: `claude-3-5-sonnet-*,claude-opus-4-20250514` 6. Match all: `*` (catch-all provider) Each format includes: - Clear example usage - What it matches - When to use it **Available Options:** Listed all 30+ --xxx-models parameters with provider names: - --dashscope-models, --deepseek-models, --moonshot-models - --zhipuai-models, --minimax-models, --azure-models - --openai-models, --openrouter-models, --yi-models - ... and all other providers **Practical Examples:** Added real-world usage examples: 1. Route specific models to specific providers: ```bash ./get-ai-gateway.sh start --non-interactive \ --openai-key sk-xxx --openai-models "gpt-4-*" \ --deepseek-key sk-xxx --deepseek-models "deepseek-*" \ --claude-key sk-xxx --claude-models "claude-3-5-sonnet-*" ``` 2. Multi-provider setup with exact model names: ```bash ./get-ai-gateway.sh start --non-interactive \ --openai-key sk-xxx --openai-models "gpt-4-turbo,gpt-4o" \ --claude-key sk-xxx --claude-models "claude-opus-4-20250514" ``` 3. Use OpenRouter as catch-all: ```bash ./get-ai-gateway.sh start --non-interactive \ --openai-key sk-xxx --openai-models "gpt-4-*" \ --openrouter-key sk-xxx --openrouter-models "*" ``` Users can now run `./get-ai-gateway.sh -h` to get comprehensive guidance on model pattern configuration!
Summary
This PR synchronizes the AI Gateway installation script with all providers supported by the Higress ai-proxy plugin.
Changes
Provider Reordering
Reordered providers with the most commonly used ones at the top for better user experience:
New Providers Added
Configuration Functions
Added custom configuration functions for providers that require special setup:
configureBedrockProvider()- AWS authentication optionsconfigureVertexProvider()- GCP authentication optionsconfigureCloudflareProvider()- Account ID requiredconfigureDeepLProvider()- Target language requiredconfigureDifyProvider()- Bot type and workflow variablesconfigureSparkProvider()- APIKey:APISecret formatconfigureHunyuanProvider()- Auth ID and KeyReference
Note
Aligns AI Gateway install wizard with ai-proxy plugin by reordering and expanding provider support, plus adding custom setup flows for providers needing extra credentials.
get-ai-gateway.shto surface top 10 commonly used providers, then others alphabeticallyBEDROCK,VERTEX,OPENROUTER,CLOUDFLARE,DEEPL,DIFY,SPARK,HUNYUAN,FIREWORKS,GITHUB,GEMINI,GROK,GROQ,TOGETHERAIconfigureBedrockProvider,configureVertexProvider,configureCloudflareProvider,configureDeepLProvider,configureDifyProvider,configureSparkProvider,configureHunyuanProvider; updatesLLM_ENVSwith required varsOPENAIandAZUREsimultaneously; no other logic changesWritten by Cursor Bugbot for commit 24d25e4. This will update automatically on new commits. Configure here.