mirror of
https://github.com/usestrix/strix.git
synced 2026-08-28 05:25:00 +00:00
fix(config): resolve LLM CONNECTION FAILED by injecting api credentials directly into LitellmModel instead of mutating global module state
This commit is contained in:
parent
8ede419dcc
commit
d39735ba06
1 changed files with 5 additions and 2 deletions
|
|
@ -483,6 +483,11 @@ class StrixProvider(MultiProvider):
|
|||
)
|
||||
else:
|
||||
model = super().get_model(model_name)
|
||||
if type(model).__name__ == "LitellmModel":
|
||||
if llm.api_key:
|
||||
model.api_key = llm.api_key
|
||||
if llm.api_base:
|
||||
model.base_url = llm.api_base
|
||||
if llm.disable_streaming:
|
||||
model = _NonStreamingModel(model)
|
||||
# The wrapper emits its single event only once the whole request
|
||||
|
|
@ -562,11 +567,9 @@ def configure_sdk_model_defaults(settings: Settings) -> None:
|
|||
_configure_openrouter_attribution(llm.model)
|
||||
if llm.api_key:
|
||||
set_default_openai_key(llm.api_key, use_for_tracing=False)
|
||||
_configure_litellm_default("api_key", llm.api_key)
|
||||
_mirror_api_key_to_provider_env(llm.model, llm.api_key)
|
||||
if llm.api_base:
|
||||
os.environ["OPENAI_BASE_URL"] = llm.api_base
|
||||
_configure_litellm_default("api_base", llm.api_base)
|
||||
set_default_openai_api("chat_completions")
|
||||
else:
|
||||
set_default_openai_api("responses")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue