Fantasy Character Avatar Generator with DALLE2 API

Not live or finished yet, but I’m making progress…

If anyone has questions, lemme know. I’m no expert, but happy to help if I can.


Hi !

Great job :slight_smile:
I would like to play with DALLE2 API too, but I have this error “TypeError: openai.createImage is not a function” when I run this code:

const { Configuration, OpenAIApi } = require("openai");
const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
const openai = new OpenAIApi(configuration);
(async () => {
const response = await openai.createImage({
  prompt: "A cute baby sea otter",
  n: 2,
  size: "1024x1024",

Can you help to use it please ?

I’m using PHP and cURL, sorry.

Where did you get the example code?

1 Like

More than one image…

Okay, thanks.
I took this example here OpenAI API (node.js)

Can you tell me how you generate these images in php and cURL?

Hrm. Maybe your code is fine and the node.js API is down? It’s just the code from their site.

Maybe try it without " (async () => {" ??

With it saying it is not a function, it sounds like node isn’t loading openai correctly…

Where are you trying to run the code?

Good luck!

Adding styles… three so far…

Did you get it working?

Thank you very much for your help.
I just needed to update the openai package to get the function

1 Like

Sweet. Happy to help.

Making some progress here…

That’s cool. I’m half way in legal assistant core proof of concept (already better than what’s available here in France) and it runs on PHP and file_get_contents() with context for API calls… The only thing is all calls are chained in this setup… Soon time to move to a better UI. Glad to see I’m not alone running on PHP.

1 Like


I’m dealing with saving/storing the images. Getting closer…

And, yeah, PHP is my go to still. I started with BASIC, Perl, and others.

Good luck on your app!

1 Like

Thanks for the heads ups

1 Like

My first programming was when I was a kid, on Zx Spectrum 128k I tried to build text editor with ability to save files on tape and print. Then got back to computers as a hobby in my late 20s.

1 Like

I remember saving to tape drive. I put together a Zork clone for a school contest. Those were the days. Heh.

1 Like


I love the Fantasy Character stuff.
And I’d like to get started and be able to do this… but, I have another question.

First, I’m a programmer from old days but retired and rusty. If anyone could give me a link of where to get started setting up on my machine… I have Windows 10 Pro, and what compile dev environment would be needed for compiling, or running this if runtime already avail. (I have the public web based sample access, and would like to put on my machine instead.)

My background is eclectic with languages, I’ve forgotten more than I know; but, can set up whatever is needed if the code requirements are known. So, if anyone knows a good place to start, could you provide a URL … I’m guessing the question is, get the OPENAI and it will need to use WHAT? , and I’m completely knew to this. Thanks ahead for your time and consideration of help!

Everything’s pretty much here.

Let me know if you run into any problems. Good luck.