Skip to content

404 Error When Calling ResponseAPI Endpoint on Azure OpenAI #1607

@s-natsubori

Description

@s-natsubori

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

When trying to call the ResponseAPI on Azure OpenAI, I am receiving a 404 error.

This may be caused by the following function:

options.path = `/deployments/${model}${options.path}`;

  • Intended endpoint:
    https://my-aoai.openai.azure.com/openai/v1/responses

  • Actual endpoint being called:
    https://my-aoai.openai.azure.com/openai/deployments/responses

To Reproduce

import { AzureOpenAI } from "openai";
client = new AzureOpenAI({
      azureADTokenProvider,
      baseURL: https://my-aoai.openai.azure.com/openai,
      apiVersion: 'preview'
    });
const stream = await client.responses.create({
      model: "gpt-4.1",
      input: [
        {
          role: "user",
          content: "Say 'double bubble bath' ten times fast.",
        },
      ],
      stream: true,
    });

Code snippets

OS

Windows11

Node version

Node v22.17.0

Library version

"openai": "^5.12.0"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions