POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 const axios = require('axios'); const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/bria-enhance-image"; const data = { "image": "https://segmind-resources.s3.amazonaws.com/input/a53c2a29-1e2c-473b-ad5a-2dfdb1184dfa-e8a1673f-7919-463e-b6fb-e12ad39140f1.jpeg", "visual_input_content_moderation": true, "visual_output_content_moderation": true, "seed": 123456, "steps_num": 30, "resolution": "4MP", "preserve_alpha": true }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


imagestr *

Provides the URL of the source image. Use a valid URI for best results.


visual_input_content_moderationboolean ( default: true )

Applies moderation to input. Enable for sensitive content.


visual_output_content_moderationboolean ( default: true )

Moderates output content for safety. Enable to filter results.


seedint ( default: 123456 )

Sets result predictability. Use the same seed for repeatable results.

min : 1,

max : 999999


steps_numint ( default: 30 )

Defines the number of refinement iterations. Higher numbers provide more detail.

min : 10,

max : 50


resolutionenum:str ( default: 4MP )

Selects output image resolution. Choose based on display or quality needs.

Allowed values:


preserve_alphaboolean ( default: true )

Retains alpha channel from input to output. Use true for transparency.

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Bria AI – Generative Image Editing Model

What is Bria AI?

Bria AI is a next-generation generative image editing model engineered for precise, high-quality enhancements and manipulations. Powered by advanced diffusion and generative fill algorithms, Bria AI excels in background removal, replacement, blurring, object erasing, image expansion, upscaling, and smart cropping. Unlike traditional upscalers, it enriches textures and preserves original detail—including alpha channels—while safeguarding content with built‐in moderation. Asynchronous processing and status tracking streamline integration into creative pipelines, and full source code is available on Hugging Face for developers seeking customization.

Key Features

  • Background Removal & Replacement: Cleanly isolate subjects or swap backgrounds without artifacts.
  • Generative Fill & Object Erasing: Seamlessly remove unwanted elements and fill in gaps with context-aware detailing.
  • Resolution Increase: Upscale images up to 4MP while refining textures and preserving sharpness.
  • Image Expansion & Cropping: Extend canvas intelligently or crop to focus on critical regions.
  • Alpha Channel Preservation: Retain transparency data for compositing and layered workflows.
  • Content Moderation: Optional input/output safety filters to ensure compliant visual results.

Best Use Cases

  • E-Commerce: Automate background removal and product shot enhancement for catalogs and ads.
  • Digital Design: Rapidly generate mockups, expand artboards, and refine UI assets.
  • Photography: Enhance resolution, remove distractions, and retouch portraits without visible seams.
  • Marketing & Social Media: Produce polished, branded images with creative fill and background swaps.

Prompt Tips and Output Quality

  1. Provide a high-quality source image (URI string) for best results.
  2. Adjust seed (1–999,999) when you need repeatable, deterministic outputs—use the same seed for identical edits.
  3. Increase steps_num (10–50) to enhance detail; ~30 steps strikes a balance between speed and quality.
  4. Choose resolution (1MP, 2MP, or 4MP) based on final display needs. For print or large format, select 4MP.
  5. Enable preserve_alpha to maintain transparency layers for seamless compositing.
  6. Turn on visual_input_content_moderation and visual_output_content_moderation to filter sensitive imagery automatically.

FAQs

Q: How do I remove a background with Bria AI?
A: Supply the image URI and set your prompt to “remove background.” The model’s generative fill will cleanly separate subject from background.

Q: Can Bria AI upscale without losing quality?
A: Yes. Choose a higher resolution (up to 4MP) and increase steps for finer texture enrichment and edge clarity.

Q: Does Bria AI preserve transparency?
A: Enable the preserve_alpha parameter to carry forward any alpha channel from the source image.

Q: Where can I customize the model?
A: The full model code and checkpoints are available on Hugging Face under the Segmind/Bria-AI repository for advanced tuning.