Visually explore OpenAI's Image APIs without coding custom UI
Tags: vscode, productivity, opensource, bash
Published: 2023-04-19 01:56:39

While chatGPT has been all the craze, OpenAI’s underlying APIs offer much more. Outside of GPT4, the core piece to chatGPT, OpenAI provides AI Image-Generation APIs under the DALL-E umbrella.

>💡 OpenAI’s description: DALL·E 2 is an AI system that can create realistic images and art from a description in natural language. 👉 [https://openai.com/product/dall-e-2](https://openai.com/product/dall-e-2)

These APIs are plain amazing…! They allow you to take an existing image and describe in words what edits you’d like the AI to make for you. It's like magic!

## 🙌 No UI Coding Required


![Edit image using words via AI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vbcj4mq14q747mm3geve.gif)
> Edit a ball pit into the image? Easy!

You can learn how to use DALL-E's APIs without writing custom code. We'll showcase this using Runme, which lets you create Markdown notebooks with interactive Shell commands, similar to Jupyter for Python.
> 🛠 Please give Runme a spin, [install here](https://marketplace.visualstudio.com/items?itemName=stateful.runme) or search `runme` inside VS Code

My dog Luna 🐕 offered to help us make our point! Right below, you’ll see Luna at a doggy friend’s birthday party in real life. All we’re using is a simple scene prompt: “*a happy german shepherd dog surrounded by cheeseburgers*”:


<img className="mr-1" src="https://media.graphassets.com/cy7fRH1QtmWcmrLUDZDz" alt="Original image of Luna" />
> Unedited image of Luna

<img src="https://media.graphassets.com/S1rxizxmRxyX0XmfTAV9" alt="Luna with faux cheeseburgers" />
> No way Luna would sit this calmly if those cheeseburgers were real 🤭

## 👩‍💻 Try It Yourself
[![](https://badgen.net/badge/Open%20with/Runme/5B3ADF?icon=https://runme.dev/img/logo.svg)](https://runme.dev/api/runme?repository=https%3A%2F%2Fgithub.com%2Fsourishkrout%2Floon.git&fileToOpen=AI.md)

Head to [https://platform.openai.com/](https://platform.openai.com/) to get an API key and follow our Runme notebook. Depending on how much you plan on using the API, OpenAI puts a limit on its free tier.

The repo with the notebook is available here: [https://github.com/sourishkrout/loon](https://github.com/sourishkrout/loon)

![Runme notebook for AI image editing](https://media.graphassets.com/U00yeJ56RU6VsBKeKbcs)

## 🖥 Skip The Notebook, Use The CLI
If you live in the terminal, use the [Runme CLI](https://runme.dev/docs/cli) instead. After you clone the repo, drop your `OPENAI_API_KEY=<super secret>` into your environment. Then, do this:

```sh
$ runme run --filename AI.md install-deps
$ runme run --filename AI.md run-scene | jq -r ".data[0]" # btw, output URL expires
{
  "url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-tm5BAbynhBsE9Lzy1HTD6sk0/user-7A9nqIQ8tVXN7epnIqZs6fca/img-Hc1KHk6lkJegAkMqUWSL9D0i.png?st=2023-04-18T13%3A56%3A07Z&se=2023-04-18T15%3A56%3A07Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-04-18T11%3A36%3A32Z&ske=2023-04-19T11%3A36%3A32Z&sks=b&skv=2021-08-06&sig=9oEyq1os4zwf6rvb67W1rPDkTsPd%2BZ%2B1VHi/gWaz17M%3D"
}
```
Most terminal emulators will allow you to click the URL to open it in a browser. That's it!

## 🌠 Make Your Own

We've explained how to use your images within the Runme notebook. The originals are also included with the notebook in [the repository](https://github.com/sourishkrout/loon). Interestingly, the more background you mask (let the AI know what not to preserve), the more drastically the AI morphs the scene. Let us know what you think. You can find us [on Discord](https://discord.gg/stateful). Please drop by and share one of your own DALL-E impressions!

Thank you.