diff --git a/sgpt/handlers/handler.py b/sgpt/handlers/handler.py index 130941ee..17de257b 100644 --- a/sgpt/handlers/handler.py +++ b/sgpt/handlers/handler.py @@ -13,7 +13,6 @@ use_litellm = cfg.get("USE_LITELLM") == "true" additional_kwargs = { "timeout": int(cfg.get("REQUEST_TIMEOUT")), - "api_key": cfg.get("OPENAI_API_KEY"), "base_url": None if base_url == "default" else base_url, } @@ -25,7 +24,7 @@ else: from openai import OpenAI - client = OpenAI(**additional_kwargs) # type: ignore + client = OpenAI(api_key=cfg.get("OPENAI_API_KEY"), **additional_kwargs) # type: ignore completion = client.chat.completions.create additional_kwargs = {}