Skip to main content
POST
/
v1
/
images
/
generations
cURL
curl --request POST \
  --url https://api.ttapi.io/v1/images/generations \
  --header 'Content-Type: application/json' \
  --header 'TT-API-KEY: <api-key>' \
  --data '
{
  "prompt": "<string>",
  "background": "auto",
  "mode": "dall-e-2",
  "moderation": "auto",
  "n": 123,
  "output_compression": "100",
  "output_format": "png",
  "quality": "auto",
  "response_format": "<string>",
  "size": "auto",
  "style": "vivid (vivid)"
}
'
{
  "created": 1745818538,
  "data": [
    {
      "url": "https://filesystem.site/cdn/20250428/5LsFMT0Def02RVVUkwJ4v7IslleMzo.webp",
      "revised_prompt": "A cute fluffy cat with big, bright eyes, soft fur, and a playful expression. It has a light gray coat with hints of white on its paws and tail. The cat is sitting in a cozy setting, surrounded by soft cushions, with its tail wrapped around its paws. Its ears are perked up, and it's looking directly at the viewer, exuding a sense of curiosity and warmth."
    }
  ],
  "usage": {
    "input_tokens": 9,
    "input_tokens_details": {
      "image_tokens": 0,
      "text_tokens": 9
    },
    "output_tokens": 4160,
    "total_tokens": 4169
  }
}

OpenAI Image Models

TTAPI integrates OpenAI’s powerful image generation models, allowing you to integrate them into your services in a more convenient and cost-effective way.
The gpt-image-1 model may take longer to process on the official endpoint. We recommend using our gateway https://api.ttapi.org to avoid request timeouts.

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.

background
enum<string>
default:auto

Controls the transparency of generated image backgrounds.
This parameter only applies to gpt-image-1. Choose one of: transparent, opaque, or auto (default). When set to auto, the model automatically determines the optimal background.
If set to transparent, the output format must support transparency, so use png or webp.

Available options:
transparent,
opaque,
auto
mode
enum<string>
default:dall-e-2

Supported models

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

Controls the content moderation level for images generated by gpt-image-1. 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%). This parameter only applies to gpt-image-1 with output format webp or jpeg, defaults to 100.

output_format
enum<string>
default:png

Return image format. This parameter only applies to gpt-image-1. Options: png (default), jpeg, webp.

Available options:
png,
png,
jpeg
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.

style
enum<string>

Style of generated image. This parameter only applies to dall-e-3.

Available options:
vivid (vivid),
natural (natural)

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