diff --git a/servers/fastapi/services/llm_client.py b/servers/fastapi/services/llm_client.py index e75545a4..a005dd4c 100644 --- a/servers/fastapi/services/llm_client.py +++ b/servers/fastapi/services/llm_client.py @@ -79,14 +79,14 @@ class LLMClient: ) def _get_custom_client(self): - if not (get_custom_llm_api_key_env() and get_custom_llm_url_env()): + if not get_custom_llm_url_env(): raise HTTPException( status_code=400, - detail="Custom LLM API Key is not set", + detail="Custom LLM URL is not set", ) return AsyncOpenAI( base_url=get_custom_llm_url_env(), - api_key=get_custom_llm_api_key_env(), + api_key=get_custom_llm_api_key_env() or "null", ) # ? Prompts diff --git a/servers/fastapi/utils/model_availability.py b/servers/fastapi/utils/model_availability.py index a546640e..4f942ac7 100644 --- a/servers/fastapi/utils/model_availability.py +++ b/servers/fastapi/utils/model_availability.py @@ -92,15 +92,12 @@ async def check_llm_and_image_provider_api_or_model_availability(): elif is_custom_llm_selected(): custom_model = get_custom_model_env() custom_llm_url = get_custom_llm_url_env() - custom_llm_api_key = get_custom_llm_api_key_env() if not custom_model: raise Exception("CUSTOM_MODEL must be provided") if not custom_llm_url: raise Exception("CUSTOM_LLM_URL must be provided") - if not custom_llm_api_key: - raise Exception("CUSTOM_LLM_API_KEY must be provided") available_models = await list_available_openai_compatible_models( - custom_llm_url, custom_llm_api_key + custom_llm_url, get_custom_llm_api_key_env() or "null" ) print("-" * 50) print("Available models: ", available_models)