You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"description": "GPT-Image-1.5 is an OpenAI model for image generation and editing that supports text-to-image, image-to-image, and inpainting with high prompt fidelity."
7
+
},
8
+
"servers": [
9
+
{
10
+
"url": "https://api.aimlapi.com"
11
+
}
12
+
],
13
+
"paths": {
14
+
"/v1/images/generations": {
15
+
"post": {
16
+
"operationId": "_v1_images_generations",
17
+
"requestBody": {
18
+
"required": true,
19
+
"content": {
20
+
"application/json": {
21
+
"schema": {
22
+
"type": "object",
23
+
"properties": {
24
+
"model": {
25
+
"type": "string",
26
+
"enum": [
27
+
"dall-e-2"
28
+
]
29
+
},
30
+
"prompt": {
31
+
"type": "string",
32
+
"maxLength": 1000,
33
+
"description": "The text prompt describing the content, style, or composition of the image to be generated."
34
+
},
35
+
"n": {
36
+
"type": "number",
37
+
"minimum": 1,
38
+
"maximum": 10,
39
+
"default": 1,
40
+
"description": "The number of images to generate."
41
+
},
42
+
"size": {
43
+
"type": "string",
44
+
"enum": [
45
+
"1024x1024",
46
+
"512x512",
47
+
"256x256"
48
+
],
49
+
"default": "1024x1024",
50
+
"description": "The size of the generated image."
51
+
},
52
+
"response_format": {
53
+
"type": "string",
54
+
"enum": [
55
+
"url",
56
+
"b64_json"
57
+
],
58
+
"default": "url",
59
+
"description": "The format in which the generated images are returned."
60
+
}
61
+
},
62
+
"required": [
63
+
"model",
64
+
"prompt"
65
+
],
66
+
"title": "dall-e-2"
67
+
}
68
+
}
69
+
}
70
+
},
71
+
"responses": {
72
+
"200": {
73
+
"content": {
74
+
"application/json": {
75
+
"schema": {
76
+
"type": "object",
77
+
"properties": {
78
+
"data": {
79
+
"type": "array",
80
+
"nullable": true,
81
+
"items": {
82
+
"type": "object",
83
+
"properties": {
84
+
"url": {
85
+
"type": "string",
86
+
"nullable": true,
87
+
"description": "The URL where the file can be downloaded from.",
"description": "The base64-encoded JSON of the generated image.",
94
+
"example": null
95
+
}
96
+
}
97
+
},
98
+
"description": "The list of generated images."
99
+
},
100
+
"meta": {
101
+
"type": "object",
102
+
"nullable": true,
103
+
"properties": {
104
+
"usage": {
105
+
"type": "object",
106
+
"nullable": true,
107
+
"properties": {
108
+
"tokens_used": {
109
+
"type": "number",
110
+
"description": "The number of tokens consumed during generation.",
111
+
"example": 120000
112
+
}
113
+
},
114
+
"required": [
115
+
"tokens_used"
116
+
]
117
+
}
118
+
},
119
+
"description": "Additional details about the generation."
120
+
}
121
+
}
122
+
}
123
+
}
124
+
}
125
+
}
126
+
},
127
+
"x-hideTryItPanel": true,
128
+
"x-codeSamples": [
129
+
{
130
+
"lang": "JavaScript",
131
+
"source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'dall-e-2',\n prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();"
132
+
},
133
+
{
134
+
"lang": "Python",
135
+
"source": "import requests\n\nresponse = requests.post(\n\"https://api.aimlapi.com/v1/images/generations\",\n headers={\n\"Content-Type\":\"application/json\", \n\"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n\"model\":\"dall-e-2\",\n\"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }\n)\n\ndata = response.json()\nprint(data)"
136
+
},
137
+
{
138
+
"lang": "cURL",
139
+
"source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n\"model\": \"dall-e-2\",\n\"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }'"
140
+
},
141
+
{
142
+
"lang": "HTTP",
143
+
"source": "POST /v1/images/generations HTTP/1.1\nHost: api.aimlapi.com\nAuthorization: Bearer <YOUR_AIMLAPI_KEY>\nContent-Type: application/json\nAccept: */*\n\n{\n\"model\": \"dall-e-2\",\n\"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n}"
0 commit comments