resolved bug with doing a raw call to anthropic compatible apis (#21336)

This commit is contained in:
Jeremy Mumford
2026-02-19 16:04:49 -07:00
committed by GitHub
parent f66b23de75
commit 6ef365d062

View File

@@ -313,8 +313,14 @@ async function requestAnthropicVerification(params: {
apiKey: string;
modelId: string;
}): Promise<VerificationResult> {
// Use a base URL with /v1 injected for this raw fetch only. The rest of the app uses the
// Anthropic client, which appends /v1 itself; config should store the base URL
// without /v1 to avoid /v1/v1/messages at runtime. See docs/gateway/configuration-reference.md.
const baseUrlForRequest = /\/v1\/?$/.test(params.baseUrl.trim())
? params.baseUrl.trim()
: params.baseUrl.trim().replace(/\/?$/, "") + "/v1";
const endpoint = resolveVerificationEndpoint({
baseUrl: params.baseUrl,
baseUrl: baseUrlForRequest,
modelId: params.modelId,
endpointPath: "messages",
});