Skip to main content
POST
Image Edits

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. For new JSON-only image-to-image generation flows, also consider the dedicated Image API, which uses input_references and POST /api/v1/images. 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

Accountless x402 Payment

JSON image edit requests can be quoted without an account or API key on supported deployments when you explicitly opt in to the quote flow:
To request an accountless x402 quote, send the API request without Authorization or x-api-key, and include x-x402: true. NanoGPT will return 402 Payment Required with available payment options. This endpoint supports accountless x402 payments where listed by GET /api/v1/x402/endpoints, including Lightning L402 when advertised. Multipart uploads require normal authentication before conversion. See Accountless x402 API Payments for the full flow. If you receive 401 missing_api_key immediately, check that the initial quote request includes x-x402: true. Without that header, NanoGPT does not enter the x402 quote flow.

Multipart Request

Send multipart/form-data when uploading files. *Provide image or one or more image[] fields. Other image-generation parameters may pass through when supported by the selected model.

Multi-image Multipart

JSON Request

Send JSON when you already have images as data URLs.

Multi-image JSON

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.

Common Errors

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.