{"msg":"Missing credentials","status":"error"}

When you put your API key in JavaScript anyone can read that. It is very much not suggested to ever do. Also “image-alpha-001” doesn’t seem to be a model that can be accessed. Maybe this can help you Questions about the API and Dall-e! or this https://platform.openai.com/docs/guides/images/introduction?context=node
Are you having ChatGPT write this code for you?