Pruna P Image Edit Serverless API

Pruna's p-image-edit enables sophisticated multi-image editing with AI-guided precision and style applications.

~7.53s
$0.01 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/p-image-edit"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Make the character from image 1 lean against the logo from image 2, as if the logo is standing upright on the ground",
12    "image_urls": [
13        "https://segmind-resources.s3.amazonaws.com/input/116b8cb5-bfc4-4589-b824-0065631919c8-pruna-logo.jpg",
14        "https://segmind-resources.s3.amazonaws.com/input/07ccec90-0c1b-4016-b15c-c09c140218c8-segmind-logo.png"
15    ],
16    "aspect_ratio": "match_input_image",
17    "seed": 42,
18    "disable_safety_checker": false
19}
20
21response = requests.post(url, headers=headers, json=data)
22
23if response.status_code == 200:
24    result = response.json()
25    print(json.dumps(result, indent=2))
26else:
27    print(f"Error: {response.status_code}")
28    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/p-image-edit

Parameters

image_urlsrequired
string[]

Provide a list of image URLs for editing. Ensure URLs are accessible online.

promptrequired
string

Describes the desired image edit or composition. Use vivid adjectives for creativity.

aspect_ratiooptional
string

Determines the output image's shape. Use '1:1' for square or '16:9' for widescreen.

Default: "match_input_image"
Allowed values :
"match_input_image""1:1""16:9""9:16""4:3""3:4""3:2""2:3"
disable_safety_checkeroptional
boolean

Toggles safety features for image generation. Disable if you're working with creative edits.

Default: false
seedoptional
integer

Sets seed for consistent output. Use -1 for a unique, random generation each time.

Default: 42Range: -1 - 999999999999999

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out