Image edit
Pricing: Image edit
One to three images and an instruction in, one edited image out. The same job as a generation on www.happypony.io/image-edit.
POST https://api.happypony.io/api/v1/jobs/image-edit
GET https://api.happypony.io/api/v1/jobs/:requestId/status
GET https://api.happypony.io/api/v1/jobs/:requestId
PUT https://api.happypony.io/api/v1/jobs/:requestId/cancel
1) Create a request
POST https://api.happypony.io/api/v1/jobs/image-edit with Content-Type: application/json.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
prompt |
string | yes | — | The edit. Refer to the inputs as image 1, 2 and 3. With minimax-h3-image-edit, write them as <Picture 1>, <Picture 2>, <Picture 3> and say what to keep ("Put the cat from <Picture 1> on the sofa in <Picture 2>; keep the room unchanged"); the prompt is used exactly as written. |
image_urls |
string[] | yes | — | 1 to 3 images, in order. See Image inputs. |
model |
string | no | "qwen-image-edit" |
"qwen-image-edit", "nano-banana-edit", "nano-banana-2-edit" or "minimax-h3-image-edit" (MiniMax-H3-Image: up to 16 megapixels). |
aspect_ratio |
string | no | "1:1" |
"auto", "16:9", "4:3", "1:1", "3:4" or "9:16". With qwen-image-edit, "auto" gives a square; the nano-banana models follow the input. |
short_edge |
integer | no | 1080 |
1080, 1440 or 2048. With qwen-image-edit, the shorter side in pixels, sized as for text to image (16:9 at 1080 is 1920×1080; 2048 is 2048×2048 pixels in all, 2720×1536 at 16:9); the nano-banana models size the output themselves. With minimax-h3-image-edit: 2048 (the default) or 4096 (16 megapixels: 4096×4096 at 1:1, 5472×3072 at 16:9), and aspect_ratio "auto" means 1:1. |
Request body:
{
"prompt": "Put her on a rainy Tokyo street at night; keep her face, hair and clothes",
"image_urls": ["https://resource.pipelet.net/images/test/selfie3.png"],
"model": "qwen-image-edit",
"aspect_ratio": "3:4",
"short_edge": 1080
}
curl -X POST https://api.happypony.io/api/v1/jobs/image-edit \
-H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "Put her on a rainy Tokyo street at night; keep her face, hair and clothes", "image_urls": ["https://resource.pipelet.net/images/test/selfie3.png"], "model": "qwen-image-edit", "aspect_ratio": "3:4", "short_edge": 1080}'
Response 202 (fields: Create response):
{
"request_id": "48301",
"type": "image-edit",
"status": "IN_QUEUE",
"credits": 6,
"status_url": "https://api.happypony.io/api/v1/jobs/48301/status",
"response_url": "https://api.happypony.io/api/v1/jobs/48301",
"cancel_url": "https://api.happypony.io/api/v1/jobs/48301/cancel"
}
2) Poll for status
Poll the status_url until status is COMPLETED, FAILED or CANCELLED (fields: Status response). A queued job can be cancelled with PUT on the cancel_url (Cancel a request).
curl https://api.happypony.io/api/v1/jobs/48301/status -H "Authorization: Bearer $HP_KEY"
{
"request_id": "48301",
"type": "image-edit",
"status": "IN_PROGRESS",
"created_at": "2026-10-05T10:00:00.000Z",
"completed_at": null,
"credits": 6,
"status_url": "…", "response_url": "…", "cancel_url": "…"
}
3) Fetch the result
When status is COMPLETED, fetch the response_url (common fields: Result response):
curl https://api.happypony.io/api/v1/jobs/48301 -H "Authorization: Bearer $HP_KEY"
{
"request_id": "48301",
"type": "image-edit",
"status": "COMPLETED",
"created_at": "2026-10-05T10:00:00.000Z",
"completed_at": "2026-10-05T10:00:48.000Z",
"credits": 6,
"images": [{ "url": "https://…signed…", "format": "png" }],
"expires_in": 259200,
"parameters": { "prompt": "Put her on a rainy Tokyo street at night; keep her face, hair and clothes",
"model": "qwen-image-edit", "aspect_ratio": "3:4", "short_edge": 1080 },
"status_url": "…", "response_url": "…", "cancel_url": "…"
}
| Field | Type | Description |
|---|---|---|
images |
object[] | The edited image. |
parameters |
object | prompt, model, aspect_ratio, short_edge. |
Full example
Create, poll until done, download:
curl (bash)
# Needs curl and jq. Usage: HP_KEY=hp_… ./edit.sh
JOB=$(curl -s -X POST https://api.happypony.io/api/v1/jobs/image-edit \
-H "Authorization: Bearer $HP_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "Put her on a rainy Tokyo street at night; keep her face, hair and clothes",
"image_urls": ["https://resource.pipelet.net/images/test/selfie3.png"]}')
echo "$JOB" | jq .
STATUS_URL=$(echo "$JOB" | jq -r .status_url)
RESPONSE_URL=$(echo "$JOB" | jq -r .response_url)
while :; do
STATUS=$(curl -s "$STATUS_URL" -H "Authorization: Bearer $HP_KEY" | jq -r .status)
[ "$STATUS" = IN_QUEUE ] || [ "$STATUS" = IN_PROGRESS ] || break
sleep 5
done
echo "$STATUS"
curl -s "$RESPONSE_URL" -H "Authorization: Bearer $HP_KEY" | jq -r '.images[] | "\(.format) \(.url)"' |
while read -r FORMAT URL; do curl -s -o "edit-$((++i)).$FORMAT" "$URL"; done
Python
# pip install requests | HP_KEY=hp_… python edit.py
import os, time, requests
BASE = "https://api.happypony.io/api/v1/jobs"
H = {"Authorization": f"Bearer {os.environ['HP_KEY']}"}
job = requests.post(f"{BASE}/image-edit", headers=H, json={
"prompt": "Dress the woman in image 1 in the jacket from image 2",
"image_urls": [
"https://resource.pipelet.net/images/test/selfie3.png",
# a local file: requests.post(f"{BASE}/uploads", headers=H, files={"file": open("jacket.png", "rb")}).json()["url"]
"https://example.com/jacket.png",
],
"model": "nano-banana-edit",
"aspect_ratio": "auto",
})
job.raise_for_status()
job = job.json()
while (s := requests.get(job["status_url"], headers=H).json())["status"] in ("IN_QUEUE", "IN_PROGRESS"):
time.sleep(5)
result = requests.get(job["response_url"], headers=H).json()
if result["status"] != "COMPLETED":
raise SystemExit(f"{result['status']}: {result.get('error', '')}")
for i, image in enumerate(result["images"]):
with open(f"edit-{job['request_id']}-{i}.{image['format']}", "wb") as f:
f.write(requests.get(image["url"]).content)