{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["tabs","tab"]},"type":"markdown"},"seo":{"title":"Self-host RMBG 3.0","description":"Generate and edit images and video with Bria's Fibo models through a REST API, Python and TypeScript SDKs, MCP server and agent skills. Licensed training data, controllable output, provenance on every result.","siteUrl":"https://docs.bria.ai","image":"/assets/bria-social-card.5f3c59395e7b5efa776984c64ef9cb0956b1d651f45b7ebf9502122a66054f35.db81178d.png","llmstxt":{"hide":false,"title":"Bria API documentation","description":"Bria's developer platform: controllable, commercially safe visual generative AI (images and video) as a REST API, Python and TypeScript SDKs, MCP server and agent skills.","details":{"path":"_llmstxt-details.md"},"sections":[{"title":"Getting started","description":"First call, authentication, async jobs and webhooks, rate limits, inputs.","includeFiles":["index.md","whats-new/fibo-2.md","whats-new/rmbg-3.md","getting-started/quickstart.md","getting-started/authentication.md","getting-started/async-requests.md","status.yaml","getting-started/rate-limits-and-errors.md","getting-started/working-with-images.md","getting-started/asset-retention.md"]},{"title":"Integrate","description":"Python SDK, TypeScript SDK, MCP server, agent skills, and machine-readable docs for agents.","includeFiles":["integration-methods/python-sdk.md","integration-methods/typescript-sdk.md","MCP-authentication.md","integration-methods/bria-skill.md","integration-methods/for-ai-agents.md"]},{"title":"Concepts","description":"Platform map, VGL and the Fibo models, safety, best practices.","includeFiles":["products-overview.md","VGL.md","safety.md","best-practices-overview.md","image-generation-best-practices.md","image-editing-best-practices.md","product-shots-best-practices.md"]},{"title":"Image Generation","description":"Generate images from text, reference images or structured (VGL) prompts with Fibo 2.","includeFiles":["image-generation-overview.md","image-generation.yaml"]},{"title":"Image Editing","description":"Instruction-based editing plus specialized endpoints for backgrounds, erasing, fill, expansion, upscaling and style.","includeFiles":["image-editing-overview.md","image-editing.yaml"]},{"title":"Product Shot Editing","description":"Cutouts, packshots, shadows, lifestyle scenes, product integration, holding, virtual try-on, automotive.","includeFiles":["product-shot-overview.md","product-shot-editing.yaml"]},{"title":"Video Editing","description":"Background removal (REST or real-time streaming), erasing, upscaling and masks for video; local video upload.","includeFiles":["video-editing-overview.md","local-video-upload-service.md","streaming-rmbg.md","video-editing.yaml"]},{"title":"Ads","description":"Finished ads as input. Ad Delayer turns one into editable layers (the guide holds the layer document contract); Ad Resize produces it at other sizes with the layout redone.","includeFiles":["ads-overview.md","ads.yaml"]},{"title":"Trust and provenance","description":"Public verification of Bria provenance, and attribution of outputs to licensed training data.","includeFiles":["trust-and-provenance-overview.md","visual-verification-overview.md","visual-verification.yaml","enterprise/attribution.md","bria-attribution-service.yaml"]},{"title":"Self-hosting","description":"Run licensed Bria models on your own GPUs. Buy a per-model license, install with Bria Studio or the Python library, run, and handle license errors.","includeFiles":["self-hosted/quickstart.md","self-hosted/overview.md","self-hosted/best-practices.md","self-hosted/fibo-2.md","self-hosted/rmbg-2.md","self-hosted/rmbg-3.md"]},{"title":"Enterprise","description":"Run Bria in your own cloud or on-premises.","includeFiles":["enterprise/deployment-options.md"]}],"excludeFiles":["_llmstxt-details.md","README.md"]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"self-host-rmbg-30","__idx":0},"children":["Self-host RMBG 3.0"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/whats-new/rmbg-3"},"children":["RMBG 3.0"]},", Bria's newest background removal model, on your own hardware with a self-hosted license. This guide installs the model, downloads its weights from Bria, and removes the background from a first image."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"rmbg-30-or-rmbg-20","__idx":1},"children":["RMBG 3.0 or RMBG 2.0?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both remove backgrounds, and each is licensed on its own: an RMBG 2.0 license does not cover RMBG 3.0."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"RMBG 3.0"},"children":["RMBG 3.0"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"RMBG 2.0"},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/rmbg-2"},"children":["RMBG 2.0"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Best for"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Quality first: cleaner edges on hair, fur, transparent objects and fine detail"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["High volume and low latency"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Speed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["About 6 seconds an image on an NVIDIA L40S"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Much faster"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["GPU memory"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["32 GB or more"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fits on small GPUs"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Python"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["3.11 or 3.12"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["3.10 or newer"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use RMBG 2.0 for faster inference on smaller, cheaper GPU machines. Use RMBG 3.0 when quality matters most."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":2},"children":["Requirements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An active ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["RMBG 3.0"]}," self-hosted license (",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/licensing/pricing?model=rmbg-3.0"},"children":["pricing"]},")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["One of your organization's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/getting-started/authentication"},"children":["API keys"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A machine with an NVIDIA GPU with 32 GB of memory or more, Python 3.11 or 3.12, and about 26 GB of disk for the weights"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["For the manual install: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["jq"]},", and network access to the Bria Engine, AWS CodeArtifact and Bria's weights CDN (no Hugging Face account)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-get-a-license","__idx":3},"children":["1. Get a license"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Buy an RMBG 3.0 license on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/licensing/pricing?model=rmbg-3.0"},"children":["pricing page"]},". You manage it, and see the installation steps, on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/organization-management/licensing"},"children":["Licenses tab"]}," in the Console."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-install","__idx":4},"children":["2. Install"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bria Studio (recommended)","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/quickstart"},"children":["Bria Studio"]}," installs the package, downloads the weights, and runs a test for you:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npx @bria-ai/studio\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Pick ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["RMBG 3.0"]}," when Studio lists your licensed models. It installs ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rmbg-3"]}," into a Python 3.12 virtual environment at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria/venvs/rmbg-3.0"]},", downloads the weights, and removes a sample background to confirm the setup."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["RMBG 3.0 needs Studio 0.5.0 or newer. If Studio does not list it, run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["npx @bria-ai/studio@latest"]},"."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Manual (Docker, CI)","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In a new virtual environment, install PyTorch for CUDA 12.8 first, then exchange your API key for a short-lived registry credential and install the package:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export BRIA_API_TOKEN=\"<your-bria-api-token>\"\n\n# Python 3.12, or 3.11 where the machine has no 3.12\nPYTHON=$(command -v python3.12 || command -v python3.11 || echo python3.12)\n\"$PYTHON\" -m venv .venv && . .venv/bin/activate\n\n# PyTorch for CUDA 12.8 (NVIDIA drivers before 580; PyPI's default build needs CUDA 13)\npip install --require-virtualenv \"torch==2.11.0+cu128\" \"torchvision==0.26.0+cu128\" \\\n  --index-url https://download.pytorch.org/whl/cu128 --extra-index-url https://pypi.org/simple\n\nCA=$(curl -s \"https://engine.prod.bria-api.com/v2/outpost/access/code_artifact?repository=bria-rmbg-3\" \\\n      -H \"api_token: $BRIA_API_TOKEN\" | jq -r '.result.authorization_token')\n\npip install --require-virtualenv --upgrade \"rmbg-3\" \\\n  --extra-index-url \"https://aws:$CA@bria-300465780738.d.codeartifact.us-east-1.amazonaws.com/pypi/bria-rmbg-3/simple/\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both installs carry pip's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--require-virtualenv"]},": if the virtual environment could not be created, they stop instead of installing into the machine's own Python. Drop the flag to install without a virtual environment, as the Dockerfile in the RMBG 2.0 guide does."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Without the PyTorch line, pip installs PyTorch's default build, which needs an NVIDIA driver 580 or newer. On an older driver ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," fails with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["torch.cuda.is_available() is False"]},". If your driver is 580 or newer, you can skip that line."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Weights download on first load (",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#3-run-it"},"children":["step 3"]},"). In Docker, start from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["python:3.12-slim"]},", install the same way (see the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/rmbg-2#2-install"},"children":["RMBG 2.0 Dockerfile"]},", with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bria-rmbg-3"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["rmbg-3"]},"), and mount ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria"]}," to cache the weights."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-run-it","__idx":5},"children":["3. Run it"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run from the environment the model is installed in. If you used Studio, activate the venv it created:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"source ~/.bria/venvs/rmbg-3.0/bin/activate\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Then load the model with your API key and remove a background. On first load ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," checks your license and downloads the weights to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria/models"]},", which takes a few minutes; later runs reuse them."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import os\nfrom rmbg_3 import RMBG3, RMBG3Config, RMBG3Input\n\n# Reads BRIA_API_TOKEN; checks the license and downloads ~26 GB of weights on first load.\npipe = RMBG3(config=RMBG3Config(api_token=os.environ[\"BRIA_API_TOKEN\"]))\npipe.setup()\n\nresult = pipe.execute([RMBG3Input(image=\"https://bria-test-images.s3.us-east-1.amazonaws.com/strawberry.jpg\")])[0]\nresult.image.save(\"cutout.png\")  # RGBA cutout with a transparent background\n\npipe.cleanup()  # free the GPU when you are done\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Pass a URL or local path to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RMBG3Input.image"]},". Set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["return_mask=True"]}," to also get the grayscale matte as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["result.mask"]}," (white is the subject). The request and the result are the same as RMBG 2.0's, so code written for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RemoveBG"]}," moves over by changing the class names."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Inputs and outputs stay on your machine — only a small ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/enterprise/attribution"},"children":["attribution"]}," vector is sent to Bria."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"errors-and-troubleshooting","__idx":6},"children":["Errors and troubleshooting"]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["No license for RMBG 3.0"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your account holds no active RMBG 3.0 license, so the install stops before anything downloads. An RMBG 2.0 license does not cover RMBG 3.0. Buy or renew it on the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://platform.bria.ai/organization-management/licensing"},"children":["Licenses tab"]},"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["LicenseError"]}," when the model starts"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The license was cancelled or ended. Open the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://platform.bria.ai/organization-management/licensing"},"children":["Licenses tab"]}," — the error links straight to it. A card retry (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["past_due"]},") stays active."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The model won't load and asks for an API token"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BRIA_API_TOKEN"]}," is set. Set it, or pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RMBG3Config(api_token=\"...\")"]},"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["torch.cuda.is_available() is False"]}," during ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The installed PyTorch doesn't match your NVIDIA driver. pip's default PyTorch needs driver 580 or newer. Install the CUDA 12.8 build first, as in ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"#2-install"},"children":["step 2"]},"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CUDA out of memory"]}," during ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," or the first image"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["RMBG 3.0 needs a GPU with 32 GB of memory or more. On a smaller GPU, use ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/self-hosted/rmbg-2"},"children":["RMBG 2.0"]},"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WeightsError"]}," during download"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The download was interrupted. Run again — it resumes where it stopped."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage-and-billing","__idx":7},"children":["Usage and billing"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Self-hosted runs are counted against your RMBG 3.0 license and shown in ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Usage & billing"]}," in the Console, tagged as self-hosted. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/overview#licensing-and-usage"},"children":["Self-hosted models"]}," for how licensing and billing work across models."]}]},"headings":[{"value":"Self-host RMBG 3.0","id":"self-host-rmbg-30","depth":1},{"value":"RMBG 3.0 or RMBG 2.0?","id":"rmbg-30-or-rmbg-20","depth":2},{"value":"Requirements","id":"requirements","depth":2},{"value":"1. Get a license","id":"1-get-a-license","depth":2},{"value":"2. Install","id":"2-install","depth":2},{"value":"3. Run it","id":"3-run-it","depth":2},{"value":"Errors and troubleshooting","id":"errors-and-troubleshooting","depth":2},{"value":"Usage and billing","id":"usage-and-billing","depth":2}],"frontmatter":{"title":"Self-host RMBG 3.0","description":"Run Bria's RMBG 3.0 background removal on your own GPUs with a self-hosted license. Install with Bria Studio or manually (Docker, CI), run a first image, and handle license errors.","seo":{"title":"Self-host RMBG 3.0"}},"lastModified":"2026-11-16T15:40:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/self-hosted/rmbg-3","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}