fix(model_resolver): supply dummy API key for LM Studio when not provided

This commit is contained in:
Anish Sarkar 2026-06-27 03:13:50 +05:30
parent 7093b4d4d0
commit 31ec939da9
2 changed files with 20 additions and 0 deletions

View file

@ -59,6 +59,10 @@ def to_litellm(
kwargs: dict[str, Any] = {}
if api_key:
kwargs["api_key"] = api_key
elif provider == "lm_studio":
# LiteLLM's OpenAI-compatible adapter expects an api_key value even
# when LM Studio accepts unauthenticated local requests.
kwargs["api_key"] = "not-needed"
prefix = spec.litellm_prefix or str(provider)
model_string = f"{prefix}/{model_id}" if prefix else model_id