How to Resolve OPENAI_API_KEY Error when Setting Up Speech to Text to Notion Using OpenAI Chat?

import OpenAI from 'openai';
const openai = new OpenAI({
  apiKey: process.env.APIKEY // This is also the default, can be omitted
});

const completion = openai.createChatCompletion({
  model: "gpt-4",
  messages: [
    {role: "user", content: prompt
    },
    {role: "system", content: `You are an assistant that only speaks JSON. Do not write normal text.

Example formatting: {
        "title": "Notion Buttons",
        "summary": "A collection of buttons for Notion",
        "action_items": [
          "item 1",
          "item 2",
          "item 3"
        ],
        "follow_up": [
          "item 1",
          "item 2",
          "item 3"
        ],
        "arguments": [
          "item 1",
          "item 2",
          "item 3"
        ],
        "related_topics": [
          "item 1",
          "item 2",
          "item 3"
        ]
"sentiment": "positive"
      }
  `
    }
  ],
  temperature: 0.2
}).then(function(result) { completion = result });

that’s the complete code