Skip to main content
Model ID
Calling method: sync

gpt-image-2-edit API Usage Guide

Overview

gpt-image-2-edit uses OpenAI’s GPT Image 2 model to edit or transform an existing image based on a text prompt. It supports two modes:
  • Image Edit: Modify an image according to a prompt (e.g. change background, style transfer)
  • Inpainting: Edit a specific region of an image using a mask (white pixels are edited, black pixels are preserved)

Authentication

Submit Image Edit Request

Endpoint

Image Edit (no mask)

Inpainting (with mask)

Request Parameters

Response

Pricing

Billing is based on the actual token consumption reported by OpenAI for each request. Users are charged according to the real usage of input text tokens, cached input text tokens, input image tokens, cached input image tokens, and output image tokens. The final cost may vary depending on prompt length, whether input images are provided, image size, quality, number of generated images, and other request parameters.

Token Pricing

Prices below are charged per 1M tokens:

Billing Formula

Estimated Price Reference (per image)

The following table is provided as a reference only for common quality and resolution combinations. These are estimated per-image prices and may differ from the final billed amount, which is always based on actual token usage.

Check Request Status

Native OpenAI Format (Raw API)

Use the native OpenAI-compatible endpoint for direct integration with the OpenAI SDK or clients.

Base URL

Edit Image (multipart)

Edit Image (JSON + base64)

Native Parameters

Native Response Format

OpenAI SDK Usage