EN ▾
Get API key

Updated

AI Image Prompt Generator: ChatGPT vs Your Own Script

Using an ai image prompt generator chatgpt style, meaning a chat window where you ask for prompts one at a time, works well for ten prompts and badly for five hundred. A short script against an OpenAI-compatible API gives you repeatable batches at a few cents.

One glass speech bubble beside a conveyor carrying rows of glowing cards, comparing manual chat with scripted batches

No card needed. After sign-up, claim $0.50 of free test credit with one click (once per person).

Get API key

Key points

Verdict first

NeedChat windowOwn script
Explore one concept, react, refineBetterAwkward
50 or more prompts in one styleTediousBetter
Same format every time (CSV, JSON)Needs repeated remindersBuilt in
Rerun last month's batch with a tweakHardOne command
No coding at allBetterNot possible

If you only need a handful of prompts, keep using a chat window. The rest of this article is for the point where copy-pasting stops being fun, and for people whose subject matter makes general assistants hesitate.

Where the chat workflow starts to hurt

A chat is a conversation, so it drifts. By prompt 30 the assistant has forgotten how you phrased the style rules at the start, or it pays more attention to your last three messages than to the first. You end up pasting the same reminder again and again.

  • No fixed format. One answer is a paragraph, the next is a bulleted list, and you reformat by hand.
  • No record. Which wording produced the image you liked? The chat scrollback is a poor database.
  • Policy variability. Assistants from large vendors apply content policies that change over time and may decline dark or mature fiction themes. Check the current rules of whichever tool you use rather than assuming.
  • Manual effort. If each prompt takes a minute of your attention, 500 prompts is over eight hours. That figure is an assumption for illustration, but the scaling is real.

What a script gives you

A script turns prompt writing into a function. You write the rules once, in a system message, and every call obeys them. The pieces you control:

  1. The system prompt with the house style and length limits.
  2. The input list, one idea per line in a text file or spreadsheet.
  3. The output file, a CSV you can open in any spreadsheet.
  4. The number of variants per idea, so you can pick the best of three.

It also makes experiments honest. Change one rule, rerun the same ten ideas, and compare. Setting the seed parameter and a low temperature reduces random differences between runs, so you see the effect of your edit and not noise.

The endpoint is OpenAI-compatible, so the code uses the standard Python library. The only changes from a default setup are the base URL, your key and the model ID uncensored. Parameters are listed in the docs.

A script that writes three variants per idea

import csv, os
from openai import OpenAI

client = OpenAI(api_key=os.environ["API_KEY"],
                base_url="https://api.uncensoredimage.com/v1")

RULES = ("Write one image-generation prompt of 40 to 70 words. "
         "Describe subject, composition, camera angle, lighting, palette and style. "
         "Plain text only, no preamble, no quotation marks.")

def variants(idea, n=3):
    out = []
    for i in range(n):
        r = client.chat.completions.create(
            model="uncensored",
            temperature=1.0,
            messages=[{"role": "system", "content": RULES},
                      {"role": "user", "content": idea}],
        )
        out.append(r.choices[0].message.content.strip())
    return out

with open("ideas.txt") as f, open("prompts.csv", "w", newline="") as g:
    w = csv.writer(g)
    w.writerow(["idea", "v1", "v2", "v3"])
    for line in f:
        idea = line.strip()
        if idea:
            w.writerow([idea] + variants(idea))

This version runs one request at a time, which suits a trial key (2 concurrent, 60 per minute). On a full key you can add a thread pool of up to 8 workers and stay inside the 300 per minute limit. If you get HTTP 429, wait the number of seconds in Retry-After and retry.

Cost of the scripted route

The API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens. For the script above, assume 250 input tokens (rules plus idea) and 200 output tokens per call.

  • Input: 250 / 1,000,000 x $0.15 = $0.0000375
  • Output: 200 / 1,000,000 x $0.50 = $0.0001
  • Per call: $0.0001375

For 500 ideas with 3 variants each, that is 1,500 calls: 1,500 x $0.0001375 = $0.20625, so about $0.21. The $0.50 trial credit alone would cover roughly 3,600 such calls. Failed requests are not charged.

The chat-window route may be free or subscription-priced depending on the service you use. Check their current pricing rather than relying on a figure from an article. The honest comparison is time: the script costs cents in credit and saves hours of copy-paste.

Crypto only: top-ups are USDT on TRC20 or USDC on Base, from $20 to $500. Details are on the pricing page.

Mixing both: a practical workflow

You do not have to pick one forever. A workable pattern:

  1. Explore in a chat window until you find a prompt style that produces images you like.
  2. Copy that style into the script's system message as the rules, and add one finished example prompt.
  3. Run a ten-idea test batch and look at the outputs before committing to the full list.
  4. Render the prompts in your image tool of choice. This API does not draw; for what an image-side API involves, see the GPT image API page.

Treat the CSV as your source of truth. When you later switch image tools, you can rewrite the rules for the new tool and regenerate the column, since regeneration costs cents.

One boundary applies to every route: no sexual content involving minors. The model is tuned to answer without content refusals for lawful adult use, so keep your own batches non-explicit and within the law of your country.

Getting set up

Create an account and claim the $0.50 trial credit from the API key page. It needs no payment and lasts 7 days. Export the key as API_KEY, drop ten ideas into ideas.txt, and run the script. You will see within a minute whether scripted prompts beat your chat habit.

Questions and answers

Is ChatGPT a good AI image prompt generator?

For a few prompts and quick iteration, yes, it is convenient. For hundreds of prompts in one fixed format, a script is more repeatable.

Can your API make the images as well?

No. The API is text only and returns prompts as text. You render them with a separate image generator.

Do I need to know how to code?

A little. The script above is about 25 lines of Python, and the OpenAI library handles the connection. Chat windows need no code at all.

Can I use my existing OpenAI-based tools?

Usually. Set the base URL to https://api.uncensoredimage.com/v1, add your key and use model uncensored.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key