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 base64-encoded JSON of the generated image.",
119
+
"example": null
120
+
}
121
+
}
122
+
},
123
+
"description": "The list of generated images."
124
+
},
125
+
"meta": {
126
+
"type": "object",
127
+
"nullable": true,
128
+
"properties": {
129
+
"usage": {
130
+
"type": "object",
131
+
"nullable": true,
132
+
"properties": {
133
+
"credits_used": {
134
+
"type": "number",
135
+
"description": "The number of tokens consumed during generation.",
136
+
"example": 120000
137
+
}
138
+
},
139
+
"required": [
140
+
"credits_used"
141
+
]
142
+
}
143
+
},
144
+
"description": "Additional details about the generation."
145
+
}
146
+
}
147
+
}
148
+
}
149
+
}
150
+
}
151
+
},
152
+
"x-hideTryItPanel": true,
153
+
"x-codeSamples": [
154
+
{
155
+
"lang": "JavaScript",
156
+
"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\": \"klingai/image-o1\",\n\"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n\"image_urls\": [\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();"
157
+
},
158
+
{
159
+
"lang": "Python",
160
+
"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\": \"klingai/image-o1\",\n\"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n\"image_urls\": [\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }\n)\n\ndata = response.json()\nprint(data)"
161
+
},
162
+
{
163
+
"lang": "cURL",
164
+
"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\": \"klingai/image-o1\",\n\"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n\"image_urls\": [\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n }'"
165
+
},
166
+
{
167
+
"lang": "HTTP",
168
+
"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\": \"klingai/image-o1\",\n\"prompt\": \"Combine the images so the T-Rex is wearing a business suit, sitting in a cozy small café, drinking from the mug. Blur the background slightly to create a bokeh effect.\",\n\"image_urls\": [\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png\",\n\"https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/blue-mug.jpg\"\n ]\n}"
0 commit comments