OpenAI Component Image Generator

Igor Bešlić avatar
Igor Bešlić
Cover for OpenAI Component Image Generator

Have you ever approach the end of project and realized you need an image? What ever you do now days you’ll bump into image issue. It is always hurry, and you usually end up digging many stock image sites that promise free images. You hope you won’t be bullied with adverts, requests for email or digital watermarks, but hope is futile. Latest but not free solution is OpenAI. Even it’s not free, the price and time invested into process of getting original image is really not an issue here.

OpenAI - Obtain API Key

To use OpenAI it is mandatory to pass registration procedure. Once your account is activated an API key can be created in OpenAI Dashboard. Go to OpenAPI Platform. Locate Dashboard and create API Key following the steps in the guide bellow.

Remember to keep key value somewhere you’ll be able to access it again in upcoming steps.

OpenAI Component Create Image Action

Assuming you are familiar with ByteChef Project and Workflow concept I’ll immediately observe and describe OpenAI Component and corresponding connection configuration. Here I have already created Samples project and AI Generated Image workflow. Project and Workflow

Workflow consists of just one step represented by OpenAI component which is enough to get image fast. Project and Workflow

OpenAI Component Connection

Click OpenAI component box to open properties. From Actions menu select Create Image option. Click Connection tab. Notice Connection drop down input box. Assuming you have no connection setup click + sign on the right to create one. Check details in this guide

OpenAI Component Configuration

Now configure couple parameters for AI. Chose Dall-e-2 model, quality should be set to Standard, response format url. In my example I’ll ask AI to Create image of human being trying to paint image at tableand I populate Prompt field with that instruction. Please don’t forget to click Advanced properties and set Response Read Timeout to 30 seconds. Particular generations may take long so this setting should be fine. For more details check this step-by-step guide

Test Component and Get the Image

At this moment I’m still in design mode. I mentioned, I’m in a hurry. I’ll test component immediately here with the goal to obtain image. Only thing left is to click that green play button on the top of ByteChef workspace. It will take ten to twenty seconds until spinner disappears and workflow output shows at the bottom of workspace. Project and Workflow Scroll down until you locate output section. Copy that super long image URL and paste it in your browsers address bar. I’m not happy with my image, but you might have more luck! Project and Workflow

Conclusion

By following these tips, you can instruct AI to create images for you. Example has no business value, but imagine particular business requirement that expects you to populate database with sample icons or thumbnails. ByteChef loop can process other data and feed OpenAI prompt and prepare your images while you are sleeping.