Pruna AI P Image Edit LoRA API Documentation
Playground
Try it on WaveSpeedAI!Pruna AI P-Image Edit LORA is a fast AI image editing model that edits and transforms images with LORA-based customization. Ready-to-use REST inference API for text-guided image editing, style changes, character consistency, product image updates, marketing assets, and custom AI editing workflows with simple integration, no coldstarts, and affordable pricing.
Features
Pruna AI P-Image Edit LoRA edits one or more input images using a natural-language instruction, with optional LoRA guidance for stronger style or edit control. It is designed for workflows where you want prompt-based image editing together with a LoRA trained specifically for the Pruna p-image-edit-lora pipeline.
Why Choose This?
-
LoRA-guided image editing Edit images with natural-language instructions while steering the result with a compatible LoRA.
-
Multi-image reference support Use one to five input images to guide appearance, structure, composition, or scene transformation.
-
Edit-specific LoRA control Apply
lora_weightsand tunelora_scalefor stronger stylistic or transformation control. -
Flexible aspect ratio handling Use
match_input_imageto follow the first input image by default, or select a preset aspect ratio when needed. -
Private LoRA support Use
hf_api_tokenwhen accessing a private or gated Hugging Face LoRA repository. -
Simple fixed pricing Each run uses a flat per-image price.
Parameters
| Parameter | Required | Description |
|---|---|---|
| prompt | Yes | Text instruction describing the desired edit. |
| images | Yes | One to five reference images used for the edit. When using multiple images, describe their roles clearly in the prompt. |
| lora_weights | No | Optional Hugging Face LoRA path, such as huggingface.co/PrunaAI/p-image-edit-next-scene-lora/weights.safetensors. The LoRA should be trained for p-image-edit-lora. |
| lora_scale | No | LoRA strength. Default: 0.5. Official range: -1 to 3. |
| hf_api_token | No | Optional Hugging Face token for private or gated LoRA repositories. |
| aspect_ratio | No | Output aspect ratio. Default: match_input_image, which follows the first input image. Other supported values: 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, and 2:3. |
| output_format | No | Output image format: png, jpeg, or webp. |
| seed | No | Random seed. Use -1 for random generation. |
How to Use
- Upload your reference images — provide one to five images you want to use for the edit.
- Write your prompt — describe what should change and what should remain unchanged.
- Add a LoRA (optional) — provide
lora_weightsif you want LoRA-guided editing. - Adjust LoRA strength (optional) — set
lora_scaleto control how strongly the LoRA affects the result. - Choose aspect ratio — keep
match_input_imageto follow the first input image, or select a preset ratio if needed. - Add a Hugging Face token (optional) — use
hf_api_tokenif your LoRA is private or gated. - Choose output format — select
png,jpeg, orwebp. - Set a seed (optional) — use
-1for random output, or a fixed value for more reproducible edits. - Submit — run the model and download the edited image.
Example Prompt
Make this scene look like the next scene style.
Pricing
Just $0.01 per generated image.
Best Use Cases
- Scene-to-scene style transfer — Rework one scene to match the visual style of another.
- Character-consistent editing — Preserve identity while changing mood, styling, or composition.
- Reference-guided transformations — Use multiple images and a LoRA for tighter edit control.
- Creative adaptation — Turn existing images into new variants for storytelling, design, or campaign work.
- Edit-specific LoRA workflows — Apply LoRAs trained for editing rather than text-to-image generation.
Pro Tips
- Use a LoRA trained specifically for p-image-edit-lora for best compatibility.
- Text-to-image LoRAs should be used with p-image-lora, not this model.
- When using multiple images, explain each image’s role clearly in the prompt.
- Use
match_input_imagewhen you want to preserve the framing of the first input image. - Adjust
lora_scalegradually to balance prompt influence and LoRA influence. - If your LoRA is private or gated on Hugging Face, provide
hf_api_token. - Reuse the same
seedwhen you want more consistent edit iterations.
Notes
- Both
promptandimagesare required. imagessupports one to five input images.lora_weightsis optional.- LoRAs for this model should be trained for p-image-edit-lora.
- Text-to-image LoRAs should be used with p-image-lora instead.
aspect_ratiodefaults tomatch_input_image, which follows the first input image.seeduses-1for random generation.- Turbo mode is off and the safety checker is disabled by default; these are not user-facing controls.
- Pricing is fixed at $0.01 per generated image.
Related Models
- Pruna AI P-Image Text-to-Image — Generate images directly from prompts.
- Pruna AI P-Image Text-to-Image LoRA — Generate images from prompts with LoRA style control.
- Pruna AI P-Image Edit — Edit images with natural-language instructions without a LoRA.
- Pruna AI P-Image Upscale — Enhance and enlarge existing images.
Authentication
For authentication details, please refer to the Authentication Guide.
API Endpoints
Submit Task & Query Result
set -euo pipefail
export WAVESPEED_API_KEY="your-api-key"
REQUEST_BODY=$(cat <<'JSON'
{
"prompt": "A cinematic ocean wave at sunrise, highly detailed",
"images": [
"https://interactive-examples.mdn.mozilla.net/media/cc0-images/painted-hand-298-332.jpg"
],
"lora_scale": 1,
"aspect_ratio": "match_input_image",
"output_format": "png"
}
JSON
)
# 1. Submit the prediction once. Never retry this request automatically:
# a retry after an unclear failure can create a second, billed task.
CHECK='The task may already exist. Check History or the predictions list before submitting again.'
if ! SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 \
-X POST "https://api.wavespeed.ai/api/v3/pruna-ai/p-image/edit-lora" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d "${REQUEST_BODY}"); then
printf 'Submit failed. %s\n' "${CHECK}" >&2
exit 1
fi
TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
printf 'Submission response did not contain a prediction id. %s\n' "${CHECK}" >&2
exit 1
fi
RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"
# 2. Poll until the prediction reaches a final status.
BODY_FILE=$(mktemp)
trap 'rm -f "${BODY_FILE}"' EXIT
while true; do
# Transient errors (429, 5xx) are retried, honoring Retry-After.
HTTP_CODE=$(curl --silent --show-error --fail-with-body \
--connect-timeout 10 --max-time 60 --retry 5 --retry-delay 2 \
--output "${BODY_FILE}" --write-out '%{http_code}' \
"${RESULT_URL}" \
-H "Authorization: Bearer ${WAVESPEED_API_KEY}" || true)
case "${HTTP_CODE}" in
2??) ;;
000|429|5??) # dropped connection or temporary error: keep polling
printf 'Task %s: HTTP %s, polling again in 10s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
sleep 10; continue ;;
*) printf 'Task %s: HTTP %s\n' "${PREDICTION_ID}" "${HTTP_CODE}" >&2
cat "${BODY_FILE}" >&2; exit 1 ;;
esac
RESULT=$(jq 'if type == "object" and has("data") then .data else . end' "${BODY_FILE}")
STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')
case "${STATUS}" in
completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
failed|cancelled|timeout|deleted)
printf 'Task %s ended with status %s\n' "${PREDICTION_ID}" "${STATUS}" >&2
printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
*) sleep 2 ;;
esac
doneRetry temporary errors only while polling, never the submit request. Errors, retries and timeouts
Parameters
Task Submission Parameters
Request Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
| prompt | string | Yes | - | Edit instruction. | |
| images | array<string> | Yes | - | 0 ~ 5 items | Reference image URLs. Upload 1 to 5 images. |
| lora_weights | string | No | - | - | LoRA weights in Hugging Face format, for example huggingface.co/PrunaAI/p-image-edit-next-scene-lora/weights.safetensors. Use LoRAs trained for p-image-edit-lora. |
| lora_scale | number | No | 1 | -1 ~ 3 | Scale of the LoRA weights. |
| hf_api_token | string | No | - | - | Optional Hugging Face API token used to access the LoRA weights. |
| aspect_ratio | string | No | match_input_image | match_input_image, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 | Aspect ratio of the generated image. match_input_image follows the first input image. |
| output_format | string | No | png | png, jpeg, webp | Output image format. |
| seed | integer | No | - | - | Random seed. -1 means random. |
Every model also accepts the global request options enable_sync_mode and enable_base64_output; see their pages for details.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data.id | string | Unique identifier for the prediction, Task Id |
| data.model | string | Model ID used for the prediction |
| data.outputs | array | Output values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed) |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Task status. completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses. |
| data.created_at | string | ISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”) |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |
Result Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| id | string | Yes | - | Task ID |
Result Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | HTTP status code (e.g., 200 for success) |
| message | string | Status message (e.g., “success”) |
| data | object | The prediction data object containing all details |
| data.id | string | Unique identifier for the prediction |
| data.model | string | Model ID used for the prediction |
| data.outputs | array<string | object> | Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model. |
| data.urls | object | Object containing related API endpoints |
| data.status | string | Status: completed is successful; failed, cancelled, timeout, and deleted are failure terminal statuses |
| data.created_at | string | ISO timestamp of when the request was created |
| data.error | string | Error message (empty if no error occurred) |
| data.timings | object | Object containing timing details |
| data.timings.inference | integer | Inference time in milliseconds |