Error with importing Configuration in Node.js

In Node.js, I got the following error when I ran the sample code provided by OpenAI in its published document to access GPT API. Has anyone had the same problem? How did you solve it? Thanks.

import { Configuration, OpenAIApi } from ‘openai’;
^^^^^^^^^^^^^
SyntaxError: The requested module ‘openai’ does not provide an export named ‘Configuration’
?[90m at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)?[39m
?[90m at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)?[39m

Node.js v19.7.0

2 Likes
3 Likes

Many thanks! The Migration Guide you gave works. I had strictly followed the API document to give it a try. Apparently now, their documentation is not up to date.

3 Likes