SKILL·05D206

bria-ai

Bria-AI
更新于 13 days ago
7 次查看
64
6
64
在 GitHub 上查看
aiapi

关于

The Bria AI skill provides commercial-grade image generation and editing via API, including text-to-image creation, background removal, and natural language photo editing. It handles authentication through OAuth device flow and supports over 20 endpoints for tasks like inpainting, upscaling, and product photography. Use this skill when you need royalty-free, commercially safe image manipulation within your Claude Code workflows.

快速安装

Claude Code

推荐
主要方式
npx skills add Bria-AI/bria-skill -a claude-code
插件命令备选方式
/plugin add https://github.com/Bria-AI/bria-skill
Git 克隆备选方式
git clone https://github.com/Bria-AI/bria-skill.git ~/.claude/skills/bria-ai

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Bria — AI Image Generation, Editing & Background Removal

Commercially safe, royalty-free image generation and editing through 20+ API endpoints.

For additional endpoint details, see the Bria API reference for agents.

When to Use This Skill

  • Generate images — "create an image of...", "make me a banner", "generate a hero image", "I need a product photo"
  • Edit images — "change the background", "make it look like winter", "add a vase to the table", "remove the person"
  • Remove/replace backgrounds — "make the background transparent", "cut out the product", "replace with a studio background"
  • Product photography — "create a lifestyle shot", "place this product in a kitchen scene", "e-commerce packshot"
  • Enhance/transform — "upscale this image", "make it higher resolution", "restyle as oil painting", "change the lighting"

Setup — Authentication

Step 1: Check for existing credentials

if [ -f ~/.bria/credentials ]; then
  BRIA_ACCESS_TOKEN=$(grep '^access_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
  BRIA_API_KEY=$(grep '^api_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
fi
if [ -z "$BRIA_ACCESS_TOKEN" ]; then
  echo "NO_CREDENTIALS"
elif [ -n "$BRIA_API_KEY" ]; then
  echo "READY"
else
  echo "CREDENTIALS_FOUND"
fi
  • READY → skip to making API calls
  • CREDENTIALS_FOUND → skip to Step 3
  • NO_CREDENTIALS → proceed to Step 2

Step 2: Authenticate via device flow

Source the auth helper and run bria_auth:

source ~/.agents/skills/bria-ai/references/code-examples/bria_auth.sh
bria_auth

bria_auth will print SIGN_IN_URL=... and USER_CODE=.... Show the user exactly this — nothing more:

Connect your Bria account: Click here to sign in Your code is {USER_CODE} — it's already filled in.

Then wait; bria_auth polls automatically and prints AUTHENTICATED when done.

If it prints an error, the code expired — run bria_auth again.

Do not proceed with any API call until authentication is confirmed.

Step 3: Verify billing status and resolve API key

source ~/.agents/skills/bria-ai/references/code-examples/bria_auth.sh
bria_introspect

Interpret output:

  • BILLING_ERROR: ... — relay the message to the user verbatim and stop. Do not make any API calls.
  • TOKEN_EXPIRED — tell the user their session expired and restart from Step 2.
  • READYBRIA_API_KEY is now cached in ~/.bria/credentials. Proceed.

Decision Tree — Which Endpoint to Use

Transparent PNG / cutout / remove background?
  → /v2/image/edit/remove_background

Generate image from scratch (text → image)?
  → /v2/image/generate

Edit existing image with text instruction?
  → /v2/image/edit  (use --key images)

Change / replace / blur background?
  → /v2/image/edit/replace_background  (prompt: "blur" or describe new bg)

Place product in a lifestyle scene?
  → /v1/product/lifestyle_shot_by_text

Upscale / increase resolution?
  → /v2/image/edit/increase_resolution  (scale: 2 or 4)

Anything else (restyle, relight, reseason, restore, colorize, sketch, blend, outpaint)?
  → See references/capabilities.md for the full endpoint list

How to Call Any Endpoint

source ~/.agents/skills/bria-ai/references/code-examples/bria_client.sh

# Generate (no image input)
RESULT=$(bria_call /v2/image/generate "" '"prompt": "your description", "aspect_ratio": "16:9", "sync": true')

# Remove background
RESULT=$(bria_call /v2/image/edit/remove_background "/path/to/local/image.png")

# Replace background
RESULT=$(bria_call /v2/image/edit/replace_background "https://example.com/img.jpg" '"prompt": "sunset beach"')

# Edit image (uses images array — pass --key images)
RESULT=$(bria_call /v2/image/edit "/path/to/image.png" --key images '"instruction": "make it look warmer"')

# Upscale
RESULT=$(bria_call /v2/image/edit/increase_resolution "https://example.com/img.jpg" '"scale": 4')

# Lifestyle shot
RESULT=$(bria_call /v1/product/lifestyle_shot_by_text "/path/to/product.png" '"scene_description": "modern kitchen countertop"')

echo "$RESULT"

Calling convention: bria_call <endpoint> <image_or_empty> [--key <json_key>] [extra JSON fields...]

  • Pass a URL, local file path, or "" for endpoints without image input
  • Use --key images when the endpoint expects an images array instead of image
  • Returns the result image URL on success, or prints an error to stderr

Generation options: Aspect ratios 1:1, 16:9, 4:3, 9:16, 3:4. Resolution 1MP (default) or 4MP (more detail, +30s). Pass "sync": true for single images.

Advanced: For precise control over generation, use the vgl skill for structured VGL JSON prompts.


Common Failures

  • bria_call returns empty / no URLBRIA_API_KEY was not set. Run Step 3 (bria_introspect) to cache it.
  • Async job times out → Some endpoints take 60–90s. If bria_call reports a timeout, retry once; the job may have been queued.
  • ERROR 401 → API key is stale. Delete ~/.bria/credentials and re-authenticate from Step 2.
  • BILLING_ERROR → Relay message to user verbatim, do not retry API calls.
  • Local file not found → Pass the absolute path; bria_client.sh handles base64 encoding automatically.
  • /v2/image/edit returns wrong result → Confirm --key images flag is present; this endpoint requires the images array format.

Resources

Related Skills

  • vgl — Structured VGL JSON prompts for precise, deterministic control over FIBO image generation
  • image-utils — Classic image manipulation (resize, crop, composite, watermarks) for post-processing

GitHub 仓库

Bria-AI/bria-skill
路径: bria-ai-openclaw/skills/bria-ai
0
agenagent-skillagent-skillsaiai-agentsclaude-code-skill
FAQ

常见问题

什么是 bria-ai Skill?

bria-ai 是一个 Claude Skill,作者为 Bria-AI。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 bria-ai 相关的任务。

如何安装 bria-ai?

使用本页的安装命令:将 bria-ai 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。

bria-ai 属于哪个分类?

bria-ai 属于元分类。

bria-ai 可以免费使用吗?

可以。bria-ai 已收录在 AIMCP,可免费安装。

相关推荐技能

content-collections

Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。

查看技能
polymarket

这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。

查看技能
creating-opencode-plugins

该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。

查看技能
sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能