Skip to content

Commit a3e4073

Browse files
authored
feat: sync all AI providers from ai-proxy plugin (#219)
* feat: sync all AI providers from ai-proxy plugin - 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 * fix: address cursor bot review feedback 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
1 parent 1066915 commit a3e4073

1 file changed

Lines changed: 139 additions & 19 deletions

File tree

all-in-one/get-ai-gateway.sh

Lines changed: 139 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -146,32 +146,41 @@ runConfigWizard() {
146146

147147
echo
148148

149+
# Provider order: Top 10 most commonly used providers first, then others alphabetically
149150
local providers=(
150-
"OpenAI|OPENAI"
151-
"Aliyun Dashscope|DASHSCOPE"
152-
"Moonshot|MOONSHOT"
151+
# Top 10 commonly used providers (user-specified order)
152+
"Aliyun Dashscope (Qwen)|DASHSCOPE"
153+
"DeepSeek|DEEPSEEK"
154+
"Moonshot (Kimi)|MOONSHOT"
155+
"Zhipu AI|ZHIPUAI"
156+
"Minimax|MINIMAX|configureMinimaxProvider"
153157
"Azure OpenAI|AZURE|configureAzureProvider"
158+
"AWS Bedrock|BEDROCK|configureBedrockProvider"
159+
"Google Vertex AI|VERTEX|configureVertexProvider"
160+
"OpenAI|OPENAI"
161+
"OpenRouter|OPENROUTER"
162+
# Other providers (alphabetically ordered)
163+
"01.AI (Yi)|YI"
154164
"360 Zhinao|AI360"
155-
# "Github Models|GITHUB"
156-
# "Groq|GROQ"
157165
"Baichuan AI|BAICHUAN"
158-
"01.AI|YI"
159-
"DeepSeek|DEEPSEEK"
160-
"Zhipu AI|ZHIPUAI"
161-
"Ollama|OLLAMA|configureOllamaProvider"
162-
"Claude|CLAUDE|configureClaudeProvider"
163166
"Baidu AI Cloud|BAIDU"
164-
# "Tencent Hunyuan|HUNYUAN"
165-
"Stepfun|STEPFUN"
166-
"Minimax|MINIMAX|configureMinimaxProvider"
167-
# "Cloudflare Workers AI|CLOUDFLARE"
168-
# "iFlyTek Spark|SPARK"
169-
"Google Gemini|GEMINI"
170-
# "DeepL|DEEPL"
171-
"Mistral AI|MISTRAL"
167+
"Claude|CLAUDE|configureClaudeProvider"
168+
"Cloudflare Workers AI|CLOUDFLARE|configureCloudflareProvider"
172169
"Cohere|COHERE"
170+
"DeepL|DEEPL|configureDeepLProvider"
171+
"Dify|DIFY|configureDifyProvider"
173172
"Doubao|DOUBAO"
174-
# "Coze|COZE"
173+
"Fireworks AI|FIREWORKS"
174+
"Github Models|GITHUB"
175+
"Google Gemini|GEMINI"
176+
"Grok|GROK"
177+
"Groq|GROQ"
178+
"Mistral AI|MISTRAL"
179+
"Ollama|OLLAMA|configureOllamaProvider"
180+
"iFlyTek Spark|SPARK|configureSparkProvider"
181+
"Stepfun|STEPFUN"
182+
"Tencent Hunyuan|HUNYUAN|configureHunyuanProvider"
183+
"Together AI|TOGETHERAI"
175184
)
176185

177186
local selectedIndex=''
@@ -264,6 +273,117 @@ configureMinimaxProvider() {
264273
LLM_ENVS+=("MINIMAX_API_KEY" "MINIMAX_GROUP_ID")
265274
}
266275

276+
configureBedrockProvider() {
277+
echo "AWS Bedrock supports two authentication methods:"
278+
echo " 1. AWS Signature V4 (Access Key + Secret Key)"
279+
echo " 2. Bearer Token (API Token)"
280+
read -r -u 3 -p "→ Choose authentication method (1 or 2, default: 1): " BEDROCK_AUTH_METHOD
281+
if [ "$BEDROCK_AUTH_METHOD" == "2" ]; then
282+
read -r -u 3 -p "→ Enter AWS Bearer Token: " BEDROCK_API_KEY
283+
LLM_ENVS+=("BEDROCK_API_KEY")
284+
read -r -u 3 -p "→ Enter AWS Region (e.g., us-east-1): " BEDROCK_REGION
285+
if [ -n "$BEDROCK_API_KEY" ] && [ -n "$BEDROCK_REGION" ]; then
286+
BEDROCK_CONFIGURED="placeholder"
287+
fi
288+
else
289+
read -r -u 3 -p "→ Enter AWS Access Key: " BEDROCK_ACCESS_KEY
290+
read -r -u 3 -p "→ Enter AWS Secret Key: " BEDROCK_SECRET_KEY
291+
LLM_ENVS+=("BEDROCK_ACCESS_KEY" "BEDROCK_SECRET_KEY")
292+
read -r -u 3 -p "→ Enter AWS Region (e.g., us-east-1): " BEDROCK_REGION
293+
if [ -n "$BEDROCK_ACCESS_KEY" ] && [ -n "$BEDROCK_SECRET_KEY" ] && [ -n "$BEDROCK_REGION" ]; then
294+
BEDROCK_CONFIGURED="placeholder"
295+
fi
296+
fi
297+
LLM_ENVS+=("BEDROCK_REGION")
298+
}
299+
300+
configureVertexProvider() {
301+
echo "Google Vertex AI supports two authentication modes:"
302+
echo " 1. Standard Mode (Service Account JSON Key)"
303+
echo " 2. Express Mode (API Key only)"
304+
read -r -u 3 -p "→ Choose authentication mode (1 or 2, default: 1): " VERTEX_AUTH_MODE
305+
if [ "$VERTEX_AUTH_MODE" == "2" ]; then
306+
read -r -u 3 -p "→ Enter Vertex AI API Key: " VERTEX_API_KEY
307+
LLM_ENVS+=("VERTEX_API_KEY")
308+
read -r -u 3 -p "→ Enter Google Cloud Region (e.g., us-central1): " VERTEX_REGION
309+
read -r -u 3 -p "→ Enter Google Cloud Project ID: " VERTEX_PROJECT_ID
310+
if [ -n "$VERTEX_API_KEY" ] && [ -n "$VERTEX_REGION" ] && [ -n "$VERTEX_PROJECT_ID" ]; then
311+
VERTEX_CONFIGURED="placeholder"
312+
fi
313+
else
314+
read -r -u 3 -p "→ Enter path to Service Account JSON Key file: " VERTEX_AUTH_KEY_FILE
315+
if [ -n "$VERTEX_AUTH_KEY_FILE" ] && [ -f "$VERTEX_AUTH_KEY_FILE" ]; then
316+
# Read JSON file and compact it to a single line
317+
VERTEX_AUTH_KEY=$(cat "$VERTEX_AUTH_KEY_FILE" | tr -d '\n' | tr -s ' ')
318+
else
319+
echo "Warning: File not found or not specified. Please configure manually later."
320+
VERTEX_AUTH_KEY=""
321+
fi
322+
read -r -u 3 -p "→ Enter Vertex AI Auth Service Name: " VERTEX_AUTH_SERVICE_NAME
323+
LLM_ENVS+=("VERTEX_AUTH_KEY" "VERTEX_AUTH_SERVICE_NAME")
324+
read -r -u 3 -p "→ Enter Google Cloud Region (e.g., us-central1): " VERTEX_REGION
325+
read -r -u 3 -p "→ Enter Google Cloud Project ID: " VERTEX_PROJECT_ID
326+
if [ -n "$VERTEX_AUTH_KEY" ] && [ -n "$VERTEX_AUTH_SERVICE_NAME" ] && [ -n "$VERTEX_REGION" ] && [ -n "$VERTEX_PROJECT_ID" ]; then
327+
VERTEX_CONFIGURED="placeholder"
328+
fi
329+
fi
330+
LLM_ENVS+=("VERTEX_REGION" "VERTEX_PROJECT_ID")
331+
}
332+
333+
configureCloudflareProvider() {
334+
read -r -u 3 -p "→ Enter API Token for Cloudflare Workers AI: " CLOUDFLARE_API_KEY
335+
read -r -u 3 -p "→ Enter Cloudflare Account ID: " CLOUDFLARE_ACCOUNT_ID
336+
if [ -n "$CLOUDFLARE_API_KEY" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ]; then
337+
CLOUDFLARE_CONFIGURED="placeholder"
338+
fi
339+
LLM_ENVS+=("CLOUDFLARE_API_KEY" "CLOUDFLARE_ACCOUNT_ID")
340+
}
341+
342+
configureDeepLProvider() {
343+
read -r -u 3 -p "→ Enter API Key for DeepL: " DEEPL_API_KEY
344+
read -r -u 3 -p "→ Enter target language for DeepL (e.g., EN, ZH, JA): " DEEPL_TARGET_LANG
345+
if [ -n "$DEEPL_API_KEY" ] && [ -n "$DEEPL_TARGET_LANG" ]; then
346+
DEEPL_CONFIGURED="placeholder"
347+
fi
348+
LLM_ENVS+=("DEEPL_API_KEY" "DEEPL_TARGET_LANG")
349+
}
350+
351+
configureDifyProvider() {
352+
read -r -u 3 -p "→ Enter API Key for Dify: " DIFY_API_KEY
353+
read -r -u 3 -p "→ Enter Dify API URL (leave empty for cloud service): " DIFY_API_URL
354+
echo "Dify application types: Chat, Completion, Agent, Workflow"
355+
read -r -u 3 -p "→ Enter Dify bot type (default: Chat): " DIFY_BOT_TYPE
356+
if [ -z "$DIFY_BOT_TYPE" ]; then
357+
DIFY_BOT_TYPE="Chat"
358+
fi
359+
LLM_ENVS+=("DIFY_API_KEY" "DIFY_API_URL" "DIFY_BOT_TYPE")
360+
if [ "$DIFY_BOT_TYPE" == "Workflow" ]; then
361+
read -r -u 3 -p "→ Enter Dify input variable name: " DIFY_INPUT_VARIABLE
362+
read -r -u 3 -p "→ Enter Dify output variable name: " DIFY_OUTPUT_VARIABLE
363+
LLM_ENVS+=("DIFY_INPUT_VARIABLE" "DIFY_OUTPUT_VARIABLE")
364+
fi
365+
}
366+
367+
configureSparkProvider() {
368+
echo "Note: iFlyTek Spark API Key format is APIKey:APISecret"
369+
read -r -u 3 -p "→ Enter API Key for iFlyTek Spark: " SPARK_API_KEY
370+
read -r -u 3 -p "→ Enter API Secret for iFlyTek Spark: " SPARK_API_SECRET
371+
if [ -n "$SPARK_API_KEY" ] && [ -n "$SPARK_API_SECRET" ]; then
372+
SPARK_API_KEY="${SPARK_API_KEY}:${SPARK_API_SECRET}"
373+
SPARK_CONFIGURED="placeholder"
374+
fi
375+
LLM_ENVS+=("SPARK_API_KEY")
376+
}
377+
378+
configureHunyuanProvider() {
379+
read -r -u 3 -p "→ Enter Auth ID for Tencent Hunyuan: " HUNYUAN_AUTH_ID
380+
read -r -u 3 -p "→ Enter Auth Key for Tencent Hunyuan: " HUNYUAN_AUTH_KEY
381+
if [ -n "$HUNYUAN_AUTH_ID" ] && [ -n "$HUNYUAN_AUTH_KEY" ]; then
382+
HUNYUAN_CONFIGURED="placeholder"
383+
fi
384+
LLM_ENVS+=("HUNYUAN_AUTH_ID" "HUNYUAN_AUTH_KEY")
385+
}
386+
267387
configureStorage() {
268388
if [ -d "$DATA_FOLDER" ]; then
269389
return 0

0 commit comments

Comments
 (0)