Cover bare claude-/gemini- shorthands in env mirror
normalize_model_name expands `claude-*` and `gemini-*` shorthands into `litellm/anthropic/...` and `litellm/gemini/...` at routing time, but the mirror helper was looking at the raw pre-normalization name — bare shorthands had no `/` and hit the early return, so ANTHROPIC_API_KEY / GEMINI_API_KEY were never populated for those users. Run the same normalization inside the mirror helper so the provider prefix is consistent with what LiteLLM actually sees downstream.
This commit is contained in:
@@ -61,7 +61,7 @@ def configure_sdk_model_defaults(settings: Settings) -> None:
|
|||||||
def _mirror_api_key_to_provider_env(model_name: str | None, api_key: str) -> None:
|
def _mirror_api_key_to_provider_env(model_name: str | None, api_key: str) -> None:
|
||||||
if not model_name:
|
if not model_name:
|
||||||
return
|
return
|
||||||
name = model_name.strip()
|
name = normalize_model_name(model_name)
|
||||||
for prefix in ("litellm/", "any-llm/"):
|
for prefix in ("litellm/", "any-llm/"):
|
||||||
if name.lower().startswith(prefix):
|
if name.lower().startswith(prefix):
|
||||||
name = name[len(prefix) :]
|
name = name[len(prefix) :]
|
||||||
|
|||||||
Reference in New Issue
Block a user