Image Edits

POST /v1/images/edits

Remove backgrounds, inpaint masked regions, or upscale images using Stability AI models.

Request

POST https://api.chuizi.ai/v1/images/edits

Authentication

Authorization: Bearer ck-your-api-key

Parameters

ParameterTypeRequiredDefaultDescription
modelstringYesModel name (see available models below)
imagestringYesBase64-encoded source image
promptstringConditionalText description of the desired edit (required for inpaint)
maskstringConditionalBase64-encoded mask image for inpainting (white = edit region)

Available Models

ModelUse CaseRequires PromptRequires Mask
stability/remove-backgroundRemove image backgroundNoNo
stability/inpaintFill masked regions with AI-generated contentYesYes
stability/fast-upscaleUpscale image resolutionNoNo

Request Example (Inpainting)

config.json
json
{
  "model": "stability/inpaint",
  "image": "iVBORw0KGgo...(base64)",
  "mask": "iVBORw0KGgo...(base64)",
  "prompt": "A red brick wall with ivy growing on it",
  "response_format": "url"
}

Request Example (Background Removal)

config.json
json
{
  "model": "stability/remove-background",
  "image": "iVBORw0KGgo...(base64)",
  "response_format": "url"
}

Response

config.json
json
{
  "created": 1712000000,
  "data": [
    {
      "url": "https://media.chuizi.ai/images/gen-xxxxxxxx.png"
    }
  ],
  "x_chuizi": {
    "generation_id": "gen-xxxxxxxxxxxxxxxx",
    "latency_ms": 3200,
    "cost": "0.03000000"
  }
}

Code Examples

terminal
bash
curl -X POST https://api.chuizi.ai/v1/images/edits \
  -H "Authorization: Bearer ck-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "stability/remove-background",
    "image": "'$(base64 -i photo.png)'"
  }'

Next Steps