Skip to content

feat(ai-gateway): add zhipuai extended options with dynamic config#245

Closed
johnlanni wants to merge 1 commit into
higress-group:mainfrom
johnlanni:feat/zhipu-extended-options-v2
Closed

feat(ai-gateway): add zhipuai extended options with dynamic config#245
johnlanni wants to merge 1 commit into
higress-group:mainfrom
johnlanni:feat/zhipu-extended-options-v2

Conversation

@johnlanni
Copy link
Copy Markdown
Contributor

Summary

This PR adds extended configuration options for the Zhipu AI provider with a refactored approach that allows dynamic configuration without rebuilding the Docker image.

Key Changes

  1. Configuration is built in get-ai-gateway.sh - The ZHIPUAI_EXTRA_CONFIGS environment variable is constructed from individual settings
  2. Passed to container via environment - The config is stored in the config file and passed to the container at runtime
  3. Parsed in ai-gateway.sh - The container script parses the comma-separated config string

New CLI Options

Option Description
--zhipuai-domain DOMAIN Specify the Zhipu AI API domain (default: open.bigmodel.cn, international: api.z.ai)
--zhipuai-code-plan-mode Enable Code Plan mode (uses /api/coding/paas/v4/chat/completions endpoint)

Usage Examples

# Use international endpoint
bash get-ai-gateway.sh --zhipuai-key $API_KEY --zhipuai-domain api.z.ai

# Enable Code Plan mode
bash get-ai-gateway.sh --zhipuai-key $API_KEY --zhipuai-code-plan-mode

# Combine both options
bash get-ai-gateway.sh --zhipuai-key $API_KEY --zhipuai-domain api.z.ai --zhipuai-code-plan-mode

Architecture

get-ai-gateway.sh                    ai-gateway.sh (in container)
┌─────────────────────┐              ┌─────────────────────┐
│ Parse CLI args      │              │ Read env variable   │
│ --zhipuai-domain    │──────────────│ ZHIPUAI_EXTRA_CONFIGS│
│ --zhipuai-code-plan │   env var    │                     │
│                     │              │ Parse & apply to    │
│ Build EXTRA_CONFIGS │              │ provider config     │
└─────────────────────┘              └─────────────────────┘

Benefits

  • No image rebuild needed - Configuration changes take effect by restarting the container
  • Consistent with existing pattern - Uses the same LLM_ENVS mechanism as other settings
  • Backward compatible - Default behavior unchanged when options not specified

Related PR

Backend support: higress-group/higress#3488

- Add --zhipuai-domain option for China/International endpoint selection
- Add --zhipuai-code-plan-mode flag for Code Plan API support
- Build ZHIPUAI_EXTRA_CONFIGS in get-ai-gateway.sh for dynamic configuration
- Parse ZHIPUAI_EXTRA_CONFIGS in ai-gateway.sh from environment variable
- This allows configuration changes without rebuilding the Docker image
@johnlanni johnlanni requested a review from CH3CHO as a code owner February 12, 2026 14:30
@lingma-agents
Copy link
Copy Markdown

lingma-agents Bot commented Feb 12, 2026

🔍 代码审查进行中

⏳ 正在审查

⏰️ 剩余时间:约需数分钟

🔄 分支流向: feat/zhipu-extended-options-v2main

📦 提交: 审查当前PR从8588e5d18901d2的提交。


📒 文件清单 (2 个文件)
📝 变更: 2 个文件

📝 变更文件:

  • all-in-one/get-ai-gateway.sh
  • all-in-one/scripts/config-template/ai-gateway.sh

@johnlanni
Copy link
Copy Markdown
Contributor Author

Superseded by complete EXTRA_CONFIGS refactoring

@johnlanni johnlanni closed this Feb 12, 2026
@lingma-agents
Copy link
Copy Markdown

lingma-agents Bot commented Feb 12, 2026

CodeReview流程已终止

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant