Documentation translated from official documentation. If you have integrated with the official documentation, you can use it directly. All input/output parameters and support are consistent.
gpt-image-1 and dall-e-2.You can obtain your API key from the TTAPI Dashboard.
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 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.
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.
Supported models
gpt-image-1, dall-e-2 Number of images to generate, default 1.
Available range 1-10
Compression level for generated images (0-100%). This parameter only applies to gpt-image-1 with output format webp or jpeg, defaults to 100.
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.
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.
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.
Request successful, returns Base64 format image generation results
Generation timestamp (seconds)
1713833628
Image generation result list
Token usage (must return for Base64 format)
{
"input_tokens": 50,
"input_tokens_details": { "image_tokens": 40, "text_tokens": 10 },
"output_tokens": 50,
"total_tokens": 100
}