{ "openapi": "3.0.0", "info": { "title": "AIML API", "version": "1.0.0" }, "servers": [ { "url": "https://api.aimlapi.com" } ], "paths": { "/v1/images/generations": { "post": { "operationId": "_v1_images_generations", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "model": { "type": "string", "enum": [ "meta/muse-image-edit" ] }, "prompt": { "type": "string", "description": "The text prompt describing the content, style, or composition of the image to be generated." }, "image_urls": { "type": "array", "items": { "type": "string", "format": "uri" }, "minItems": 1, "maxItems": 10, "description": "List of URLs or local Base64 encoded images to edit." }, "num_images": { "type": "number", "minimum": 1, "maximum": 10, "default": 1, "description": "The number of images to generate." }, "aspect_ratio": { "type": "string", "enum": [ "21:9", "16:9", "4:3", "3:2", "1:1", "2:3", "3:4", "9:16", "9:21" ], "description": "The aspect ratio of the edited image. If omitted, the aspect ratio of the last provided reference image is used." }, "output_format": { "type": "string", "enum": [ "jpeg", "png", "webp" ], "default": "webp", "description": "The format of the generated image." } }, "required": [ "model", "prompt", "image_urls" ], "title": "meta/muse-image-edit" } } } }, "responses": { "200": { "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "nullable": true, "items": { "type": "object", "properties": { "url": { "type": "string", "nullable": true, "description": "The URL where the file can be downloaded from.", "example": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png" }, "b64_json": { "type": "string", "nullable": true, "description": "The base64-encoded JSON of the generated image.", "example": null } } }, "description": "The list of generated images." }, "meta": { "type": "object", "nullable": true, "properties": { "usage": { "type": "object", "nullable": true, "properties": { "credits_used": { "type": "number", "description": "The number of tokens consumed during generation.", "example": 120000 }, "usd_spent": { "type": "number", "description": "The total amount of money spent by the user in USD.", "example": 0.06 } }, "required": [ "credits_used", "usd_spent" ] } }, "description": "Additional details about the generation." } } } } }, "description": "Successful response." } }, "x-hideTryItPanel": true, "x-codeSamples": [ { "lang": "cURL", "source": "curl --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer ' \\\n --header 'Content-Type: application/json' \\\n --data '{\"model\": \"meta/muse-image-edit\", \"prompt\": \"Describe what you want the model to generate.\", \"image_urls\": [\"https://example.com/input.jpg\"]}'" }, { "lang": "JavaScript", "source": "const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer ',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n \"model\": \"meta/muse-image-edit\",\n \"prompt\": \"Describe what you want the model to generate.\",\n \"image_urls\": [\n \"https://example.com/input.jpg\"\n ]\n}),\n});\n\nconsole.log(await response.json());" }, { "lang": "Python", "source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Authorization\": \"Bearer \",\n \"Content-Type\": \"application/json\",\n },\n json={'model': 'meta/muse-image-edit', 'prompt': 'Describe what you want the model to generate.', 'image_urls': ['https://example.com/input.jpg']},\n)\n\nprint(response.json())" } ] } } }, "components": { "securitySchemes": { "access-token": { "scheme": "bearer", "bearerFormat": "", "type": "http", "description": "Bearer key" } } } }