BeLive Token Hub
API ReferenceImageGPT Image

Common Interface

GPT Image common interface for image generation and editing.

The GPT Image common interface supports image generation and editing: omit image to generate an image, or provide image to edit it according to prompt.

Endpoint

ItemValue
EndpointPOST https://api.tokenhub.belivestudios.com/v1/images/generations
AuthenticationAuthorization: Bearer sk-your-key
Content-Typeapplication/json

Generate an image

Omit the image parameter to generate an image:

{
  "model": "gpt-image-2",
  "prompt": "An orange cat on a futuristic rooftop, cinematic light, photorealistic",
  "size": "2048x2048",
  "quality": "high",
  "n": 1,
  "response_format": "url"
}

Edit an image

Add an image array to edit an image. Each item can be an image URL or a Base64 data URL:

{
  "model": "gpt-image-2",
  "prompt": "Keep the subject and composition; replace the background with Shanghai at night",
  "size": "2048x2048",
  "quality": "high",
  "n": 1,
  "response_format": "url",
  "input_fidelity": "high",
  "image": [
    "https://example.com/source.png"
  ]
}

curl example

curl https://api.tokenhub.belivestudios.com/v1/images/generations \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "gpt-image-2",
  "prompt": "Keep the subject and composition; replace the background with Shanghai at night",
  "size": "2048x2048",
  "quality": "high",
  "n": 1,
  "response_format": "url",
  "input_fidelity": "high",
  "image": [
    "https://example.com/source.png"
  ]
}'

Request parameters

ParameterTypeRequiredDescription
modelstringyesGPT Image model ID; use a model available in the console.
promptstringyesImage generation or editing instruction.
imagearraynoReference image array. Supports image URLs or Base64 data URLs; providing it edits an image, while omitting it generates an image.
input_fidelityhigh | lownoControls fidelity to the input image when image is provided.
sizestringnoOutput size, such as 1024x1024, 1536x1024, or 2048x2048.
qualitylow | medium | high | autonoImage quality.
nintegernoNumber of images, from 1 to 10.
response_formaturl | b64_jsonnoSelect URL or Base64 output; send it only when the current endpoint supports it.
backgroundtransparent | opaque | autonoImage background mode.
output_formatpng | jpeg | webpnoOutput image format.
output_compressionintegernoJPEG or WebP compression level from 0 to 100.
moderationlow | autonoContent moderation level.
streambooleannoWhether to stream the response.
userstringnoEnd-user identifier.

Response

Image generation and reference-image editing use the same response structure. In URL response mode, the generated image URL is in data[0].url.

{
  "created": 1787888579,
  "data": [
    {
      "b64_json": "",
      "revised_prompt": "",
      "url": "https://cdn.aiznt.com/relay-temp-images/20260828/b13c70b8-5e24-4936-a54f-d158aadf980a.jpg"
    }
  ]
}
FieldTypeDescription
createdintegerUnix timestamp, in seconds, when the response was created
dataarrayList of generated image results
data[].urlstringTemporary URL for the generated image
data[].b64_jsonstringBase64 image data; normally an empty string in URL response mode
data[].revised_promptstringServer-revised prompt; normally an empty string when none is provided

In Base64 response mode, read the image data from data[].b64_json. Each result normally contains only one usable image-data field, so follow the actual response.

Temporary image URL

Download and store the image promptly after receiving the response. Do not use the temporary URL as permanent storage.

On this page