Skip to content

Create Image ​

Creates an image given a prompt using a GPT Image model.

Endpoint ​

http
POST /v1/images/generations

Authentication ​

TypeDescription
Bearer TokenInclude Authorization: Bearer <API_key> in the request header for account verification.

Request Headers ​

NameTypeRequiredDescription
Content-TypestringYesSet request media type to application/json
AuthorizationstringYesBearer API_key, used for account verification

Request Body ​

NameTypeRequiredDefaultDescription
modelstringYes-The GPT image model to use for image generation; must be specified explicitly. See "Supported Model IDs" below
promptstringYes-A text description of the desired image(s), up to 32000 characters
backgroundstringNoautoBackground of the generated image(s): transparent, opaque, or auto. See Parameter Details below
moderationstringNoautoContent-moderation level: low (less restrictive) or auto. Only supported for GPT image models
nintegerNo1Number of images to generate, between 1 and 10
output_compressionintegerNo100Compression level (0-100%), only for GPT image models with webp or jpeg output formats
output_formatstringNopngFormat of the returned images: png, jpeg, or webp. Only supported for GPT image models
partial_imagesintegerNo0Number of partial images in streaming responses, 0-3; when 0, a single image is sent in one streaming event
qualitystringNoautoQuality of the generated image. See Parameter Details below
response_formatstringNo-Legacy parameter for retired image models. Unsupported for GPT image models (always return base64-encoded images)
safety_identifierstringNo-A stable end-user identifier for safety monitoring, max 128 characters. See Parameter Details below
sizestringNoautoSize of the generated images. See Parameter Details below
streambooleanNofalseWhether to generate the image in streaming mode. Only supported for GPT image models
stylestringNo-Legacy parameter for retired image models. Unsupported for GPT image models; describe the desired style in the prompt instead
userstringNo-Deprecated: use safety_identifier instead. Used when safety_identifier is omitted, null, or empty

Supported Model IDs:

  • gp-im-1.5
  • gp-im-2
  • gp-im-2-2026-04-21
  • gp-im-2.5-su
  • gp-im-2.5-su-2026-09-08
  • gp-im-2.5-fl
  • gp-im-2.5-fl-2026-09-08
  • gp-im-1-mini
  • gp-im-1 (shut down on October 23, 2026; use gp-im-2.5-su or gp-im-2.5-fl instead)
  • dall-e-2
  • dall-e-3

Parameter Details ​

background ​

This parameter is only supported for the GPT image models. When auto is used, the model will automatically determine the best background for the image.

gp-im-2.5-su and gp-im-2.5-fl, including their 2026-09-08 snapshots, support opaque and transparent backgrounds. For gp-im-2 and gp-im-2-2026-04-21, transparent background support is in preview. When using transparent, set output_format to png or webp.

quality Enum Values ​

  • auto: automatically selects the best quality for the given model (default)
  • low / medium / high: supported for the GPT image models
  • xhigh / max: only supported for gp-im-2.5-su and gp-im-2.5-fl, including their 2026-09-08 snapshots
  • standard / hd: legacy enum values for retired image models

size ​

For gp-im-2, gp-im-2-2026-04-21, gp-im-2.5-su, gp-im-2.5-su-2026-09-08, gp-im-2.5-fl, and gp-im-2.5-fl-2026-09-08, arbitrary resolutions are supported as WIDTHxHEIGHT strings, for example 1536x864. Width and height must both be divisible by 16 and the requested aspect ratio must be between 1:3 and 3:1. Resolutions above 2560x1440 are experimental, and the maximum supported resolution is 3840x2160. The requested size must also satisfy the model's current pixel and edge limits.

Standard sizes: 1024x1024, 1536x1024, 1024x1536; auto is supported for models that allow automatic sizing. Legacy enum values: 256x256, 512x512, 1792x1024, 1024x1792.

safety_identifier ​

A stable identifier for an end user in your organization, used for safety monitoring and abuse detection. Hash a username or email address to avoid sending identifying information. A non-empty value takes precedence over the deprecated user parameter. If omitted, null, or empty, the API uses user when available.

Example Request ​

bash
curl --request POST \
  --url https://neolink.com/api/v1/images/generations \
  --header 'Authorization: Bearer <API Key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gp-im-2",
    "prompt": "A cute baby sea otter",
    "n": 1,
    "size": "1024x1024"
  }'
bash
curl --request POST \
  --url https://neolink.com/api/v1/images/generations \
  --header 'Authorization: Bearer <API Key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gp-im-2",
    "prompt": "A cute baby sea otter",
    "n": 1,
    "size": "1024x1024",
    "stream": true
  }'
bash
curl --request POST \
  --url https://neolink.com/api/v1/images/generations \
  --header 'Authorization: Bearer <API Key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "gp-im-2.5-fl",
    "prompt": "A cute baby sea otter",
    "background": "transparent",
    "moderation": "low",
    "n": 1,
    "output_compression": 100,
    "output_format": "png",
    "partial_images": 1,
    "quality": "medium",
    "safety_identifier": "user-1234",
    "size": "1024x1024"
  }'

Response Body ​

NameTypeDescription
createdintegerThe Unix timestamp (in seconds) of when the image was created
backgroundstringThe background parameter used: transparent or opaque
dataarrayThe list of generated images
data.b64_jsonstringThe base64-encoded JSON of the generated image, returned by default for GPT image models
data.revised_promptstringThe revised prompt used to generate the image, for models that support prompt revision. Not returned by GPT image models
data.urlstringThe URL of the generated image (returned when the legacy response_format is url). Unsupported for GPT image models
output_formatstringThe output format: png, webp, or jpeg
qualitystringThe quality of the image: low, medium, high, xhigh, or max
safety_identifierstringThe effective safety identifier: the non-empty safety_identifier from the request, or the deprecated user value when it is omitted, null, or empty
sizestringThe image dimensions as a WIDTHxHEIGHT string, for example 1536x864
usageobjectToken usage information, for gp-im-1 only
usage.input_tokensintegerThe number of tokens (images and text) in the input prompt
usage.input_tokens_details.image_tokensintegerThe number of image tokens in the input prompt
usage.input_tokens_details.text_tokensintegerThe number of text tokens in the input prompt
usage.output_tokensintegerThe number of output tokens generated by the model
usage.total_tokensintegerThe total number of tokens (images and text) used for the image generation
usage.output_tokens_details.image_tokensintegerThe number of image output tokens generated by the model
usage.output_tokens_details.text_tokensintegerThe number of text output tokens generated by the model

Response Example ​

json
{
  "created": 1713833628,
  "data": [
    {
      "b64_json": "..."
    }
  ],
  "usage": {
    "total_tokens": 100,
    "input_tokens": 50,
    "output_tokens": 50,
    "input_tokens_details": {
      "text_tokens": 10,
      "image_tokens": 40
    }
  }
}

Streaming Response ​

When stream: true is set, the response is returned as an SSE event stream with the following events:

  • image_generation.partial_image: a partial image, with partial_image_index indicating its index; the final image may be sent before the full number of partial_images is reached if it is generated more quickly
  • image_generation.completed: the final full image with token usage
json
event: image_generation.partial_image
data: {"type":"image_generation.partial_image","b64_json":"...","partial_image_index":0}

event: image_generation.completed
data: {"type":"image_generation.completed","b64_json":"...","usage":{"total_tokens":100,"input_tokens":50,"output_tokens":50,"input_tokens_details":{"text_tokens":10,"image_tokens":40}}}