Generate

POST /v1/images/generations takes the OpenAI fields model, prompt, n, quality, size, response_format (url or b64_json) and user, plus GEEKIDEA’s generation_config and metadata.
generation_config accepts resolution, aspect_ratio, seed and negative_prompt; which values a model supports is listed in its generation_config.

Response

  • url is a signed link to the original image, valid for at least a day. Download what you need to keep. To get fresh links later, call GET /v1/generations/{id} with the id.
  • previews are WebP thumbnails in four sizes.
  • b64_json replaces url when you set response_format: "b64_json".

Edit with reference images

POST /v1/images/edits generates from one or more reference images. The model must list image_to_image in capabilities, and you can send up to its max_reference_images.
Use image for one file and image[] for several. Send generation_config and metadata as JSON strings.
Reference images must be PNG, JPEG, WebP or GIF, at most 20 MB each and 100 MB per request (413 file_too_large). mask is not supported yet.

How images are priced

There are two pricing styles; each model’s pricing shows which one it uses.
  • Per image: a price per image, optionally by quality or resolution tier (image_per_spec). The tier is matched on generation_config.resolution first, then quality; tiers not listed use image.
  • Per token (GPT Image, FLUX.2, MAI Image): input tokens × input + output image tokens × output. Higher resolution and quality produce more output tokens. A low-quality 1K GPT Image uses about 200 output tokens.
Failed generations and failed uploads are not charged. See Billing.

Midjourney

Midjourney models return 4 images per request and charge once per request (generation_config.images_per_request = 4). Here n is the number of requests (default 1, at most 2), so n: 2 returns 8 images. Write Midjourney parameters in the prompt as usual. GEEKIDEA appends the aspect ratio and, for V8 at 2K, the HD flag from generation_config. The full prompt, including reference image links, must be at most 1024 characters.

Long-running requests

Image generation can take from seconds to a few minutes. To avoid holding a connection open, send Prefer: respond-async to get 202 right away and fetch the result later. See Async requests.