reve/edit-image

This documentation is valid for the following list of our models:

  • reve/edit-image

Model Overview

The model allows you to modify images using plain text commands: adjust colors, text, and perspectives.

Setup your API Key

If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.

API Schema

post
Authorizations
Body
modelundefined · enumRequiredPossible values:
image_urlstring · uriRequired

The URL of the reference image.

promptstring · max: 2560Required

The text prompt describing the content, style, or composition of the image to be generated.

convert_base64_to_urlbooleanOptional

If True, the URL to the image will be returned; otherwise, the file will be provided in base64 format.

Default: true
output_formatstring · enumOptional

The format of the generated image.

Default: jsonPossible values:
Responses
201

Successfully generated image

application/json
post
async function main() {
  const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      model: 'reve/edit-image',
      prompt: "Add a crown to the T-rex's head.",
      image_url: 'https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png',
    }),
  });

  const data = await response.json();
  console.log(JSON.stringify(data, null, 2));
}

main();
201

Successfully generated image

{
  "data": [
    {
      "url": "text",
      "b64_json": "text"
    }
  ]
}

Quick Example

Let's generate a new image using the one from the flux/dev Quick Example as a reference — and make a simple change to it with a prompt.

import requests
import json  # for getting a structured output with indentation

def main():
    response = requests.post(
        "https://api.aimlapi.com/v1/images/generations",
        headers={
            # Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
            "Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
            "Content-Type": "application/json",
        },
        json={
            "model": "reve/edit-image",
            "prompt": "Make the dinosaur sit on a lounge chair with its back to the camera, looking toward the water. The setting sun has almost disappeared below the horizon.",
            "image_url": "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png"
        }
    )

    data = response.json()
    print(json.dumps(data, indent=2, ensure_ascii=False))

if __name__ == "__main__":
    main()
Response
{
  "data": [
    {
      "url": "https://cdn.aimlapi.com/generations/phoenix/1759282497910-293a844d-2f8c-4513-85e8-c80dec720892.png",
      "b64_json": null,
      "request_id": "rsid-4af47c2ebb2e31f34dce88cb35873bab",
      "content_violation": false
    }
  ],
  "meta": {
    "usage": {
      "tokens_used": 210000
    }
  }
}
Reference Image
Generated Image

Last updated

Was this helpful?