From ee363eb7d903c9c5948949bd9e1b3c469bfff583 Mon Sep 17 00:00:00 2001 From: csgulati09 Date: Thu, 10 Oct 2024 20:36:37 +0530 Subject: [PATCH] feat: Making API Key optional is self hosted gateway --- src/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 445607a..9dcdc5c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -108,13 +108,13 @@ export class Portkey extends ApiClient { mistralFimCompletion, }); + this.baseURL = baseURL || PORTKEY_BASE_URL; this.apiKey = apiKey; - if (!this.apiKey) { + if (this.baseURL === PORTKEY_BASE_URL && !this.apiKey) { throw castToError(MISSING_API_KEY_ERROR_MESSAGE); } this.virtualKey = virtualKey || null; this.config = config || null; - this.baseURL = baseURL || PORTKEY_BASE_URL; this.provider = provider; this.traceID = traceID; this.metadata = metadata;