SyntaxError: The requested module 'openai' does not provide an export named 'Configuration'

I have been facing an issue in my code while trying to run the chatbot using OpenAI API .
I can’t understand why it’s showing like this.
I am attaching my code and the error I am facing for reference.


import { config } from "dotenv";

import { Configuration, OpenAIApi } from "openai";

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
const openai = new OpenAIApi(configuration);

async function chat(input) {
  const messages = [{ role: "user", content: input }];

  const response = await openai.createChatCompletion({
    model: "gpt-3.5-turbo",
    messages: messages,
    temperature: 0,


const question = "What is the capital of France";

  .then((response) => console.log(response))
  .catch((error) => console.error(error));

Both Configuration and OpenAIApi do not exist in the openai package anymore. See Usage, Docs, and the Upgrade guide.