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": "The text prompt describing the content, style, or composition of the image to be generated."
33
+
},
34
+
"background": {
35
+
"type": "string",
36
+
"enum": [
37
+
"transparent",
38
+
"opaque",
39
+
"auto"
40
+
],
41
+
"default": "auto",
42
+
"description": "Allows to set transparency for the background of the generated image(s). When auto is used, the model will automatically determine the best background for the image.\nIf transparent, the output format needs to support transparency, so it should be set to either png (default value) or webp."
43
+
},
44
+
"moderation": {
45
+
"type": "string",
46
+
"enum": [
47
+
"low",
48
+
"auto"
49
+
],
50
+
"default": "auto",
51
+
"description": "Control the content-moderation level for images."
52
+
},
53
+
"n": {
54
+
"type": "number",
55
+
"enum": [
56
+
1
57
+
],
58
+
"default": 1,
59
+
"description": "The number of images to generate."
60
+
},
61
+
"output_compression": {
62
+
"type": "integer",
63
+
"minimum": 0,
64
+
"maximum": 100,
65
+
"default": 100,
66
+
"description": "The compression level (0-100%) for the generated images."
67
+
},
68
+
"output_format": {
69
+
"type": "string",
70
+
"enum": [
71
+
"png",
72
+
"jpeg",
73
+
"webp"
74
+
],
75
+
"default": "png",
76
+
"description": "The format of the generated image."
77
+
},
78
+
"quality": {
79
+
"type": "string",
80
+
"enum": [
81
+
"low",
82
+
"high",
83
+
"medium"
84
+
],
85
+
"default": "medium",
86
+
"description": "The quality of the image that will be generated."
87
+
},
88
+
"size": {
89
+
"type": "string",
90
+
"enum": [
91
+
"1024x1024",
92
+
"1024x1536",
93
+
"1536x1024"
94
+
],
95
+
"default": "1024x1024",
96
+
"description": "The size of the generated image."
97
+
},
98
+
"response_format": {
99
+
"type": "string",
100
+
"enum": [
101
+
"url",
102
+
"b64_json"
103
+
],
104
+
"default": "url",
105
+
"description": "The format in which the generated images are returned."
106
+
}
107
+
},
108
+
"required": [
109
+
"model",
110
+
"prompt"
111
+
],
112
+
"title": "openai/gpt-image-1-mini"
113
+
}
114
+
}
115
+
}
116
+
},
117
+
"responses": {
118
+
"200": {
119
+
"content": {
120
+
"application/json": {
121
+
"schema": {
122
+
"type": "object",
123
+
"properties": {
124
+
"data": {
125
+
"type": "array",
126
+
"nullable": true,
127
+
"items": {
128
+
"type": "object",
129
+
"properties": {
130
+
"url": {
131
+
"type": "string",
132
+
"nullable": true,
133
+
"description": "The URL where the file can be downloaded from.",
"description": "The base64-encoded JSON of the generated image.",
140
+
"example": null
141
+
}
142
+
}
143
+
},
144
+
"description": "The list of generated images."
145
+
},
146
+
"meta": {
147
+
"type": "object",
148
+
"nullable": true,
149
+
"properties": {
150
+
"usage": {
151
+
"type": "object",
152
+
"nullable": true,
153
+
"properties": {
154
+
"credits_used": {
155
+
"type": "number",
156
+
"description": "The number of tokens consumed during generation.",
157
+
"example": 120000
158
+
}
159
+
},
160
+
"required": [
161
+
"credits_used"
162
+
]
163
+
}
164
+
},
165
+
"description": "Additional details about the generation."
166
+
}
167
+
}
168
+
}
169
+
}
170
+
}
171
+
}
172
+
},
173
+
"x-hideTryItPanel": true,
174
+
"x-codeSamples": [
175
+
{
176
+
"lang": "JavaScript",
177
+
"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: 'openai/gpt-image-1-mini',\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();"
178
+
},
179
+
{
180
+
"lang": "Python",
181
+
"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\":\"openai/gpt-image-1-mini\",\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)"
182
+
},
183
+
{
184
+
"lang": "cURL",
185
+
"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\": \"openai/gpt-image-1-mini\",\n\"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }'"
186
+
},
187
+
{
188
+
"lang": "HTTP",
189
+
"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\": \"openai/gpt-image-1-mini\",\n\"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n}"
0 commit comments