Skip to main content
POST
cURL
Create images from a text prompt using OpenAI-compatible image models. The endpoint follows the official OpenAI Images API request and response shape for POST /v1/images/generations. Documentation translated from the official documentation. Supported models include gpt-image-2, gpt-image-1.5, gpt-image-1, dall-e-2, and dall-e-3.
Since OpenAI image generation is a synchronous response and takes a relatively long time, it is recommended to use the https://api.ttapi.org gateway.

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. gpt-image-1.5, gpt-image-1, and gpt-image-2 support up to 32,000 characters; dall-e-2 supports up to 1,000 characters; dall-e-3 supports up to 4,000 characters.

model
enum<string>
default:dall-e-2
required

The model to use for image generation.

Available options:
gpt-image-2,
gpt-image-1.5,
gpt-image-1,
dall-e-2,
dall-e-3
background
enum<string>
default:auto

Sets the transparency of generated image backgrounds. Applies only to GPT Image models. Choose transparent, opaque, or auto (default). When set to transparent, output_format must support transparency; use png or webp.

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

Controls the content moderation level for images generated by GPT Image models. Choose low for less restrictive filtering or auto (default).

Available options:
low,
auto
n
integer

Number of images to generate, default 1. Available range 1-10; dall-e-3 is fixed at 1.

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-3 supports hd and standard;

dall-e-2 only supports standard.

response_format
enum<string>

Return data format. Only dall-e-2 and dall-e-3 support 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).

gpt-image-2 support arbitrary WIDTHxHEIGHT resolution strings where both dimensions are divisible by 16 and the aspect ratio is between 1:3 and 3:1.

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

dall-e-3 supports 1024x1024, 1792x1024, 1024x1792.

stream
boolean
default:false

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

style
enum<string>

Style of generated image. Applies only to dall-e-3.

Available options:
vivid,
natural
user
string

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

Response

Request successful, returns image generation results (supports url/base64 formats)

created
integer
required

Generation timestamp (seconds)

Example:

1745818538

data
(URL format · object | Base64 format · object)[]
required

Image generation result list

usage
object
Last modified on June 16, 2026