Azure api manger buffers the entire SSE stream before forwarding it to clients when the backend is an Azure OpenAI endpoin

Jeffrey Bakker 0 Reputation points
2026-09-02T07:29:05.2+00:00

APIM's internal CacheModelProcessStreamHandlerLegacybuffers the entire SSE stream before forwarding it to clients when the backend is an Azure OpenAI endpoint, despite buffer-request-body="true" buffer-response="false" being explicitly set on forward-request. This defeats streaming and significantly increases TTFT. The "Legacy" suffix suggests a non-buffering implementation exists but is not being used. Even when removing our token limet and llm-emit metric policies we still get this buffering behavior. A month or 2 ago this was not the case.
*User's image

**

Azure API Management
Azure API Management

An Azure service that provides a hybrid, multi-cloud management platform for APIs.


1 answer

Sort by: Most helpful
  1. Mohammad Altaf 450 Reputation points Microsoft External Staff Moderator
    2026-09-15T09:42:43.87+00:00

    Hi @Jeffrey Bakker

    The reported behavior indicates that Azure API Management is buffering the Server-Sent Events (SSE) response from the Azure OpenAI backend instead of forwarding the streamed content to the client as it is generated. For SSE scenarios, the forward-request policy should be configured with buffer-response="false" so that events are relayed immediately to the client. Microsoft documentation also notes that response inspection, validation, caching, and request/response body diagnostics can affect streaming behavior and should be reviewed when troubleshooting SSE-related issues.

    Since buffer-response="false" was already configured and the token limit and LLM metric policies were removed, the next step is to verify whether the streaming behavior is observed only through API Management or also when calling the Azure OpenAI endpoint directly. Additionally, review any diagnostics or response-processing configurations that may be inspecting or logging response bodies, as these can impact streaming behavior.

    If the issue persists, please reopen the thread and provide the APIM SKU, APIM region, Azure OpenAI region, and an APIM trace for a sample request so that further analysis can be performed.

    If the assistance was helpful, kindly take a moment to click on Accept Answer and click on Yes. It will be helpful for other community members.

    Thank you.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.