Skip to main content
Use POST https://api.apione.ai/v1/images/edits to edit images.

Before running examples

Install Python 3, then install the dependency with the same interpreter that will run the example:
If your system uses python3, use python3 for both installation and execution. Windows users can use py -m pip install requests and py example.py. Activate your virtual environment first, if applicable. Create a key on the API Keys page, copy a model ID that supports image editing from the available model list, then set the variables in the terminal where you will run the script. The uppercase values below are placeholders to replace.
Variables only apply to the current terminal and child processes it starts. Run the examples in the same terminal; IDEs, containers, and new terminals need separate configuration. Do not commit real keys to source control.

Pre-request confirmation

  1. The current key can call the target image editing model.
  2. /v1/models/{model}/params shows that the model supports editing or reference image input.
  3. Image type, size, count, and delivery method meet the model’s requirements.

Request structure

The request needs at least a model, editing prompt, and image input. Different models may use image URL, Base64, file ID, or other fields, so follow the parameter query results first.
Send the request to:
If the model requires multipart, a dedicated reference image field, or an additional mask, use the fields from that model’s parameter page strictly. Do not treat the structural example above as a fixed format for all models.

Validate results

  • Whether the subject and edited area match the prompt.
  • Whether image dimensions, format, and transparency channel meet business requirements.
  • Request status, usage, and cost in the console.
  • Whether the request ID in the response can be retrieved in the details.

Editing task breakdown

First determine which type of edit it is, then choose a model that supports that capability:

Request preparation workflow

  1. Find available image editing models through /v1/models.
  2. Query /v1/models/{model}/params to confirm the image input method.
  3. Check file format, pixel dimensions, and file size locally.
  4. Start with one small image and a simple prompt for validation.
  5. Print the full response and request ID before implementing result download.
If the parameter page requires JSON URL or Base64, construct JSON according to the model declaration; if it requires multipart/form-data, use file upload fields instead of forcing JSON.

Python request template

The template below is only for cases where the target model explicitly supports a JSON image field. Set APIONE_IMAGE_INPUT to a picture URL, Base64, or file ID accepted by that field. If using a URL, it must be readable by the server; a local path (such as C:\images\input.png) cannot be used directly as a remote image URL. If the model uses other fields or multipart, adjust the request according to the parameter documentation.

Result quality checks

  • Whether subject identity, text, logo, or product structure was unexpectedly changed.
  • Whether mask edges show obvious seams.
  • Whether output dimensions and transparency channel are preserved.
  • Whether reference images contain unauthorized personal or commercial material.
  • Whether retries generated multiple results and incurred duplicate charges.

Common errors

When images contain sensitive data, do not save original images, full Base64, or authenticated download URLs in logs.

When parameter metadata is empty

HTTP 200 with params: [], request: {}, or an empty billingMode means those details were not declared in this response. It does not prove that a capability is unsupported, permit arbitrary parameters, or indicate a free call. The usage, request, second, and image entries in chargeModes are listed mode names, not proof that a model bills all four ways.
  1. Check the APIONE model details and current key group for protocols and prices.
  2. Use confirmed model-specific instructions for size, quality, reference images, masks, and other fields; do not copy enums from another model.
  3. Without confirmed parameter instructions, verify the minimal request first and avoid optional fields or batch jobs.
  4. Contact support with the model ID, endpoint, time, and actual request identifiers. Do not send the full key.
Next: Image generation, Media parameters, Troubleshooting, Request reliability.