From 068260bbeac306064e4bd0495f7ed10ad38e1fe4 Mon Sep 17 00:00:00 2001 From: OpenClaw Bot Date: Mon, 16 Feb 2026 13:42:37 +0000 Subject: [PATCH] fix: add api-version query param for Azure verification --- src/commands/onboard-custom.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/commands/onboard-custom.ts b/src/commands/onboard-custom.ts index bfe18a63f0..6e180cb9ae 100644 --- a/src/commands/onboard-custom.ts +++ b/src/commands/onboard-custom.ts @@ -254,10 +254,15 @@ async function requestOpenAiVerification(params: { const resolvedUrl = isAzureUrl(params.baseUrl) ? transformAzureUrl(params.baseUrl, params.modelId) : params.baseUrl; - const endpoint = new URL( + const endpointUrl = new URL( "chat/completions", resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`, - ).href; + ); + // Azure requires api-version query parameter + if (isAzureUrl(params.baseUrl)) { + endpointUrl.searchParams.set("api-version", "2024-10-21"); + } + const endpoint = endpointUrl.href; try { const res = await fetchWithTimeout( endpoint, @@ -290,8 +295,15 @@ async function requestAnthropicVerification(params: { const resolvedUrl = isAzureUrl(params.baseUrl) ? transformAzureUrl(params.baseUrl, params.modelId) : params.baseUrl; - const endpoint = new URL("messages", resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`) - .href; + const endpointUrl = new URL( + "messages", + resolvedUrl.endsWith("/") ? resolvedUrl : `${resolvedUrl}/`, + ); + // Azure requires api-version query parameter + if (isAzureUrl(params.baseUrl)) { + endpointUrl.searchParams.set("api-version", "2024-10-21"); + } + const endpoint = endpointUrl.href; try { const res = await fetchWithTimeout( endpoint,