Join our AI Art Community on YouTube
YouTube

How to Get DALL-E API Access

Want to know how to get access to the new DALL-E API?

As AI art generators have become increasingly popular throughout the year, more and more developers have been desperately searching for ways to integrate them into their product ideas.

In this guide, we’ll show you how to get access, where to find your DALL-E API key, and how to make your first requests to the API via cURL.

Let’s dive right in.

Like this content? Then share it!

How to Get Access to the DALL-E API

On November 3rd, 2022, OpenAI officially announced that it was making its DALL-E API available to the public.

Developers from around the world have been desperately waiting to get access to any of the popular new AI art generators so they can start to experiment with it on their own projects.

Getting access to the DALL-E API is actually surprisingly easy.

If you already have an API key for OpenAI from a previous project in which you’ve used OpenAI’s GPT-3 or Codex AI models, then you can simply use the same API key for the DALL-E model as well.

However, if this is your first time using any of OpenAI’s APIs, you’ll have to generate an API key first.

But don’t worry, it’s a lot easier than you might think.

Check out the next section to find step-by-step instructions on how to get a DALL-E API key.

Key Points (tl;dr)
  • To get access to the DALL-E 2 API, you must first create a free account with OpenAI (https://openai.com/api/).
  • Once you have an account, you can generate an API key that you can use to send requests to any of the 3 API endpoints that are currently available.
  • Every account is given $18 worth of trial credits to experiment with the API. Every request or image generation costs between $0.016 and $0.02 depending on the chosen resolution.

Where to Get Your DALL-E API Key

Step-by-step guide on how to get your DALL-E API key via the OpenAI website.
Step-by-step guide on how to get your DALL-E API key via the OpenAI website.

If you already have an OpenAI API account from previous projects, then you can continue to use the API key that you already have.

However, if this is your first time using any of OpenAI’s APIs or you misplaced or original API key, you can easily generate a new one by following the instructions below.

Here’s how to generate a DALL-E API key:

  • Step 1: Go to the OpenAI API site (Link: https://openai.com/api/).
  • Step 2: Sign up for an account or log in with your Google account.
  • Step 3: Click your profile icon in the top right corner to open the dropdown menu.
  • Step 4: Select “View API keys”.
  • Step 5: Finally, click the “Create new secret key” button and copy the key to your clipboard.

And that’s it. You’ve now generated an OpenAI API key that can be used for any of OpenAI’s models, including the DALL-E API.

Every new API account comes with free trial credits worth $18.00 that you can use to play around with the DALL-E API.

How to Use the DALL-E 2 API

Infographic showing different sample cURL requests to the DALL-E 2 API endpoints (generations, edits, and variations).
Infographic showing different sample cURL requests to the DALL-E 2 API endpoints (generations, edits, and variations).

Since every API works slightly differently and because you’ve probably never used an AI art generator in any of your projects before, here’s a quick start guide on how to use the DALL-E API.

The DALL-E 2 API, also known as the “Images API”, has 3 core methods that you can use to create or manipulate images:

  1. Generations: Create new images based on text prompts.
  2. Edits: Change or extend images based on masks.
  3. Variations: Create variations based on a given image.

Generations

If you want to create a new image based on text prompt input, then the “generations” endpoint is what you need.

It allows you to generate up to 10 images at a time and supports 3 different sizes (256×256, 512×512, and 1024×1024).

Here’s a sample cURL request:

curl https://api.openai.com/v1/images/generations \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"prompt": "a white siamese cat",
"n": 1,
"size": "1024x1024"
}'

Edits

If you want to edit or manipulate an existing image, the “edits” endpoint is the right choice for you.

Basically, you provide an input image, a mask image, and also a new prompt that describes the final output that you’d like to get.

It’s important that your prompt describes the final result and now just that part that you want to edit.

Here’s a sample cURL request:

curl https://api.openai.com/v1/images/edits \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F image='@sunlit_lounge.png' \
-F mask='@mask.png' \
-F prompt="A sunlit indoor lounge area with a pool containing a flamingo" \
-F n=1 \
-F size="1024x1024"

Variations

Finally, the “variations” endpoint allows you to create as many new variations of a given image as you like.

All you need to do is provide a given image and the DALL-E API will create new ones based on the original.

Please bear in mind that the maximum input file size is 4 MB.

Here’s a sample cURL request:

curl https://api.openai.com/v1/images/variations \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F image='@corgi_and_cat_paw.png' \
-F n=1 \
-F size="1024x1024"

Rate Limits

During the public beta phase, the DALL-E API is limited to a default rate of 10 images per minute and 25 images per 5 minutes.

If you need to increase your API limit, please contact the OpenAI developer support team to explain your specific use case.

For more details, please refer to the official DALL-E API documentation.

DALL-E API Pricing in a Nutshell

Table showing the price of individual requests to the DALL-E API.
Table showing the price of individual requests to the DALL-E API.

When you sign up for an OpenAI API account you are given $18 in free credits that you can use to experiment with any of their APIs, including the DALL-E 2 API.

Many people have asked what you can actually do with $18 and that’s why we’ve put together this nice little overview to help you understand the cost of using the DALL-E API.

Essentially, each request to the API will cost you a small about of money while the price is determined by the resolution that you set in the request parameters.

The bigger the image, the more costly the request.

ResolutionPrice
1024×1024$0.020 / image
512×512$0.018 / image
256×256$0.016 / image
Table showing the DALL-E API pricing for different image resolutions.

Frequently Asked Questions (FAQ)

Before we close off this guide, let’s quickly address some of the most common questions related to DALL-E 2 API access.

  • Does DALL-E 2 have an API?

    Yes, the DALL-E 2 API was created by OpenAI and is the underlying interface used by the DALL-E 2 web application. While its API was previously private, OpenAI released it into public beta on November 3rd, 2022.

  • Is the DALL-E API available to the public?

    Yes, the DALL-E API was released into public beta on November 3rd, 2022. To get access to the API you must create an account with OpenAI, which not only gives you access to the DALL-E 2 API but also GPT-3 for AI text generation and Codex for code completion services.

  • How can I access the DALL-E API?

    To get access to the DALL-E 2 API you must first create an account with OpenAI. Once you’re logged in, you can create your API key via the account settings. This API key is crucial for making requests to the API. Every new account is given $18 in trial credits.

Conclusion

For months developers have been itching to get their hands on an API that will allow them to integrate AI art generation into their projects.

The wait is finally over, now that OpenAI has finally released its DALL-E API into public beta for anyone to try out.

It will be exciting to see what all those creative minds come up with.

Here at Tokenized, we want to help you learn as much as possible about the AI software industry. We help you navigate the world of tech and the digitalization of our society at large, including the tokenization of assets and services.

Total
0
Shares
Share
Tweet
Share
Share
Share
Pin it