I had this pending for a while, and by following some Tweets and the project GOIA by Iker Jiménez, it seemed that AI image generation had become really accessible. And it is. There’s enormous advance in this field. But it all has a price.
Image generation from OpenAI, one of Elon Musk giants, named after Dall·E, launched its open API for everyone to test.
It’s got 18$ credit to use during 3 months only by signing up. The rest needs to be paid, but you’ll have enough for making tests, and the it’s only 0.02$ per picture. Additionally it’s easy to use and the results are great.
It’s worth trying it to know what’s the top and at the end I will show you what we, the rest, of the mortals can use daily.
But first… let’s start with a picture of Teide volcano in Tenerife. Is it real or virtual?
OpenAI API
Ok, very quickly, OpenAI is the Artifitial Intelligence (AI) megaproject from Elon Musk & Co. Within the numerous capabilities of this neuronal networks, we can generate images from natural language text, but there's much more.
IA will make our life easier in the future, so have a look at all the examples that are open during Beta testing:
https://beta.openai.com/examples/
Basically, a computer is "trained" with real, well featured, examples so, from them, the computer generates new content to satisfy a request.
The computer will not generate exactly what you want or think, something expected, but it will generate it's own result from your request and what it has been learning during training.
Image generation from natural language might the the most graphical application, but the potential is unimaginable. Up there I just asked Dall·E for the word "Teide". But, what if we think about things that have not happened, that we have not seen, or simple imaginations? Well, AI is able to bring to life your thoughts. Whatever you can imagine is shown on screen.


Now, let's see how to use it.
Dall·E 2 API
To "sell us" the future, OpenAI makes it very easy. We'll find plenty documentation to spend hours in a Beta trial version completely open for three months, and you'll only need an email address.
Sign up to use Dall·E 2 from their web site, pressing Sign Up button.
You'll have to verify your email address and then log into your account. Be careful because you'll be redirected to the commercial site https://labs.openai.com
The trial site is this one:

Create an API key
From the top menu, click on your profile and select View API keys.
If you've just registered, you'll have to generate a new secret, then copy it somewhere safe, as you'll need it to use the API commands.
Using Dall·E 2
That's it. No more requirements. Let's start playing!
Let's see how to generate and image according to the documentation:
https://beta.openai.com/docs/api-reference/images/create
To keep it simple we can use curl, so you just need to open up a terminal, be it in Window, MacOS or Linux. The code indicated is the following:
curl https://api.openai.com/v1/images/generations \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"prompt": "A cute baby sea otter",
"n": 2,
"size": "1024x1024"
}'
Here we need to type our secret key in place of YOUR_API_KEY.
Also write a description for the image you want inside prompt.
With n we define the number of images generated by this request.
And size is the picture size, allowing 256x256, 512x512, o 1024x1024.
I'm going to try with "a map of Mars in paper".
curl https://api.openai.com/v1/images/generations -H "Content-Type: application/json" -H "Authorization: Bearer sk-TuApiKeyAqui" -d "{\"prompt\":\"A map of Mars in paper\",\"n\":1,\"size\":\"1024x1024\"}"
TIP! Copy+paste this code in your terminal, replacing your secret key "sk-..." and the prompt.
You'll get back an URL as a response to your request, which is a web link to the generated image.
Open the link to see the result:

Amazing!
Pricing
Well, well... let's get back to Earth. You wouldn't think this speed and quality would be free, would you? Go back to your OpenAI account where you can see the use that you make fo the API and how you spend your credit.
https://beta.openai.com/account/usage
As I was saying earlier, the Beta offers 18$ to spend during 3 months and every picture in 1024px is about 0,065$ (0,002$ for lowest quality).
All the main AI platforms similar to OpenAI (Midjourney, Nightcafe, DreamAI, etc) work this way, offering some credit for use, as it is the powerful performance of their servers what is being traded.
Alternatives (free ones)
There are various open-source and totally free alternatives. I invite you to try them all and choose the one you like the most, but I must warn you that there are many software and hardware requisites. You specially need a good graphic card (or several of them). In the end, you need to put in the balance how much you'll use the AI, and if it's not worth spending a couple cents for a couple pictures every now and then.
From the 4 recommendations below I have successfully tested the last two, the least powerful of them:
1. Pixray

https://github.com/pixray/pixray
Looks promising for its simple installation and use. Don't trust the picture above (it's their pixelated module) because it has plenty of complex options for very detailed image generation.
There is also plenty documentation made by users and support via Discord.
On the other hand, they recommend about 16GB of VRAM (virtual RAM from the GPU of your graphic card). I crashed for insufficient memory without seeing the results...
2. Dalle-Flow

https://github.com/jina-ai/dalle-flow#Client
Very technical and complex. The results look brilliant, but I couldn't achieve installation or web use. It uses several specific python modules that supposedly run on Google Colab. Or it's discontinued and it's currently broken, or the documentation is poor, or I'm a completely useless on this... Additionally the recommend about 21GB of VRAM to run standalone, although it could be shared using Colab... I could never check.
3. Craiyon

The former Dalle-mini created by Boris Dayma has a pactical web version totally free (no credit or payments, only a few ads while loading).
Although results aren't brilliant from scratch, we can improve them using Upscayl (I'll tell you more about it later).
4. Dalle-playground

https://github.com/saharmor/dalle-playground/
One of the many repositories derived from dalle-mini, in this case comes in a handy package that we can use freely with no cost in our home PC having very little hardware and software requirements. It runs as a local webapp in your browser as it generates a server that you can access anywhere in your network.
Together with Upscayl, they make good tandem to generate AI images in your own PC for free.
Gallery: Dall·E 2









Gallery: Dalle-playground+Upscayl preview




In the next post we'll see how to generate this images in our ordinary PC, with Dalle-playground y Upscayl.
That's all for now! I wait your doubts or comments about this Dall·E post on 🐦 Twitter!