Gateway Validator
Safely validate gateway config changes before they break production.
How It Works
Primary approach:
- 1. Create temp config with your changes
- Start isolated test gateway on different port
- Send test completion request
- Works? → Apply to production
- Fails? → Block and show error
Fallback approach (when isolated gateway can't start):
- 1. Validate config syntax
- Test provider APIs directly (check API keys, models)
- Works? → Apply to production
- Fails? → Block and show error
Usage
I'll automatically use this when you request gateway changes:
- - "Change model to gpt-4o"
- "Update API key"
- "Switch to anthropic"
- Any config modification
Examples
Bad API Key
CODEBLOCK0
Bad Model
CODEBLOCK1
Valid Change
CODEBLOCK2
Technical Details
Level 1: Config Syntax
- - YAML valid?
- Required fields present?
- Value ranges valid (temp 0-2, etc.)?
Level 2: Provider Test (direct API calls)
- - API key valid?
- Model exists?
- Can connect to provider?
Level 3: Full Gateway Test (when possible)
- - Start temp gateway
- Send completion request
- Verify end-to-end works
Limitations
- - Isolated gateway test requires systemd/launchd (not available in all containers)
- When isolated test unavailable, falls back to provider-level validation
- Provider testing needs ~5-10 seconds for API calls
网关验证器
在配置变更影响生产环境之前,安全地验证网关配置变更。
工作原理
主要方式:
- 1. 使用你的变更创建临时配置
- 在不同端口启动隔离测试网关
- 发送测试完成请求
- 成功?→ 应用到生产环境
- 失败?→ 阻止并显示错误
备用方式(当隔离网关无法启动时):
- 1. 验证配置语法
- 直接测试提供商API(检查API密钥、模型)
- 成功?→ 应用到生产环境
- 失败?→ 阻止并显示错误
使用方法
当你请求网关变更时,我会自动使用此功能:
- - 将模型改为gpt-4o
- 更新API密钥
- 切换到Anthropic
- 任何配置修改
示例
无效API密钥
你:将API密钥设置为fake-key
我:🧪 正在测试变更...
❌ API密钥无效
配置未变更。
无效模型
你:使用模型gpt-99
我:🧪 正在测试变更...
❌ 未找到模型
配置未变更。
有效变更
你:将温度改为0.5
我:🧪 正在测试变更...
✅ 测试通过
✅ 配置已更新
技术细节
第一层:配置语法
- - YAML格式有效?
- 必填字段存在?
- 值范围有效(温度0-2等)?
第二层:提供商测试(直接API调用)
第三层:完整网关测试(可能时)
限制
- - 隔离网关测试需要systemd/launchd(并非所有容器都可用)
- 当隔离测试不可用时,回退到提供商级别验证
- 提供商测试需要约5-10秒进行API调用