POST
/
generate-image
cURL
curl --request POST \
  --url https://nano-gpt.com/api/generate-image \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "prompt": "RAW photo, a portrait photo of a latina woman in casual clothes, natural skin, 8k uhd, high quality, film grain, Fujifilm XT3",
  "model": "recraft-v3",
  "width": 1024,
  "height": 1024,
  "negative_prompt": "<string>",
  "nImages": 1,
  "num_steps": 10,
  "resolution": "1024x1024",
  "sampler_name": "<string>",
  "scale": 7.5,
  "imageDataUrl": "data:image/jpeg;base64,/9j/4AAQ...",
  "kontext_max_mode": false
}'
{
  "image": "<string>",
  "cost": 123,
  "inputTokens": 123,
  "outputTokens": 123
}

Authorizations

x-api-key
string
header
required

Body

application/json

Parameters for image generation

prompt
string
required

The text description of the image to generate

Example:

"RAW photo, a portrait photo of a latina woman in casual clothes, natural skin, 8k uhd, high quality, film grain, Fujifilm XT3"

model
string
default:recraft-v3
required

The model to use for generation

width
integer
default:1024

Width of the generated image

height
integer
default:1024

Height of the generated image

negative_prompt
string

Things to avoid in the generated image

nImages
integer
default:1

Number of images to generate

num_steps
integer
default:10

Number of denoising steps

resolution
string
default:1024x1024

Output resolution

sampler_name
string

Sampling method

scale
number
default:7.5

Guidance scale

imageDataUrl
string

Base64-encoded image data URL for img2img generation (format: data:image/[type];base64,[data])

Example:

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

kontext_max_mode
boolean
default:false

When using flux-kontext model, enables maximum context mode for better image understanding

Response

Image generation response

image
string

Base64 encoded image data

cost
number

Cost of the generation

inputTokens
integer

Number of input tokens used

outputTokens
integer

Number of output tokens used