Recraft
Use the bundled script to generate, vectorize, upscale, replace background, variate, remove background, and transform images via Recraft API.
Setup
- 1. To access your API key, log in to Recraft and visit the page: https://www.recraft.ai/profile/api
- Generate a token by hitting ‘Generate new key’ button (available only if your API units balance is above zero)
- Set environment variable:
CODEBLOCK0
Commands
Generate Image
CODEBLOCK1
Image to Image
CODEBLOCK2
Replace Background
CODEBLOCK3
Vectorize Image
CODEBLOCK4
Remove Background
CODEBLOCK5
Crisp Upscale
CODEBLOCK6
Creative Upscale
CODEBLOCK7
Variate Image
CODEBLOCK8
Get User Information
CODEBLOCK9
Parameters
- -
--prompt, -p: Text description for image generation or editing, max 1000 characters - INLINECODE2 ,
-i: Input image path (for editing/transformation commands) - INLINECODE4 ,
-f: Output filename - INLINECODE6 ,
-s: Visual style (default: Recraft V3 Raw)
-
Recraft V3 Raw,
Photorealism,
Illustration,
Vector art,
Icon
- -
--size: Output size as aspect ratio (default: 1:1)
-
1:1,
2:1,
1:2,
3:2,
2:3,
4:3,
3:4,
5:4,
4:5,
6:10,
14:10,
10:14,
16:9,
9:16
- -
--strength: Transformation strength for image-to-image (0.0-1.0, default: 0.5), where 0 means almost identical, and 1 means minimal similarity
API Key
- -
RECRAFT_API_TOKEN env var - Or set
skills."recraft".apiKey / skills."recraft".env.RECRAFT_API_TOKEN in INLINECODE32
Notes
- - Use timestamps in filenames:
yyyy-mm-dd-hh-mm-ss-name.png. - The script prints a
MEDIA: line for OpenClaw to auto-attach on supported chat providers. - Do not read the image back; report the saved path only.
- Vector art and Icon styles output SVG format.
- Rate limits: 100 requests per minute; 5 requests per second.
Recraft
使用捆绑脚本通过 Recraft API 生成、矢量化、放大、替换背景、变换、移除背景以及转换图像。
设置
- 1. 要获取您的 API 密钥,请登录 Recraft 并访问页面:https://www.recraft.ai/profile/api
- 点击“生成新密钥”按钮生成令牌(仅当您的 API 单位余额大于零时可用)
- 设置环境变量:
bash
export RECRAFT
APITOKEN=your-api-token
命令
生成图像
bash
uv run {baseDir}/scripts/recraft.py generate --prompt 您的图像描述 --style Recraft V3 Raw --filename output.png --size 16:9
图像到图像
bash
uv run {baseDir}/scripts/recraft.py image-to-image --prompt 您的图像描述 --style Recraft V3 Raw --input /path/to/input.png --filename output.png --strength 0.5
替换背景
bash
uv run {baseDir}/scripts/recraft.py replace-background --prompt 您的背景描述 --style Recraft V3 Raw --input /path/to/input.png --filename output.png
矢量化图像
bash
uv run {baseDir}/scripts/recraft.py vectorize --input /path/to/input.png --filename output.svg
移除背景
bash
uv run {baseDir}/scripts/recraft.py remove-background --input /path/to/input.png --filename output.png
清晰放大
bash
uv run {baseDir}/scripts/recraft.py crisp-upscale --input /path/to/input.png --filename output.png
创意放大
bash
uv run {baseDir}/scripts/recraft.py creative-upscale --input /path/to/input.png --filename output.png
变换图像
bash
uv run {baseDir}/scripts/recraft.py variate --input /path/to/input.png --filename output.png --size 16:9
获取用户信息
bash
uv run {baseDir}/scripts/recraft.py user-info
参数
- - --prompt, -p:图像生成或编辑的文本描述,最多 1000 个字符
- --input, -i:输入图像路径(用于编辑/转换命令)
- --filename, -f:输出文件名
- --style, -s:视觉风格(默认:Recraft V3 Raw)
- Recraft V3 Raw、Photorealism、Illustration、Vector art、Icon
- - --size:输出尺寸(宽高比)(默认:1:1)
- 1:1、2:1、1:2、3:2、2:3、4:3、3:4、5:4、4:5、6:10、14:10、10:14、16:9、9:16
- - --strength:图像到图像的变换强度(0.0-1.0,默认:0.5),0 表示几乎相同,1 表示最小相似度
API 密钥
- - RECRAFTAPITOKEN 环境变量
- 或在 ~/.openclaw/openclaw.json 中设置 skills.recraft.apiKey / skills.recraft.env.RECRAFTAPITOKEN
注意事项
- - 在文件名中使用时间戳:yyyy-mm-dd-hh-mm-ss-name.png。
- 脚本会打印 MEDIA: 行,供 OpenClaw 在支持的聊天提供商上自动附加。
- 不要回读图像;仅报告保存路径。
- 矢量艺术和图标样式输出 SVG 格式。
- 速率限制:每分钟 100 个请求;每秒 5 个请求。