feat!: breaking change - OpenRouter models are now read from conf/openrouter_models.json while Custom / Self-hosted models are read from conf/custom_models.json
feat: Azure OpenAI / Azure AI Foundry support. Models should be defined in conf/azure_models.json (or a custom path). See .env.example for environment variables or see readme. https://github.com/BeehiveInnovations/zen-mcp-server/issues/265 feat: OpenRouter / Custom Models / Azure can separately also use custom config paths now (see .env.example ) refactor: Model registry class made abstract, OpenRouter / Custom Provider / Azure OpenAI now subclass these refactor: breaking change: `is_custom` property has been removed from model_capabilities.py (and thus custom_models.json) given each models are now read from separate configuration files
This commit is contained in:
@@ -38,6 +38,7 @@ class ModelProviderRegistry:
|
||||
PROVIDER_PRIORITY_ORDER = [
|
||||
ProviderType.GOOGLE, # Direct Gemini access
|
||||
ProviderType.OPENAI, # Direct OpenAI access
|
||||
ProviderType.AZURE, # Azure-hosted OpenAI deployments
|
||||
ProviderType.XAI, # Direct X.AI GROK access
|
||||
ProviderType.DIAL, # DIAL unified API access
|
||||
ProviderType.CUSTOM, # Local/self-hosted models
|
||||
@@ -123,6 +124,21 @@ class ModelProviderRegistry:
|
||||
provider_kwargs["base_url"] = gemini_base_url
|
||||
logging.info(f"Initialized Gemini provider with custom endpoint: {gemini_base_url}")
|
||||
provider = provider_class(**provider_kwargs)
|
||||
elif provider_type == ProviderType.AZURE:
|
||||
if not api_key:
|
||||
return None
|
||||
|
||||
azure_endpoint = get_env("AZURE_OPENAI_ENDPOINT")
|
||||
if not azure_endpoint:
|
||||
logging.warning("AZURE_OPENAI_ENDPOINT missing – skipping Azure OpenAI provider")
|
||||
return None
|
||||
|
||||
azure_version = get_env("AZURE_OPENAI_API_VERSION")
|
||||
provider = provider_class(
|
||||
api_key=api_key,
|
||||
azure_endpoint=azure_endpoint,
|
||||
api_version=azure_version,
|
||||
)
|
||||
else:
|
||||
if not api_key:
|
||||
return None
|
||||
@@ -318,6 +334,7 @@ class ModelProviderRegistry:
|
||||
key_mapping = {
|
||||
ProviderType.GOOGLE: "GEMINI_API_KEY",
|
||||
ProviderType.OPENAI: "OPENAI_API_KEY",
|
||||
ProviderType.AZURE: "AZURE_OPENAI_API_KEY",
|
||||
ProviderType.XAI: "XAI_API_KEY",
|
||||
ProviderType.OPENROUTER: "OPENROUTER_API_KEY",
|
||||
ProviderType.CUSTOM: "CUSTOM_API_KEY", # Can be empty for providers that don't need auth
|
||||
|
||||
Reference in New Issue
Block a user