fix: enable store=true for Azure OpenAI Responses API

Azure OpenAI endpoints were not recognized by shouldForceResponsesStore(),
causing store=false to be sent with all Azure Responses API requests.
This broke multi-turn conversations because previous_response_id referenced
responses that Azure never stored.

Add "azure-openai-responses" to the provider whitelist and
*.openai.azure.com to the URL check in isDirectOpenAIBaseUrl().

Fixes #27497

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 185f3814e9)
This commit is contained in:
Ubuntu
2026-02-26 12:12:20 +00:00
committed by Peter Steinberger
parent 71e45ceecc
commit 0ab5f4c43b

View File

@@ -14,7 +14,7 @@ const ANTHROPIC_1M_MODEL_PREFIXES = ["claude-opus-4", "claude-sonnet-4"] as cons
// NOTE: We only force `store=true` for *direct* OpenAI Responses.
// Codex responses (chatgpt.com/backend-api/codex/responses) require `store=false`.
const OPENAI_RESPONSES_APIS = new Set(["openai-responses"]);
const OPENAI_RESPONSES_PROVIDERS = new Set(["openai"]);
const OPENAI_RESPONSES_PROVIDERS = new Set(["openai", "azure-openai-responses"]);
/**
* Resolve provider-specific extra params from model config.
@@ -184,10 +184,10 @@ function isDirectOpenAIBaseUrl(baseUrl: unknown): boolean {
try {
const host = new URL(baseUrl).hostname.toLowerCase();
return host === "api.openai.com" || host === "chatgpt.com";
return host === "api.openai.com" || host === "chatgpt.com" || host.endsWith(".openai.azure.com");
} catch {
const normalized = baseUrl.toLowerCase();
return normalized.includes("api.openai.com") || normalized.includes("chatgpt.com");
return normalized.includes("api.openai.com") || normalized.includes("chatgpt.com") || normalized.includes(".openai.azure.com");
}
}