Skip to main content

GPT Image 1.0

A text-to-image model (GPT-IMAGE-1) available through the ImageGPT Image Generation API. The example below uses text-to-image (/generate/text-image).

PropertyValue
Model IDGPT-IMAGE-1
PlaygroundImage
Pricing10 credits per image

Headers​

Send your API key in the x-api-key header on every request. See Authentication for details.

HeaderRequiredValue
x-api-keyYesYOUR_API_KEY
Content-TypeYesapplication/json

A missing or invalid key returns 401 Unauthorized.

Parameters​

Request body fields for /generate/text-image:

ParameterTypeRequiredDefaultDescription
modelstringYes—Model ID to use for generation. See the model list below for all available IDs.
promptstringYes—Text description of the image you want to generate.
widthnumberNo512Output image width in pixels.
heightnumberNo512Output image height in pixels.
outputTypestringNo"binary"Output delivery format. One of "binary" (image blob), "url" (hosted link), or "base64" (encoded string).
outputFormatstringNo"png"Image file format. Either "png" or "jpg".
imagestring[]No—Array of input image URLs (max 3). Required only for image-to-image generation.

Request examples​

curl -X POST https://api.imagegpt.online/generate/text-image \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"prompt":"Photorealistic portrait of the same person (keep his real face unchanged). A man with medium curly brown hair, light skin, and soft features sits relaxed, forearms on a light blue table, holding a small white puppy with a red collar. He wears a cozy color-block knitted sweater (beige, tan, light blue, black) with ribbed neck and cuffs, a silver watch, and a turquoise-beaded bracelet. Soft diffused lighting, smooth steel-blue background, slightly elevated front angle warm, intimate, digital photo","width":512,"height":512,"model":"GPT-IMAGE-1","outputType":"binary","outputFormat":"png"}'

Response example​

binary

const blob = await response.blob();
const url = URL.createObjectURL(blob);

url

{
"success": true,
"taskId": "imagegpt_img-...",
"url": "https://...",
"creditsDeducted": 3
}

base64

{
"success": true,
"taskId": "imagegpt_img-...",
"base64": "/9j/4QWm...",
"creditsDeducted": 3
}

Pricing​

10 credits per image. Each image deducts the credit value shown for the selected model.

Playground​

Try this model live. Your key is used only in your browser to call the API directly and is never stored.

note

The browser playground calls https://api.imagegpt.online directly, so it only works if the API allows cross-origin requests from this site. If it is blocked, use the cURL, JavaScript, or Python samples above from your own server.