Running into a constant roadblock with Quickstart Tutorial

I have been hitting a roadblock in the quickstart tutorial which has not allowed me to continue in my learning.

Getting to Pet name generator and the following error message comes up:
OpenAI API key not configured, please follow instructions in README.md
I have inputted the key but it’s not reading, did I save it wrong?

greg.manly@Esc-EG-Mac-GregM openai-quickstart-node-master % npm install
npm run dev

up to date, audited 27 packages in 903ms

3 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

openai-quickstart-node@0.1.0 dev
next dev

ready - started server on 0.0.0.0:3000, url: http:// localhost:3000
event - compiled client and server successfully in 573 ms (150 modules)
wait - compiling / (client and server)…
event - compiled client and server successfully in 210 ms (170 modules)
wait - compiling /api/generate (client and server)…
event - compiled successfully in 35 ms (45 modules)

It appears you need to look closely at the API key section of the document - and if not in a free trial period, have a payment method for the use of API.

https://platform.openai.com/docs/quickstart/add-your-api-key

You can use other methods for setting an environment variable for the user account of the web server.

The only thing I see is that I need a make copy on the envinoment but when I do input it I get the following.
cd openai-quickstart-node
cp .env.example .env
cd: no such file or directory: openai-quickstart-node
greg.manly@Esc-EG-Mac-GregM openai-quickstart-node-master 2 %

Ensure you are picking the node.js or Python flask button above the examples to get appropriate code for the particular server extensions you wish to program for.

Note: the quickstart is not for those with zero background in web programming and setting up server environments. You should be able to mostly understand the code, as the quickstart example is lame, and you will soon need to change it to do something useful and use the chat completions endpoint.

1 Like

copy .env.example as .env in the same directory.

open .env and add your API KEY

# Do not share your OpenAI API key with anyone! It should remain a secret.
OPENAI_API_KEY=PUT-YOUR-OPENAI-API-KEY-HERE

the instruction you are following is assuming the folder is openai-quickstart-node but in your case it is openai-quickstart-node-master that is why you are getting no such file or directory.

Note: I should add that the version of the OpenAI module in that quickstart is just 3.0. So if you look at other tutorials, initialization might be different. Just follow the code in quickstart as is.

1 Like

This was extremely helpful! Thank you.