Skip to main content
POST
/
v1
/
images
/
edits
cURL
curl --request POST \
  --url https://api.ttapi.io/v1/images/edits \
  --header 'Content-Type: application/json' \
  --header 'TT-API-KEY: <api-key>' \
  --data '
{
  "images": [
    {
      "file_id": "<string>",
      "image_url": "<string>"
    }
  ],
  "prompt": "<string>",
  "mask": {
    "file_id": "<string>",
    "image_url": "<string>"
  },
  "background": "auto",
  "input_fidelity": "low",
  "moderation": "auto",
  "n": 123,
  "output_compression": 100,
  "output_format": "png",
  "partial_images": 0,
  "quality": "auto",
  "size": "auto",
  "stream": false,
  "user": "<string>"
}
'
{
  "created": 1713833628,
  "data": [
    {
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV9TpSItDnaQIpKhOlkQVFIwU8CR1NZBLi4iFg8B4R33PTK77Z22p22e+628923923f/jH53eV73923/..."
    }
  ],
  "usage": {
    "total_tokens": 100,
    "input_tokens": 50,
    "output_tokens": 50,
    "input_tokens_details": {
      "text_tokens": 10,
      "image_tokens": 40
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.ttapi.io/llms.txt

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

Create an edited or extended image from one or more source images and a prompt. The endpoint follows the official OpenAI Images API request and response shape for POST /v1/images/edits. Documentation translated from the official documentation. Supported models include gpt-image-2, gpt-image-1.5, gpt-image-1, and dall-e-2.

Authorizations

TT-API-KEY
string
header
required

You can obtain your API key from the TTAPI Dashboard.

Body

application/json
images
object[]
required

Input image references to edit. For GPT Image models, you can provide up to 16 images. Each object should provide either file_id or image_url.

prompt
string
required

Text prompt describing the desired edit. GPT Image models support up to 32,000 characters; dall-e-2 supports up to 1,000 characters.

model
enum<string>
required

The model to use for image editing.

Available options:
gpt-image-1.5,
gpt-image-1,
gpt-image-2
mask
object

Optional mask image reference. Provide exactly one of file_id or image_url.

background
enum<string>
default:auto

Sets the transparency of the output image background. Applies only to GPT Image models. Choose transparent, opaque, or auto (default). Transparent backgrounds require png or webp output format.

Available options:
transparent,
opaque,
auto
input_fidelity
enum<string>
default:low

Controls how closely the output preserves details from the input image. Choose high or low; defaults to low. Applies only to GPT Image models.

Available options:
high,
low
moderation
enum<string>
default:auto

Moderation level for GPT Image models. Choose low or auto.

Available options:
low,
auto
n
integer

Number of images to generate, default 1. Available range 1-10.

output_compression
integer
default:100

Compression level for generated images (0-100). Applies only to GPT Image models with output_format set to webp or jpeg; defaults to 100.

output_format
enum<string>
default:png

Return format for generated images. Applies only to GPT Image models. Choose png (default), jpeg, or webp.

Available options:
png,
jpeg,
webp
partial_images
integer
default:0

Number of partial images to return in the streaming response, from 0 to 3; defaults to 0. Available only when stream is true.

quality
string
default:auto

Image quality. auto (default) automatically selects the best quality for the model.

GPT Image models support high, medium, and low;

dall-e-2 only supports standard.

response_format
enum<string>

Return data format. Only dall-e-2 supports url or b64_json; URLs are valid for 60 minutes. GPT Image models always return b64_json.

Available options:
url,
b64_json
size
string
default:auto

Image size.

GPT Image models support 1024x1024, 1536x1024, 1024x1536, and auto (default);

dall-e-2 supports 256x256, 512x512, 1024x1024.

stream
boolean
default:false

Whether to stream edit progress. When enabled, use partial_images to receive partial image events.

user
string

A unique identifier representing your end-user, which can help OpenAI monitor and detect abuse.

Response

Request successful, returns Base64 format image generation results

created
integer
required

Generation timestamp (seconds)

Example:

1713833628

data
object[]
required

Image generation result list

usage
object
required

Token usage (must return for Base64 format)

Example:
{
"input_tokens": 50,
"input_tokens_details": { "image_tokens": 40, "text_tokens": 10 },
"output_tokens": 50,
"total_tokens": 100
}
Last modified on May 20, 2026