Bria Generative Fill Serverless API

Bria AI enables precise generative image editing for seamless creative enhancements and transformations.

~18.44s
$0.04 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/bria-gen-fill"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "mask": "sample text",
12    "mask_type": "manual",
13    "prompt": "Place a wooden bench on the grass",
14    "prompt_content_moderation": true,
15    "negative_prompt": "No skyscrapers or ground vehicles",
16    "preserve_alpha": true,
17    "seed": 42,
18    "visual_input_content_moderation": false,
19    "visual_output_content_moderation": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25    result = response.json()
26    print(json.dumps(result, indent=2))
27else:
28    print(f"Error: {response.status_code}")
29    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/bria-gen-fill

Parameters

imagerequired
string | string

Provide the source image via URL or Base64. Use different formats to test input handling.

Default: "https://segmind-resources.s3.amazonaws.com/input/84380902-5a75-4ae6-b499-4e8c08777792-6e2fc83c-b77b-4f89-869e-76fdbf746c81.jpeg"
Exactly one of:
Option 1optional
string (uri)
Option 2optional
string
maskrequired
string (uri)

Define the generation area with a mask. Test different regions by altering mask shape.

Default: null
promptrequired
string

Enter a prompt to guide object generation. Try creative or detailed prompts for varied outputs.

Default: "Place a wooden bench on the grass"
mask_typeoptional
string

Specify if the mask is manual or automatic. Use 'manual' for custom, 'automatic' for algorithm-generated.

Default: "manual"
Allowed values :
"manual""automatic"
negative_promptoptional
string

Exclude elements from generation using this field. Use for undesired features or details.

Default: "No skyscrapers or ground vehicles"
preserve_alphaoptional
boolean

Decide if the alpha channel is retained. Keep true for transparency needs.

Default: true
prompt_content_moderationoptional
boolean

Moderate the prompt for safety. Enable for sensitive environments.

Default: true
seedoptional
integer

Select a seed for reproducibility. Use fixed seed for consistent results.

Default: 42
visual_input_content_moderationoptional
boolean

Enable to check input images for inappropriate content. Useful for platform compliance.

Default: false
visual_output_content_moderationoptional
boolean

Check output images for content issues. Activate for moderated environments.

Default: false

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