About this Post

The DALL·E API service is now available under public beta... and it's snazzy.


In early 2021, I briefly highlighted OpenAI's publication on DALL·E: a neural network can generate images from text. Fast forward to earlier this week, and OpenAI has made the DALL·E 2 API available under public beta. 🤯

Definition: DALL·E 2 is a new AI system that can create realistic images and art from a description in natural language. It can combine concepts, attributes, and styles. Source: OpenAI

I've been playing around with it, and I'm impressed with the results and ease of use. Here's a quick, interactive demo I created of what I've been able to do with the API service so far with one of the endpoints... go ahead and try it out!

No snazzy image generated... yet

DALL·E, wrapped under OpenAI's Image API service, has a few endpoints that allow you to interact with images in different ways:

  • Creating an image from text (the above demo)
  • Creating edits of an image based on (a new) text
  • Creating variations of an image based on text

The common denominator between all of these endpoints is that they are driven by text input. The API docs and guides are pretty well documented, which makes it easy to get started.

For example, here's a backend code snippet that uses the OpenAI API to create an image from text:

... const { Configuration, OpenAIApi } = require("openai"); const configuration = new Configuration({ apiKey: process.env.OPENAI_API_KEY, }); const openai = new OpenAIApi(configuration); const response = await openai.createImage({ prompt: "A cup of coffee on a table", n: 3, // number of images to return (between 1 and 10) size: "1024x1024", // image size (256x256, 512x512, or 1024x1024) }); ...

You'll need to sign up for an API key to use the API. Once you sign-up, you'll be able to generate an API key here.

OpenAI has a cookbook of examples that you can use to get started and explore the potential of this and other API services — check it out here on GitHub.

I'm excited to experiment more with this API and see what others do with it too. I'm sure there'll be some interesting projects that come out of this, alongside some of the other API services.

GitHub's Copilot is an example of a handy-dandy tool that uses OpenAI's API services; in this case, Codex, which translates natural language to code.

Oooohh, this should be fun. Thanks for the Technical Preview access @github 🎉🤖 #copilot #code
Oooohh, this should be fun. Thanks for the Technical Preview access @github 🎉🤖

#copilot #code https://t.co/tfHWf0BwjG
Loading...

I've had the pleasure to work with Manny in various projects at Tesla, starting when we first met in Amsterdam when he was here to help establish efficient web processes for the team. He's one of the strongest all-round developers and team leads I've worked with.

Nikolajus Krauklis, Software Engineering Manager @ Tesla
Software Engineering Manager @ Tesla