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
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | — | Model name (see available models below) |
image | string | Yes | — | Base64-encoded source image |
prompt | string | Conditional | — | Text description of the desired edit (required for inpaint) |
mask | string | Conditional | — | Base64-encoded mask image for inpainting (white = edit region) |
Available Models
| Model | Use Case | Requires Prompt | Requires Mask |
|---|---|---|---|
stability/remove-background | Remove image background | No | No |
stability/inpaint | Fill masked regions with AI-generated content | Yes | Yes |
stability/fast-upscale | Upscale image resolution | No | No |
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
- Image Generations API — generate new images from text prompts
- Image Generation Guide — best practices for image prompts
- Pricing — image editing costs per model