Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nano-gpt.com/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Use the image edits endpoint to modify one or more input images with a text prompt. This is an OpenAI-compatible image editing endpoint. Both paths are supported aliases:
  • POST /api/v1/images/edit
  • POST /api/v1/images/edits

Authentication

Use either header:
  • Authorization: Bearer YOUR_API_KEY
  • x-api-key: YOUR_API_KEY

Multipart Request

Send multipart/form-data when uploading files.
FieldTypeRequiredDescription
promptstringYesEdit instruction.
imagefile or stringYes*Input image file, image URL, or data URL.
image[]repeated file or stringYes*Repeated image inputs for multi-image editing.
maskfileNoOptional mask image for inpainting-capable models.
modelstringNoImage-edit-capable model. Defaults to an image-edit-capable default when omitted.
sizestringNoRequested output size, when supported by the model.
nintegerNoNumber of outputs, when supported by the model.
*Provide image or one or more image[] fields. Other image-generation parameters may pass through when supported by the selected model.
curl -X POST https://nano-gpt.com/api/v1/images/edits \
  -H "Authorization: Bearer $NANOGPT_API_KEY" \
  -F model=gpt-image-1 \
  -F prompt="Remove the background" \
  -F image=@product.png \
  -F size=1024x1024

Multi-image Multipart

curl -X POST https://nano-gpt.com/api/v1/images/edit \
  -H "x-api-key: $NANOGPT_API_KEY" \
  -F model=gpt-image-1 \
  -F prompt="Combine these references into one product image" \
  -F "image[]=@reference-1.png" \
  -F "image[]=@reference-2.jpg"

JSON Request

Send JSON when you already have images as data URLs.
{
  "model": "gpt-image-1",
  "prompt": "Remove the background",
  "imageDataUrl": "data:image/png;base64,...",
  "maskDataUrl": "data:image/png;base64,..."
}

Multi-image JSON

{
  "model": "gpt-image-1",
  "prompt": "Combine these references into one product image",
  "imageDataUrls": [
    "data:image/png;base64,...",
    "data:image/jpeg;base64,..."
  ]
}

Response

Responses follow the same image response conventions as image generation. Depending on request parameters and model support, returned items may contain url or b64_json.
{
  "created": 1778155200,
  "data": [
    {
      "url": "https://..."
    }
  ]
}

Common Errors

CodeDescription
missing_image_inputimage is required.
image_input_too_largeUpload or input image is too large.
invalid_multipart_bodyMultipart body could not be parsed.
rate_limit_exceededToo many image edit uploads.

Notes

  • Multipart uploads have strict size limits.
  • Generated URLs are temporary unless another page explicitly guarantees longer retention.
  • Use GET /api/v1/image-models to discover image-edit-capable models and supported parameters.