mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-09 08:18:12 +00:00
fix: wire default_api_key through SimpleProviderConfig
SimpleProviderConfig now reads the `default_api_key` field from providers.json, and `_get_openai_compatible_provider_info` falls back to it when neither the call-time key nor the env var is set. Fixes the Greptile-flagged P1: `test_rapid_mlx_provider_routing` asserted `api_key == "not-needed"` but the framework silently discarded the field, returning None instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b175a04d26
commit
15d7408be5
2 changed files with 2 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ def create_config_class(provider: SimpleProviderConfig):
|
|||
resolved_base = provider.base_url
|
||||
|
||||
# Resolve API key
|
||||
resolved_key = api_key or get_secret_str(provider.api_key_env)
|
||||
resolved_key = api_key or get_secret_str(provider.api_key_env) or provider.default_api_key
|
||||
|
||||
return resolved_base, resolved_key
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class SimpleProviderConfig:
|
|||
self.base_url = data["base_url"]
|
||||
self.api_key_env = data["api_key_env"]
|
||||
self.api_base_env = data.get("api_base_env")
|
||||
self.default_api_key = data.get("default_api_key")
|
||||
self.base_class = data.get("base_class", "openai_gpt")
|
||||
self.param_mappings = data.get("param_mappings", {})
|
||||
self.constraints = data.get("constraints", {})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue