Skip to main content
POST
/
v1
/
images
/
generations
cURL
curl --request POST \
  --url https://nano-gpt.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "hidream",
  "prompt": "<string>",
  "n": 1,
  "size": "256x256",
  "response_format": "url",
  "user": "<string>",
  "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...",
  "imageDataUrls": [
    "data:image/jpeg;base64,/9j/4AAQ...",
    "data:image/png;base64,iVBORw0KGgo..."
  ],
  "maskDataUrl": "data:image/png;base64,iVBORw0KGgo...",
  "strength": 0.8,
  "guidance_scale": 7.5,
  "num_inference_steps": 30,
  "seed": 42,
  "kontext_max_mode": false
}'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>"
    }
  ],
  "cost": 123,
  "paymentSource": "<string>",
  "remainingBalance": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Parameters for image generation

prompt
string
required

The text prompt to generate an image from

model
string
default:hidream

The model to use for generation

n
integer
default:1

Number of images to generate

size
enum<string>

The size of the generated images

Available options:
256x256,
512x512,
1024x1024
response_format
enum<string>

The format in which the generated images are returned

Available options:
url,
b64_json
user
string

A unique identifier representing your end-user

imageDataUrl
string

Base64-encoded image data URL for img2img generation. Single image input for models that support image-to-image transformation. Format: data:image/[type];base64,[data]. Note: Direct URL input is not supported - images must be converted to base64 data URLs before submission.

Example:

"data:image/jpeg;base64,/9j/4AAQ..."

imageDataUrls
string<data-url>[]

Array of base64-encoded image data URLs for models supporting multiple image inputs (e.g., flux-kontext, gpt-4o-image, gpt-image-1). Each URL must follow the format: data:image/[type];base64,[data]

Example:
[
"data:image/jpeg;base64,/9j/4AAQ...",
"data:image/png;base64,iVBORw0KGgo..."
]
maskDataUrl
string

Base64-encoded mask image data URL for inpainting models (e.g., flux-lora/inpainting). White areas indicate regions to edit. Format: data:image/[type];base64,[data]

Example:

"data:image/png;base64,iVBORw0KGgo..."

strength
number
default:0.8

Controls how much the output differs from the input image in img2img mode. Lower values produce outputs closer to the input.

Required range: 0 <= x <= 1
guidance_scale
number
default:7.5

How closely the model follows the text prompt. Higher values result in images more closely aligned with the prompt.

Required range: 0 <= x <= 20
num_inference_steps
integer
default:30

Number of denoising steps. More steps generally produce higher quality but take longer.

Required range: 1 <= x <= 100
seed
integer

Random seed for reproducible generation. Use the same seed with the same parameters to get identical results.

Example:

42

kontext_max_mode
boolean
default:false

Enable enhanced context mode for flux-kontext model. Provides better understanding of input images.

Response

Image generation response

created
integer

Unix timestamp of when the image was created

data
object[]

List of generated images

cost
number

Cost of the generation

paymentSource
string

Payment source used

remainingBalance
number

Remaining balance after the generation

I