From ad29153a2fe8a76c3b06babaca5aaaf016146343 Mon Sep 17 00:00:00 2001 From: Doron Chen Date: Mon, 10 Aug 2026 10:08:31 +0300 Subject: [PATCH] fix(gateways): strip trailing /v1 from OPENAI_API_BASE in bifrost/start bifrost's openai/anthropic provider clients append their own /v1/... suffix to network_config.base_url. This repo's convention (matching the OpenAI SDK) is that OPENAI_API_BASE already includes a trailing /v1, so substituting it unmodified into bifrost's config produced a doubled path (/v1/v1/chat/completions) that 404'd on every request. Strip the trailing /v1 before substitution, mirroring litellm/start's identical normalization. Signed-off-by: Doron Chen --- containers/gateways/bifrost/start | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/containers/gateways/bifrost/start b/containers/gateways/bifrost/start index 77c0c658..926d5d95 100644 --- a/containers/gateways/bifrost/start +++ b/containers/gateways/bifrost/start @@ -76,8 +76,16 @@ if [ -f "$TEMPLATE" ]; then : "${OTEL_EXPORTER_OTLP_ENDPOINT:=http://otelcol:4318}" OTEL_COLLECTOR_URL="${OTEL_EXPORTER_OTLP_ENDPOINT%/}/v1/traces" + # bifrost's openai/anthropic provider clients append their own /v1/... path, + # so network_config.base_url must be the bare root — but OPENAI_API_BASE + # follows the OpenAI-SDK convention of already including /v1 (see + # docs/guides/deploy-on-kubernetes.md). Strip it here so the template's + # ${OPENAI_API_BASE} substitution lands on the root the client expects + # (mirrors litellm/start's identical normalization). + ROOT_API_BASE=${OPENAI_API_BASE:-}; ROOT_API_BASE=${ROOT_API_BASE%/}; ROOT_API_BASE=${ROOT_API_BASE%/v1} + sed -e "s|\${GOVERNANCE}|${GOVERNANCE}|g" \ - -e "s|\${OPENAI_API_BASE}|${OPENAI_API_BASE-}|g" \ + -e "s|\${OPENAI_API_BASE}|${ROOT_API_BASE}|g" \ -e "s|\${OTEL_COLLECTOR_URL}|${OTEL_COLLECTOR_URL}|g" \ < "$TEMPLATE" > "$CONFIG" fi