im new to nextjs and open ai api-
my code where the api is been called -
const response = await fetch('/api/image-generation')
console.log(response)```
the api file-
```import type { NextApiRequest, NextApiResponse } from "next";
import { Configuration, OpenAIApi } from "openai";
const config = new Configuration({apiKey: process.env.OPENAI_KEY})
const openai = new OpenAIApi(config);
export default async function imageHandler(req:NextApiRequest, res:NextApiResponse) {
const response = await openai.createImage({
prompt: "man in neo Tokyo, Akira movie vibes, anime",
n: 3,
size: "1024x1024",
})
res.status(200).json({result: response.data})
}```