EN ▾
Get API key

LLM API Prompt Generation: Costs and Patterns

Using an LLM to write prompts for other tools is cheap per item and large in total, so it pays to know the numbers. This page prices llm api prompt generation for batches of 1,000 up to 100,000 prompts and shows patterns that keep output tokens, the expensive side, under control.

Updated

Glass funnel dropping glowing cards into a tray beside a coin scale, picturing low per-prompt LLM cost

Key points

  • At $0.15 per 1M input and $0.50 per 1M output tokens, a 400-token-in, 250-token-out prompt costs $0.000185.
  • 1,000 such prompts cost $0.185; 100,000 cost $18.50.
  • Output tokens cost more than three times as much as input tokens, so short answers save the most.
  • Batching several prompts into one request pays off most when your system prompt is long.

The cost of one generated prompt

The price list is short: $0.15 per 1M input tokens and $0.50 per 1M output tokens, paid from prepaid credit with no subscription. To turn that into a cost per prompt, you need two numbers from your own setup: how many tokens you send, and how many you get back.

A typical prompt-writing request has a system message that explains the style (say 350 tokens) plus a short seed idea (50 tokens), so about 400 tokens in. The generated prompt is a paragraph of roughly 250 tokens. Then:

  • Input: 400 / 1,000,000 x $0.15 = $0.00006.
  • Output: 250 / 1,000,000 x $0.50 = $0.000125.
  • Per prompt: $0.000185.

Less than a hundredth of a cent. The output side is about twice the input side even though there are fewer output tokens, because each output token costs 3.33 times what an input token does. Keep that ratio in mind whenever you decide where to trim.

Scaling to a real batch

Multiply the per-prompt figure by volume and you get the table most people are looking for. These figures use the 400-in, 250-out request above, one prompt per request.

PromptsInput tokensOutput tokensCost
1,000400,000250,000$0.185
10,0004,000,0002,500,000$1.85
100,00040,000,00025,000,000$18.50

Check the first row by hand: 0.4M x $0.15 = $0.06, and 0.25M x $0.50 = $0.125, which adds to $0.185. The other rows are the same arithmetic scaled by 10 and by 100.

The $0.50 trial credit, which you can claim with one click after signing up, covers about 2,700 prompts at this size ($0.50 divided by $0.000185). That is enough to test a prompt template properly before putting real money behind it. A $20 top-up, the smallest amount, covers roughly 108,000. Larger top-ups add bonus credit: +5% from $50, +10% from $100 and +15% from $200. Details are on the pricing page.

Scripts cost more than prompts

The word "prompt" covers a lot. If you are generating whole scripts, outlines or scene descriptions instead of one-paragraph prompts, token counts rise and so does the price. Suppose a request sends 1,500 tokens (brief, style rules, a sample) and gets back 1,200 tokens of script.

  • Input: 1.5k tokens at $0.15 per 1M = $0.000225.
  • Output: 1.2k tokens at $0.50 per 1M = $0.0006.
  • Per script: $0.000825, so 1,000 scripts cost $0.825.

Still small money. Even so, a bad prompt that makes the model ramble to 3,000 tokens would multiply the output cost by 2.5 (3,000 tokens instead of 1,200), which is why length instructions belong in every template.

Pattern 1: expand a seed into variations

The most common use is to start from a short seed and ask for many variations. Quality depends on how much freedom you give. A loose request ("write a cinematic prompt about a lighthouse") produces similar results every time. A constrained one gives variety: name the camera distance, the time of day, the mood and the number of words, and vary those slots from a list in your own code. The model then fills in the details around a skeleton you control.

Set temperature between 0.8 and 1.0 for variety, and use seed when you want a result you can reproduce while debugging a template. Temperature, top_p, stop, seed and the penalties are passed through to the model, so the usual controls work.

Pattern 2: several prompts per request

When the system message is long, you pay for it again on every call. Asking for ten prompts in one request spreads that cost. Here is a version that returns a JSON list:

import json
import os
from openai import OpenAI

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

STYLE = "You write scene prompts of 40 to 60 words. No titles, no numbering."


def make_prompts(seed_idea, n=10):
    resp = client.chat.completions.create(
        model="uncensored",
        response_format={"type": "json_object"},
        temperature=0.9,
        max_tokens=n * 120,
        messages=[
            {"role": "system", "content": STYLE + ' Reply as {"prompts": [str]}.'},
            {"role": "user", "content": "Give %d distinct prompts for: %s" % (n, seed_idea)},
        ],
    )
    return json.loads(resp.choices[0].message.content)["prompts"]

Now the math with a long, detailed system prompt of 3,000 tokens (3,050 in per request with the seed). One prompt per request, 1,000 prompts: input 3.05M tokens x $0.15 = $0.4575, output 0.25M x $0.50 = $0.125, total $0.5825. Ten prompts per request means 100 requests: input 305,000 tokens = $0.04575, output stays 250,000 tokens = $0.125, total about $0.17. The bill drops by roughly 70%.

With the short 400-token system prompt from earlier, the gain is smaller. Ten per request gives 100 requests with 40,000 input tokens ($0.006) and 250,000 output tokens ($0.125), total $0.131 instead of $0.185, a saving of about 29%. The lesson: batching helps in proportion to how much input you were repeating.

The trade-off is quality and risk. Ten prompts from one call tend to share a tone, and one malformed JSON answer loses ten items at once. Keep n at 5 to 10 and validate the list length.

Pattern 3: draft, then critique

A second pass can lift quality without a bigger model. The first call writes a prompt. The second call receives that prompt plus your rules ("under 60 words, one subject, no brand names") and returns a corrected version. This doubles the cost of the stage, so use it where bad prompts are expensive downstream, for instance when each prompt will be sent to a paid image or video tool elsewhere in your workflow.

A cheaper variant is to critique in code. Reject any output that is over the word limit, contains a banned term or repeats an earlier prompt, and regenerate only those. Failed or refused requests are not charged, which keeps retries on the API side cheap, but a successful generation you throw away is still billed, so measure your rejection rate before scaling up.

If the prompts feed audio or music tools, the same patterns apply, as described on the music pipelines page.

Quality checks that catch bad prompts cheaply

Generating prompts at scale means some will be bad. The cheapest defence is a set of rules in plain code, run on every output before it moves on. None of them costs a token.

  • Length. Count words. Reject anything outside your range, for example 40 to 60 words for a scene prompt.
  • Banned terms. Keep a short list of words your downstream tool handles badly, and reject outputs that contain them.
  • Duplicates. Lowercase each prompt, strip punctuation and compare against a set. For near-duplicates, compare the first eight words. Repeats are the usual sign that temperature is too low or the slots in your skeleton are too few.
  • Format. If you asked for JSON, parse it. If you asked for no numbering, reject lines that start with "1." or a dash.

Track the rejection rate. If 5% of outputs fail, regenerating them adds about 5% to the bill, which is nothing. If 40% fail, the template is wrong, and fixing it will save far more than any trick with batching. Keep in mind that the service will never write sexual content involving minors, and a refused request is not charged, so a refusal in your logs is not a billing problem.

Finally, keep a sample of the accepted prompts for a human to read each week. Automated checks catch format problems. Only a person notices that all the prompts have started to sound the same.

Keeping the bill predictable

Three habits matter more than any clever trick.

  1. Cap the output. Set max_tokens to a little above the longest answer you accept. It is optional, since a completion may use the rest of the 100,000 token window, but an unbounded request is the one that surprises you.
  2. Do a dry run. Generate 50 items, read the usage figures, and multiply. That beats guessing token counts.
  3. Watch the balance. Each response includes X-Balance-USD, so your script can stop when credit falls under a threshold.

Mind the concurrency rules while you scale: a full key allows 8 requests at once and 300 per minute, a trial key 2 and 60. Over a limit, you get HTTP 429. Setup help is in the quickstart, and you can claim the trial from the API key page.

Questions and answers

How much does it cost to generate 10,000 prompts?

With 400 tokens in and 250 tokens out per prompt, it is $1.85. A longer template or longer answers raise the figure in proportion, so do a 50-item dry run and multiply.

Why are output tokens the main cost?

They are priced at $0.50 per 1M against $0.15 per 1M for input, a ratio of about 3.3. Shorter answers, set with max_tokens and clear length rules, save the most.

Is batching several prompts per request worth it?

Yes when your system prompt is long, since you stop paying for it on every call. With a 3,000-token system prompt the saving in the example above is about 70%.

Does this API generate the video or images from my prompts?

No. It is text only. It writes the prompts, and you send them to whichever tool renders media.

Your key is one form away

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

Get API key