Skip to content

DALL-E 2

Overview

DALL·E 2 is OpenAI’s first-generation production image model. OpenAI describes it as a system that can create realistic images and art from natural-language descriptions, and its older API model page positions it as the lower-cost, more concurrent option with support for variations and masked editing. In practice, it is best documented here as a legacy model that still matters when compatibility, cheap batch-like image creation, or the older variations workflow is required.

API base URL

https://api.openai.com/v1/images/generations

Example payload

{
  "model": "dall-e-2",
  "prompt": "A clean architectural sketch of a glass pavilion in a forest clearing",
  "size": "1024x1024",
  "n": 1,
  "response_format": "url"
}

Our Current Pricing

In the current codebase, DALL·E 2 uses a fixed per-image price table. There is no token accounting step and no dependence on the API response body for metering. The billed amount is chosen from the requested output size.

1024x1024 -> 0.020 USD
512x512   -> 0.018 USD
256x256   -> 0.016 USD

The implemented formula is therefore simply:

cost_usd = price_by_size[size]

If an unknown size is passed for a known DALL·E 2 request, the code falls back to the 1024x1024 price when available. If the model or table cannot be resolved, the broader OpenAI image fallback in the repo returns 0.04 USD, but that is really a defensive default rather than a desirable billing outcome.

The safest way to calculate cost after the API call is to ignore the response body and charge from the request metadata you already persisted: model, size, and n. Multiply the single-image price by the number of images if your workflow ever allows n > 1. If you want invoice traceability, store the resolved size key and the exact price row you matched at request time.

Sources