feat(litellm): add native Beijing Bailian ASR and personal vocabulary

This commit is contained in:
Codex
2026-10-26 17:52:46 -07:00
parent daa907d029
commit d583490bad
15 changed files with 357 additions and 4 deletions
+18 -1
View File
@@ -75,6 +75,22 @@ def namespace_config(config):
return config
def add_bailian_routes(config, env, vocabulary_path):
if env.get('BAILIAN_CN_API_KEY'):
base = env.get('BAILIAN_CN_API_BASE')
if not base:
raise ValueError('BAILIAN_CN_API_BASE required for Beijing Bailian')
for personal in [False, True]:
params = {'model': 'dashscope/qwen-audio-3.1-asr-flash',
'api_base': base, 'api_key': 'os.environ/BAILIAN_CN_API_KEY',
'max_retries': 0}
if personal:
params['bailian_vocabulary_path'] = vocabulary_path
config['model_list'].append({'model_name': 'bailian-cn/qwen-audio-3.1-asr-flash' +
('-personal' if personal else ''), 'litellm_params': params})
return config
def build_config(catalog, env, exists, namespaced=True):
routes = []
fallbacks = []
@@ -146,7 +162,8 @@ def build_config(catalog, env, exists, namespaced=True):
# Only explicitly approved open-model routes have cross-provider fallbacks.
'router_settings': {'num_retries': 1, 'timeout': 180, 'fallbacks': fallbacks},
}
return namespace_config(config) if namespaced else config
return add_bailian_routes(namespace_config(config), env,
'/etc/litellm/personal-vocabulary.json') if namespaced else config
if __name__ == '__main__':