From dcfca3d11f5250d394feb006f4ac24e0afeb8ee9 Mon Sep 17 00:00:00 2001 From: "mendral-app[bot]" <233154221+mendral-app[bot]@users.noreply.github.com> Date: Wed, 3 Jun 2026 14:00:48 -0700 Subject: [PATCH] feat: add BL_MODEL_GATEWAY_URL env var to override mk3 gateway endpoint The model gateway at mdl-model-gateway-esb1qo.bl.run is returning 404 (service no longer deployed). This adds a BL_MODEL_GATEWAY_URL environment variable that overrides the API-provided metadata URL for mk3 models, allowing CI and users to point to a working gateway endpoint. Affected packages: @blaxel/core, @blaxel/vercel, @blaxel/langgraph, @blaxel/llamaindex --- @blaxel/core/src/common/settings.ts | 4 ++++ @blaxel/langgraph/src/model.ts | 2 +- @blaxel/llamaindex/src/model.ts | 2 +- @blaxel/vercel/src/model.ts | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/@blaxel/core/src/common/settings.ts b/@blaxel/core/src/common/settings.ts index c36c5965..51670e78 100644 --- a/@blaxel/core/src/common/settings.ts +++ b/@blaxel/core/src/common/settings.ts @@ -306,6 +306,10 @@ class Settings { return false; } + get modelGatewayUrl() { + return env.BL_MODEL_GATEWAY_URL || undefined; + } + get region() { return env.BL_REGION || undefined; } diff --git a/@blaxel/langgraph/src/model.ts b/@blaxel/langgraph/src/model.ts index bc89e13f..7233f572 100644 --- a/@blaxel/langgraph/src/model.ts +++ b/@blaxel/langgraph/src/model.ts @@ -64,7 +64,7 @@ export const blModel = async ( // mk3 models use the direct gateway URL and always speak OpenAI-compatible API if (modelData.spec.runtime?.generation === "mk3") { - const gatewayUrl = modelData.metadata.url; + const gatewayUrl = settings.modelGatewayUrl || modelData.metadata.url; if (!gatewayUrl) { throw new Error(`Model ${model} is mk3 but has no gateway URL in metadata`); } diff --git a/@blaxel/llamaindex/src/model.ts b/@blaxel/llamaindex/src/model.ts index 89230f1b..888e70b6 100644 --- a/@blaxel/llamaindex/src/model.ts +++ b/@blaxel/llamaindex/src/model.ts @@ -118,7 +118,7 @@ class BlaxelLLM implements ToolCallLLM { // mk3 models use the direct gateway URL and always speak OpenAI-compatible API if (this.modelData?.spec.runtime?.generation === "mk3") { - const gatewayUrl = this.modelData.metadata.url; + const gatewayUrl = settings.modelGatewayUrl || this.modelData.metadata.url; if (!gatewayUrl) { throw new Error(`Model ${this.model} is mk3 but has no gateway URL in metadata`); } diff --git a/@blaxel/vercel/src/model.ts b/@blaxel/vercel/src/model.ts index caeca07c..60b77794 100644 --- a/@blaxel/vercel/src/model.ts +++ b/@blaxel/vercel/src/model.ts @@ -21,7 +21,7 @@ export const blModel = async ( // mk3 models use the direct gateway URL and always speak OpenAI-compatible API if (modelData.spec.runtime?.generation === "mk3") { - const gatewayUrl = modelData.metadata.url; + const gatewayUrl = settings.modelGatewayUrl || modelData.metadata.url; if (!gatewayUrl) { throw new Error(`Model ${model} is mk3 but has no gateway URL in metadata`); }