{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"Self-host the Attribution Agent","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/fibo-2-turbo.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-the-attribution-agent","__idx":0},"children":["Self-host the Attribution Agent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/enterprise/attribution"},"children":["Attribution Agent"]}," turns each output of a Bria model into a small, irreversible vector and sends only that vector to Bria. Your images and videos never leave your machine. Attribution is a condition of the self-hosted license, and it is how your usage is counted."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Already built into Bria's model packages"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/fibo-2"},"children":["Fibo 2"]},", ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/rmbg-2"},"children":["RMBG 2.0"]}," and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/rmbg-3"},"children":["RMBG 3.0"]}," run the agent for you: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," loads it and every ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["execute"]}," attributes its output in the background. Don't install it next to them, or every output is attributed twice. Use this guide only when you run Bria weights outside Bria's packages, for example in your own inference code or on a third-party platform."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To tag those outputs with the application or end customer that produced them, pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribution_agent=\"my-app\""]}," in the model's config, for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RemoveBGConfig(api_token=..., attribution_agent=\"my-app\")"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"requirements","__idx":1},"children":["Requirements"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An active self-hosted license for any Bria model (",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/licensing/pricing"},"children":["pricing"]},"). The agent comes with every license."]},{"$$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":["Python 3.10 or newer. A CPU is enough; an NVIDIA GPU makes it faster."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Network access to the Bria Engine and Bria's weights CDN. The manual install also needs ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["jq"]}," and network access to AWS CodeArtifact."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Disk space for the agent's weights: about 600 MB, or about 4 GB with video (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#weights"},"children":["Weights"]},")"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-get-a-license","__idx":2},"children":["1. Get a license"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Any self-hosted model license includes the agent. Buy one on the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://platform.bria.ai/licensing/pricing"},"children":["pricing page"]},", and manage it 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":3},"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 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":["Attribution agent"]}," (\"included with any license\"). Studio installs ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bria_attribution[video]"]}," into a virtual environment at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria/venvs/attribution"]},"."]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Manual (Docker, CI)","disable":false},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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\npython3 -m venv .venv && . .venv/bin/activate\n\nCA=$(curl -s \"https://engine.prod.bria-api.com/v2/outpost/access/code_artifact?repository=attribution\" \\\n      -H \"api_token: $BRIA_API_TOKEN\" | jq -r '.result.authorization_token')\nIDX=\"https://aws:$CA@bria-300465780738.d.codeartifact.us-east-1.amazonaws.com/pypi/attribution/simple/\"\n\npip install --upgrade \"bria_attribution>=0.7.0\" --extra-index-url \"$IDX\"          # images\n# pip install --upgrade \"bria_attribution[video]>=0.7.0\" --extra-index-url \"$IDX\" # images and video\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The credential is short-lived; request a new one each time you install or upgrade."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-run-it","__idx":4},"children":["3. Run it"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run from the environment the agent 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/attribution/bin/activate\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Load the agent once, then call it for every output your model generates:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import os\nfrom PIL import Image\nfrom attribution_agent import AttributionModel, BriaAttributionAgent\n\nagent = BriaAttributionAgent(device=\"cuda\", api_token=os.environ[\"BRIA_API_TOKEN\"])  # or device=\"cpu\"\nagent.setup()  # downloads the image weights from Bria on the first run\n\n# Image: a PIL image\nrequest_id = agent.execute_image(\n    image=Image.open(\"output.png\"),\n    model=AttributionModel.IMAGE_RMBG_1,  # the Bria model that made the output\n    api_token=os.environ[\"BRIA_API_TOKEN\"],\n    agent=\"my-app\",\n)\n\n# Video: a local path or URL. Needs the [video] extra.\nrequest_id = agent.execute_video(\n    video=\"output.mp4\",\n    model=AttributionModel.VIDEO_RMBG_1,\n    api_token=os.environ[\"BRIA_API_TOKEN\"],\n    agent=\"my-app\",\n)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each call returns the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request_id"]}," of the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/bria-attribution-service"},"children":["attribution request"]},". ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["agent"]}," names the application or end customer that produced the output. Calls are synchronous, so make them from a background thread or a queue to keep them off your generation path. A runnable notebook is in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/Bria-AI/BYOC/tree/main/attribution-agent"},"children":["BYOC ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribution-agent"]}," folder"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"weights","__idx":5},"children":["Weights"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The first ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," downloads the agent's weights from Bria with your API key (passed as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api_token"]}," or set in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BRIA_API_TOKEN"]},"), so no Hugging Face account is needed: the image model, and with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["video"]}," extra the video model too. They are saved to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria/models/attribution/"]}," (set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BRIA_HOME"]}," to change ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.bria"]},"), checked against their checksums, and reused on later runs, so later setups take seconds."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use weights of your own, pass the image checkpoint's path as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attribution_ckpt"]},", and set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VATTR_MOTION_MODEL_CKPT"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VATTR_MOTION_MODEL_PATH"]}," for the video model."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"choose-the-model","__idx":6},"children":["Choose the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]}," names the Bria model that produced the output. It decides which license the call is counted against."]},{"$$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":"Bria model"},"children":["Bria model"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"AttributionModel"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AttributionModel"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["RMBG 2.0"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_RMBG_1"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["RMBG 3.0"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_RMBG_3"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fibo 2"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_FIBO_2"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fibo 2 Turbo"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_FIBO_TURBO_2"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fibo Edit"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_FIBO_EDIT_1"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Eraser"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IMAGE_ERASER_1"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Video background removal"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VIDEO_RMBG_1"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["list(AttributionModel)"]}," prints every value your installed version supports."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"errors-and-troubleshooting","__idx":7},"children":["Errors and troubleshooting"]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["The registry credential request answers 403"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your account holds no active self-hosted license, and the agent comes only with one. Buy or renew a license on the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://platform.bria.ai/organization-management/licensing"},"children":["Licenses tab"]},". In Studio, the same case reads \"Attribution agent comes with any self-hosted model license, and this account holds none\"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["setup()"]}," fails downloading from Hugging Face (401 or 403)"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The agent fell back to Hugging Face for its weights: it had no API key, the installed version is older than 0.7.0, or Bria's weights could not be reached (the log reads \"Bria's attribution weights unavailable; using Hugging Face\"). Pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["api_token"]}," or set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BRIA_API_TOKEN"]},", upgrade to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bria_attribution",">","=0.7.0"]},", and allow network access to the Bria Engine and Bria's weights CDN."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Video attribution requires optional installation bria_attribution[video]"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The package was installed without the video extra. Reinstall ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bria_attribution[video]"]},"."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Agent isn't ready, please run .setup()"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["agent.setup()"]}," once before the first ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["execute_image"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["execute_video"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage-and-billing","__idx":8},"children":["Usage and billing"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Each call is counted as self-hosted usage of the model named in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["model"]},", against that model's license, and shown in ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Usage & billing"]}," in the Console. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/self-hosted/overview#licensing-and-usage"},"children":["Self-hosted models"]}," for how licensing and billing work."]}]},"headings":[{"value":"Self-host the Attribution Agent","id":"self-host-the-attribution-agent","depth":1},{"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":"Weights","id":"weights","depth":3},{"value":"Choose the model","id":"choose-the-model","depth":3},{"value":"Errors and troubleshooting","id":"errors-and-troubleshooting","depth":2},{"value":"Usage and billing","id":"usage-and-billing","depth":2}],"frontmatter":{"title":"Self-host the Attribution Agent","description":"Run Bria's Attribution Agent next to Bria weights you run outside Bria's packages. Install with Bria Studio or manually and attribute image and video outputs.","seo":{"title":"Self-host the Attribution Agent"}},"lastModified":"2026-11-23T11:54:15.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/self-hosted/attribution","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}