- Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Confirm this is a Node library issue and not an underlying OpenAI API issue
- This is an issue with the Node library
Describe the bug
I want to call Azure openai v1 chat completion api
Ideally the request should like POST{endpoint}/openai/v1/chat/completions
But our node library send request like POST{endpoint}/openai/v1/deployments/{model}/chat/completions?api-version=preview which finally got 404 error

I tried to update package to latest version 6.3.0 but it doesn't help.
I did a bit trouble shooting in source code and found that:
if the api address exists in _deployments_endpoints array, the it will set/deployments/${model}${options.path} in the path (See https://github.com/openai/openai-node/blob/master/src/azure.ts#L134 )
I saw there is a similar issue #1607 ,but response api is not in the _deployments_endpoints array so it won't impact response api
To Reproduce
Run the code like following, then I got 404 error
constoptions: AzureClientOptions={apiKey: AZURE_OPENAI_API_KEY,baseURL:AZURE_OPENAI_ENDPOINT.endsWith("/")? AZURE_OPENAI_ENDPOINT+"openai/v1/":AZURE_OPENAI_ENDPOINT+"/openai/v1/",deployment: "gpt-4.1",apiVersion:"preview",dangerouslyAllowBrowser: true,};this.client=newAzureOpenAI(options);conststream=awaitthis.client.chat.completions.create({model: "gpt-4.1",messages: [{role: "user",content: "Hello",},],stream: true,});Please let me know if there is other way to call azure openai v1 chat completion api successfully
Code snippets
OS
win11
Node version
Node v22
Library version
openai 6.3.0