openai4j icon indicating copy to clipboard operation
openai4j copied to clipboard

Api key

Open juancadavid opened this issue 1 year ago • 1 comments

Hello, I'm trying to use our Azure OpenAI deployment using openai4j. Problem is, the tenant expects the API key within a header called "Ocp-Apim-Subscription-Key" and not "api-key" as it has been hardcoded in src/main/java/dev/ai4j/openai4j/ApiKeyHeaderInjector.java.

The MS documentation says we can change the headers' name, but it just won't work and always reply 401 to all requests. Only works if the header is called "Ocp-Apim-Subscription-Key": https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions

Any recommended solutions, besides forking the code and making the change in this file :) ? Thanks in advance !

Juan

juancadavid avatar Oct 28 '23 18:10 juancadavid