From 3d44b74d8c007ff2ae1d47f2974cb992a61c5283 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 28 Oct 2026 19:23:58 -0700 Subject: [PATCH] Route asr-gpt to official OpenAI with ZenMux backup --- servers/bwh-us-dc1/litellm/render_config.py | 6 ++++++ servers/bwh-us-dc1/litellm/test_config.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/servers/bwh-us-dc1/litellm/render_config.py b/servers/bwh-us-dc1/litellm/render_config.py index 193a54e..6d027e8 100644 --- a/servers/bwh-us-dc1/litellm/render_config.py +++ b/servers/bwh-us-dc1/litellm/render_config.py @@ -56,6 +56,12 @@ def build_hk_config(catalog, env): config['model_list'].append({'model_name': 'openai/' + alias, 'litellm_params': { 'model': 'openai/' + model, 'api_base': 'https://api.openai.com/v1', 'api_key': 'os.environ/OPENAI_API_KEY', 'max_retries': 0}}) + config['model_list'] = [r for r in config['model_list'] if r['model_name'] != 'asr-gpt'] + config['model_list'].append({'model_name': 'asr-gpt', 'litellm_params': { + 'model': 'openai/gpt-transcribe', 'api_base': 'https://api.openai.com/v1', + 'api_key': 'os.environ/OPENAI_API_KEY', 'max_retries': 0}}) + if env.get('ZENMUX_SUBSCRIPTION_API_KEY'): + config['router_settings']['fallbacks'].append({'asr-gpt': ['zenmux/gpt-transcribe']}) return config diff --git a/servers/bwh-us-dc1/litellm/test_config.py b/servers/bwh-us-dc1/litellm/test_config.py index d4a6cdf..a0ba76c 100644 --- a/servers/bwh-us-dc1/litellm/test_config.py +++ b/servers/bwh-us-dc1/litellm/test_config.py @@ -14,10 +14,20 @@ class RoutingTests(unittest.TestCase): routes = {r['model_name']: r['litellm_params'] for r in config['model_list']} self.assertEqual(routes['openai/gpt-transcribe']['api_base'], 'https://api.openai.com/v1') self.assertEqual(routes['zenmux/gpt-transcribe']['api_base'], 'https://zenmux.ai/api/v1') + self.assertEqual(routes['asr-gpt'], routes['openai/gpt-transcribe']) + self.assertIn({'asr-gpt': ['zenmux/gpt-transcribe']}, config['router_settings']['fallbacks']) self.assertEqual(routes['openai/gpt-sol-latest']['model'], 'openai/gpt-6.1-sol') self.assertNotIn('codex/gpt-sol-latest', routes) self.assertNotIn('synthetic', yaml.safe_dump(config)) + def test_official_asr_without_zenmux_has_no_dangling_fallback(self): + catalog = yaml.safe_load(Path(__file__).with_name('models.yaml').read_text()) + config = build_hk_config(catalog, {'OPENAI_API_KEY': 'synthetic'}) + routes = {r['model_name']: r['litellm_params'] for r in config['model_list']} + self.assertEqual(routes['asr-gpt']['model'], 'openai/gpt-transcribe') + self.assertNotIn('zenmux/gpt-transcribe', routes) + self.assertNotIn({'asr-gpt': ['zenmux/gpt-transcribe']}, config['router_settings']['fallbacks']) + def test_bailian_personal_uses_hk_private_vocabulary(self): catalog = yaml.safe_load(Path(__file__).with_name('models.yaml').read_text()) routes = build_hk_config(catalog, {'BAILIAN_CN_API_KEY':'synthetic',