OpenAI Image Models
DALLE 3 Generate Image (sync)
POST
https://api.ttapi.io/openai/v1/images/generations
Headers
Name | Type | Description |
---|---|---|
TT-API-KEY* | String | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
prompt | String | true | Prompt use to generate image |
size | String | true | Image Size: 1024x1024 1024x1792 1792x1024 |
model | String | false | dall-e-3 |
n | Int | false | generate images number only can ues 1 in dall-e-3 |
quality | String | false | Picture quality, optional range:standard , hd |
Example Request
import requests
endpoint = "https://api.ttapi.io/openai/v1/images/generations"
headers = {
"TT-API-KEY": your_key
}
data = {
"prompt": "a cat",
"size": "1024x1024"
}
response = requests.post(endpoint, headers=headers, json=data)
print(response.status_code)
print(response.json())
Example Response
There are expiration restrictions on the images returned by Dalle3. Please transfer the images yourself when using them.
{
"status": "SUCCESS",
"message": "success",
"data": {
"created": 1713577682,
"data": [
{
"revised_prompt": "A serene, domestic scene unfolding at dusk: a fluffy, long-haired tabby cat with piercing green eyes and distinctive black and white stripes curled up on a cozy, burgundy-colored velvet cushion. Around the cat is the warmth of a rustic country home, with wooden beams and a crackling fireplace. Light streams in through a large, arched window, painting the scene in the beautiful, ethereal light of golden hour.",
"url": "https://dalleprodaue.blob.core.windows.net/private/images/cbb4adae-b889-4adf-9b84-4cd6d72d74fc/generated_00.png?se=2024-04-21T01%3A48%3A14Z&sig=th9fuLXfJVtLUOWu%2BfkJk1aY8abDZTDe7aIWJ1QzLkY%3D&ske=2024-04-26T13%3A43%3A10Z&skoid=f4f58869-78fa-4857-8a87-4ce5ae4ba8c3&sks=b&skt=2024-04-19T13%3A43%3A10Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02"
}
]
}
}
ChaGPT-4o Generate Image (async)
POST
https://api.ttapi.io/openai/4o-image/generations
Generate images based on text prompts and image resources. Using the OpenAI ChatGPT-4o Model
Headers
Name | Type | Description |
---|---|---|
TT-API-KEY* | String | Your API Key in TT API used for request authorization |
Request Body
Name | Type | Required | Description |
---|---|---|---|
prompt | String | true | Prompt use to generate image |
referImages | array | false | Base the image then generate exp: [ "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg", "https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"] |
hookUrl | String | false | Send a request to the address for task completion or failed notification. If not set you need to request fetch endpoint to get response |
Example Request
import requests
endpoint = "https://api.ttapi.io/openai/4o-image/generations"
headers = {
"TT-API-KEY": your_key
}
data = {
"prompt": "Draw a flat photo of a beautiful model wearing the clothes. It requires high pixels, high fidelity, perfect restoration of all the details of the clothes, full-body photo with professional pose, sexy figure, fashionable clothes, smiling, and fair skin.",
"referImages": [
"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
],
}
response = requests.post(endpoint, headers=headers, json=data)
print(response.status_code)
print(response.json())
Example Response
{
"status": "SUCCESS",
"message": "success",
"data": {
"jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb"
}
}
Fetch ChatGPT-4o Image Result
POST/GET
https://api.ttapi.io/openai/4o-image/fetch
Get the generate task result query, the returned json data is same with the return in hookUrl
Headers
Name | Type | Description |
---|---|---|
TT-API-KEY* | String | Your API Key in TT API used for request authorization |
Request Body / Query param
Name | Type | Required | Description |
---|---|---|---|
jobId | String | true | 5ecc5080-b1d7-4b9f-8184-435e46ebb5cb |
Example Request
import requests
endpoint = "https://api.ttapi.io/openai/4o-image/fetch"
headers = {
"TT-API-KEY": your_key
}
data = {
"jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb",
}
response = requests.post(endpoint, headers=headers, json=data)
print(response.status_code)
print(response.json())
ChatGPT-4o Image Async callback & Fetch json
{
"status": "SUCCESS",
"message": "success",
"jobId": "5ecc5080-b1d7-4b9f-8184-435e46ebb5cb",
"data": {
"prompt": "Draw a flat photo of a beautiful model wearing the clothes. It requires high pixels, high fidelity, perfect restoration of all the details of the clothes, full-body photo with professional pose, sexy figure, fashionable clothes, smiling, and fair skin.",
"referImages": [
"https://cdn.ttapi.io/demo/2025-03-30/5d17dd5207daeeac86bcecd2d6405a0.jpg"
],
"imageUrl": "https://cdnc.ttapi.io/2025-03-31/cd3f3ce5-06be-4b3a-9aed-014045ca1804.png",
"quota": "2",
"finishTime": "2025-03-31 04:25:33",
"hookUrl": "https://webhook-test.com/b129b43b6619f977b3227387fc290f7d"
}
}