Image Edits
Endpoint Examples
Image Edits
OpenAI-compatible image editing endpoint with multipart and JSON inputs
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 usesinput_references and POST /api/v1/images.
Both paths are supported aliases:
POST /api/v1/images/editPOST /api/v1/images/edits
Authentication
Use either header:Authorization: Bearer YOUR_API_KEYx-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: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
Sendmultipart/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 containurl 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-modelsto discover image-edit-capable models and supported parameters.