Developer Dashboard

Stability AI Image Editing Services (Deprecated)

The older specialized Stability AI image-editing services are not currently listed in data/models.json, so the previous stability.stable-image-* examples are no longer a supported AvalAI path. Keep this page as a migration note for old links only.

Supported Editing Paths

  • Use gpt-image-2 for mask-based edits, reference-image workflows, layout preservation, and high-fidelity changes.
  • Use seedream-5-0-260128 or seedream-4-5-251128 for BytePlus image editing where that model fits your application.
  • Use qwen-image-edit-plus or qwen-image-edit for Alibaba image-editing workflows.
  • Check v1/images/edits before shipping because editing capabilities differ by model and route.

Replacement Edit Example

python
import base64
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

with open("room.png", "rb") as image_file, open("mask.png", "rb") as mask_file:
    response = client.images.edit(
        model="gpt-image-2",
        image=image_file,
        mask=mask_file,
        prompt="Keep the room unchanged, but replace the masked object with a small indoor tree.",
        size="1024x1024",
    )

with open("edited-room.png", "wb") as output_file:
    output_file.write(base64.b64decode(response.data[0].b64_json))
javascript
import fs from "fs";
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.images.edit({
  model: "gpt-image-2",
  image: fs.createReadStream("room.png"),
  mask: fs.createReadStream("mask.png"),
  prompt:
    "Keep the room unchanged, but replace the masked object with a small indoor tree.",
  size: "1024x1024",
});

fs.writeFileSync(
  "edited-room.png",
  Buffer.from(response.data[0].b64_json, "base64")
);