from 3 credits per call

AI Image Generation API

Generate images from a text prompt with a single JSON request. Up to four samples per call, three models to trade speed against quality, and full commercial rights on the output.

  • REST · JSON
  • No watermark
  • Nothing stored
endpoint

POST /v1/generate-image

Base URL
https://app.imggen.ai
Auth
Authorization: Bearer sk_live_…
Cost
from 3 credits
Input
JPEG (JPG), PNG and WebP · max 25 MB

01 — Overview

What is the AI Image Generation API?

The ImgGen AI image generation API is a REST endpoint that turns a text prompt into images. You send a JSON body with the prompt, how many samples you want, an aspect ratio, and which model to use; the endpoint returns the generated images base64-encoded in an array. It is the only endpoint that takes JSON rather than a file.

It is one of seven endpoints in the ImgGen AI image editing API, all of which share a single API key, a single base URL, and the same request and response shape. If you also need this capability in a browser rather than from code, the same AI model powers the AI Image Generator tool.

02 — Request

Request parameters

Send a POST request to https://app.imggen.ai/v1/generate-image, authenticated with an API key in the Authorization header.

Parameters accepted by this endpoint
ParameterTypeRequiredDefaultDescription
promptstringREQUIREDText description of the image to generate.
samplesnumberoptional1How many images to generate, from 1 to 4.
aspect_ratiostringoptionalsquareOutput shape. Accepts square, portrait or landscape.
modelstringoptionalimggen-baseGeneration model. Accepts imggen-base, imggen-base-fast or imggen-xl.
03 — Integrate

How do I integrate the AI image generation API?

Create an API key in your ImgGen account, set it as an environment variable, and call the endpoint. Here is the same request in cURL, Node.js and Python.

curl --request POST \
  --url 'https://app.imggen.ai/v1/generate-image' \
  --header 'Authorization: Bearer sk_live_YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "close up photo of a rabbit in a wildflower meadow",
    "samples": 1,
    "aspect_ratio": "square",
    "model": "imggen-base"
  }'
04 — Response

Response

A successful call returns JSON. The result is base64-encoded — decode it before writing to disk or object storage. Every successful response also carries an X-Credit-Remaining header with your balance after the call.

{
  "success": true,
  "message": "Images generated successfully",
  "images": ["iVBORw0KGgoAAAANSUhEUgAA...SUVORK5CYII="]
}
05 — Limits

Limits and behaviour worth knowing

The endpoint accepts JPEG (JPG), PNG and WebP with a 25 MB maximum file size, and responds synchronously within 60 seconds — there is no job to poll and no webhook to configure.

Returns an images array

Unlike the editing endpoints, which return a single image field, generation returns images — an array with one entry per sample requested.

Three models

imggen-base is the default balance, imggen-base-fast trades detail for speed, and imggen-xl targets the highest quality. Pick per request rather than per account.

JSON, not multipart

This is the only endpoint that takes a JSON body. Send Content-Type: application/json instead of a multipart form.

06 — In production

What is the AI image generation API used for?

Where teams put this endpoint into production to process images programmatically, at scale.

Editorial and blog imagery

Generate an original header image per article from the headline, instead of pulling from a stock library everyone else uses.

Product and campaign concepting

Produce four variations of a visual idea in one call so a team can pick a direction before commissioning real work.

In-app creative features

Let your users generate images inside your product without you standing up GPU infrastructure.

Placeholder and mock content

Fill demos, prototypes, and seeded environments with plausible imagery generated on demand.

07 — Cost

How much does the AI image generation API cost?

Each successful call costs from 3 credits, so your effective cost per image follows whichever plan you are on. Credits come from your plan and are shared across every endpoint and the web editor, so you are not buying a separate quota per tool. A call that fails is refunded automatically. See the full pricing page for details.

ImgGen AI plans and API access
PlanPriceCreditsAPI
Free$050 one-time free creditsNo API access
Starter$9.99 / month400 credits / monthAPI access included
Pro$29.99 / month1,400 credits / monthAPI access + priority support
EnterpriseCustomCustom volumeDedicated infrastructure

Credit costs and limits last verified 2026-08-27.

08 — Related

Teams using the AI image generation API usually reach for these next.

Background Removal APIImage Upscaling APIAI Image Generator (web tool)All API endpoints

Also available: Watermark Removal, Text Removal, Photo Restoration, Photo Colorization.

FAQ

AI Image Generation API FAQ

It is an HTTP endpoint that turns a written description into an image. You send a prompt as JSON and the service returns generated images in the response, which lets a product offer text-to-image without running any model infrastructure of its own.

Get started

Start calling the AI Image Generation API

One key unlocks all seven endpoints. No watermark, full commercial rights, and nothing you send is stored after the response is returned.

Get your API key