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 '
{
  "prompt": "<string>",
  "image": "<array>",
  "mask": "<unknown>",
  "mode": "dall-e-2",
  "n": 123,
  "output_compression": "100",
  "quality": "auto",
  "response_format": "<string>",
  "size": "auto"
}
'
{
  "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
    }
  }
}

OpenAI Image Models

Edit or extend images based on one or more provided source images and prompts. Supports the models 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
prompt
string
required

Text description of the image. Maximum lengths: gpt-image-1 supports up to 32,000 characters, dall-e-2 supports up to 1,000 characters, dall-e-3 supports up to 4,000 characters.

image
array
required

Image to edit. Must be a supported image file or image array.
gpt-image-1: each image should be a png, webp, or jpg file smaller than 25MB.
dall-e-2: you can only provide one image, and it should be a square png file smaller than 4MB.

mask
file

An additional image where fully transparent areas (e.g., Alpha value of zero) indicate where the image should be edited. If multiple images are provided, the mask applies to the first image. Must be a valid PNG file, smaller than 4MB, and the same dimensions as the image.

mode
enum<string>
default:dall-e-2

Supported models

Available options:
gpt-image-1,
dall-e-2
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%). This parameter only applies to gpt-image-1 with output format webp or jpeg, defaults to 100.

quality
string
default:auto

Image quality.
auto (default) automatically selects the best quality for the given model.
gpt-image-1 supports three qualities: high, medium, low.
dall-e-3 supports hd and standard.
dall-e-2 only supports standard.

response_format
string

Return data format.
dall-e-3 and dall-e-2 support url or b64_json. URLs are valid for 60 minutes, so cache immediately after retrieval.
gpt-image-1 only supports b64_json.

size
string
default:auto

Image size.
gpt-image-1 options: 1024x1024, 1536x1024, 1024x1536, auto (default).
dall-e-2 options: 256x256, 512x512, 1024x1024.
dall-e-3 options: 1024x1024, 1792x1024, 1024x1792.
Note: Different sizes consume different TTAPI quotas.

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 March 13, 2026