431 RequestHeaderFieldsTooLarge when calling certain Azure Open AI models via APIM
We're calling Azure Open AI from Power Automate to do chat completions.
Because the model we're using (gpt-35-turbo-16k 0613) will be retired soon, we're trying different models, however they all fail with 431 RequestHeaderFieldsTooLarge.
This only happens when we access Open AI via a vNet and a Private Endpoint, it works fine when we access the public endpoint directly. However we can't do this in production due to security restrictions.
I believe this is because the vNet call goes via APIM, based on the same issue reported previously in different scenarios:
https://github.com/microsoft/sample-app-aoai-chatGPT/issues/875
https://community.openai.com/t/request-header-fields-too-large/935726
We get this issue with the following models we've tried:
- gpt-35-turbo 0125
- gpt-4o-mini
I've tried different API versions including:
- 2024-10-21
2025-01-01-preview
As I said above we don't get the issue when using gpt-35-turbo-16k 0613. Nothing else changes between working and non-working calls other than the deployment name.
(I should point out we're not sending images, I believe this is due to APIM adding additional headers).