Creating pictures using the Images endpoint
The OpenAI API can do more than generate text (although that is its main purpose); it can also create images. It does this with a similar methodology to text generation, but instead of predicting characters, it predicts pixels. The inner workings of the model are complex (it involves the use of encoders, decoders, and embeddings), but that doesn’t stop us from actually using the model.
This significantly opens up the types of applications you can create with the OpenAI API. For example, you can create an application that produces stock images based on a user prompt. In this recipe, we will use the OpenAI API to generate several types of images.
How to do it…
- In Postman, create a new request by selecting the New button on the top-left menu bar, and then select HTTP.
- Change the HTTP request type from GET to POST in the Method drop-down menu (by default, it will be set to GET).
- Enter the following URL as the...