Clawra Selfie
Generate AI images using either MiniMax or xAI's Grok Imagine model and distribute them across messaging platforms (WhatsApp, Telegram, Discord, Slack, etc.) via OpenClaw.
💡 Tip: The enhanced script automatically detects which API key is available (MiniMax takes priority by default).
Reference Image
The skill uses a fixed reference image hosted on jsDelivr CDN:
CODEBLOCK0
When to Use
- - User says "send a pic", "send me a pic", "send a photo", "send a selfie"
- User says "send a pic of you...", "send a selfie of you..."
- User asks "what are you doing?", "how are you doing?", "where are you?"
- User describes a context: "send a pic wearing...", "send a pic at..."
- User wants Clawra to appear in a specific outfit, location, or situation
Quick Reference
Required Environment Variables
Option 1: fal.ai (Grok Imagine)
CODEBLOCK1
Option 2: MiniMax (Recommended - usually faster/more reliable)
CODEBLOCK2
Common:
CODEBLOCK3
⚠️ Security Note: Never hardcode API keys in scripts. Use environment variables.
Workflow
- 1. Get user prompt for how to edit the image
- Edit image via fal.ai Grok Imagine Edit API with fixed reference
- Extract image URL from response
- Send to OpenClaw with target channel(s)
Step-by-Step Instructions
Step 1: Collect User Input
Ask the user for:
- - User context: What should the person in the image be doing/wearing/where?
- Mode (optional):
mirror or direct selfie style - Target channel(s): Where should it be sent? (e.g.,
#general, @username, channel ID) - Platform (optional): Which platform? (discord, telegram, whatsapp, slack)
Prompt Modes
Mode 1: Mirror Selfie (default)
Best for: outfit showcases, full-body shots, fashion content
CODEBLOCK4
Example: "wearing a santa hat" →
CODEBLOCK5
Mode 2: Direct Selfie
Best for: close-up portraits, location shots, emotional expressions
CODEBLOCK6
Example: "a cozy cafe with warm lighting" →
CODEBLOCK7
Mode Selection Logic
| Keywords in Request | Auto-Select Mode |
|---|
| outfit, wearing, clothes, dress, suit, fashion | INLINECODE4 |
| cafe, restaurant, beach, park, city, location |
direct |
| close-up, portrait, face, eyes, smile |
direct |
| full-body, mirror, reflection |
mirror |
Step 2: Generate Image
You have two options for image generation:
Option A: MiniMax API (Recommended)
CODEBLOCK8
MiniMax API Details:
- - Endpoint: INLINECODE8
- Model: INLINECODE9
- Response: Base64 encoded image
- Aspect ratios supported: 1:1, 3:4, 4:3, 9:16, 16:9, 21:9
Option B: fal.ai (Grok Imagine)
CODEBLOCK9
Response Format:
CODEBLOCK10
Step 3: Send Image via OpenClaw
Use the OpenClaw messaging API to send the edited image:
CODEBLOCK11
Alternative: Direct API call
CODEBLOCK12
Complete Script Example
CODEBLOCK13
Node.js/TypeScript Implementation
CODEBLOCK14
Supported Platforms
OpenClaw supports sending to:
| Platform | Channel Format | Example |
|---|
| Discord | INLINECODE10 or channel ID | INLINECODE11 , INLINECODE12 |
| Telegram |
@username or chat ID |
@mychannel,
-100123456 |
| WhatsApp | Phone number (JID format) |
1234567890@s.whatsapp.net |
| Slack |
#channel-name |
#random |
| Signal | Phone number |
+1234567890 |
| MS Teams | Channel reference | (varies) |
Grok Imagine Edit Parameters
| Parameter | Type | Default | Description |
|---|
| INLINECODE20 | string | required | URL of image to edit (fixed in this skill) |
| INLINECODE21 |
string | required | Edit instruction |
|
num_images | 1-4 | 1 | Number of images to generate |
|
output_format | enum | "jpeg" | jpeg, png, webp |
Setup Requirements
1. Install fal.ai client (for Node.js usage)
CODEBLOCK15
2. Install OpenClaw CLI
CODEBLOCK16
3. Configure OpenClaw Gateway
CODEBLOCK17
4. Start OpenClaw Gateway
CODEBLOCK18
Error Handling
- - FAL_KEY missing: Ensure the API key is set in environment
- Image edit failed: Check prompt content and API quota
- OpenClaw send failed: Verify gateway is running and channel exists
- Rate limits: fal.ai has rate limits; implement retry logic if needed
Tips
- 1. Mirror mode context examples (outfit focus):
- "wearing a santa hat"
- "in a business suit"
- "wearing a summer dress"
- "in streetwear fashion"
- 2. Direct mode context examples (location/portrait focus):
- "a cozy cafe with warm lighting"
- "a sunny beach at sunset"
- "a busy city street at night"
- "a peaceful park in autumn"
- 3. Mode selection: Let auto-detect work, or explicitly specify for control
- Batch sending: Edit once, send to multiple channels
- Scheduling: Combine with OpenClaw scheduler for automated posts
Clawra Selfie
使用MiniMax或xAI的Grok Imagine模型生成AI图像,并通过OpenClaw将其分发到消息平台(WhatsApp、Telegram、Discord、Slack等)。
💡 提示:增强脚本会自动检测可用的API密钥(默认优先使用MiniMax)。
参考图像
该技能使用托管在jsDelivr CDN上的固定参考图像:
https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png
使用时机
- - 用户说发张照片、给我发张照片、发张图片、发张自拍
- 用户说发一张你的照片...、发一张你的自拍...
- 用户问你在做什么?、你怎么样?、你在哪里?
- 用户描述场景:发一张穿着...的照片、发一张在...的照片
- 用户希望Clawra以特定的服装、地点或情境出现
快速参考
必需的环境变量
选项1:fal.ai(Grok Imagine)
bash
FALKEY=yourfalapikey # 从 https://fal.ai/dashboard/keys 获取
选项2:MiniMax(推荐 - 通常更快/更可靠)
bash
MINIMAXAPIKEY=yourminimaxapi_key # 从 https://platform.minimaxi.com 获取
通用:
bash
OPENCLAWGATEWAYTOKEN=your_token # 来源:openclaw doctor --generate-gateway-token
⚠️ 安全提示:切勿在脚本中硬编码API密钥。请使用环境变量。
工作流程
- 1. 获取用户提示,了解如何编辑图像
- 通过fal.ai Grok Imagine Edit API编辑图像,使用固定参考图像
- 从响应中提取图像URL
- 发送到OpenClaw,指定目标频道
分步说明
第1步:收集用户输入
询问用户:
- - 用户场景:图像中的人物应该做什么/穿什么/在哪里?
- 模式(可选):mirror(镜像)或direct(直接)自拍风格
- 目标频道:发送到哪里?(例如:#general、@username、频道ID)
- 平台(可选):哪个平台?(discord、telegram、whatsapp、slack)
提示模式
模式1:镜像自拍(默认)
最适合:服装展示、全身照、时尚内容
make a pic of this person, but [users context]. the person is taking a mirror selfie
示例:wearing a santa hat →
make a pic of this person, but wearing a santa hat. the person is taking a mirror selfie
模式2:直接自拍
最适合:近景肖像、地点拍摄、情感表达
a close-up selfie taken by herself at [users context], direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arms length, face fully visible
示例:a cozy cafe with warm lighting →
a close-up selfie taken by herself at a cozy cafe with warm lighting, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arms length, face fully visible
模式选择逻辑
| 请求中的关键词 | 自动选择模式 |
|---|
| outfit, wearing, clothes, dress, suit, fashion | mirror |
| cafe, restaurant, beach, park, city, location |
direct |
| close-up, portrait, face, eyes, smile | direct |
| full-body, mirror, reflection | mirror |
第2步:生成图像
你有两个图像生成选项:
选项A:MiniMax API(推荐)
bash
设置API密钥
export MINIMAX
APIKEY=your
minimaxapi_key
调用增强脚本
/home/honestqiao/.openclaw/workspace/skills/clawra-selfie/scripts/clawra-selfie-enhanced.sh \
A girl wearing a red dress, smiling, at a beach sunset \
telegram \
Beach vibes! 🌊 \
minimax
MiniMax API详情:
- - 端点:https://api.minimaxi.com/v1/image_generation
- 模型:image-01
- 响应:Base64编码图像
- 支持的宽高比:1:1、3:4、4:3、9:16、16:9、21:9
选项B:fal.ai(Grok Imagine)
bash
REFERENCE_IMAGE=https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png
模式1:镜像自拍
PROMPT=make a pic of this person, but
. the person is taking a mirror selfie
模式2:直接自拍
PROMPT=a close-up selfie taken by herself at , direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arms length, face fully visible
使用jq构建JSON负载(正确处理转义)
JSON_PAYLOAD=$(jq -n \
--arg imageurl $REFERENCEIMAGE \
--arg prompt $PROMPT \
{imageurl: $imageurl, prompt: $prompt, numimages: 1, outputformat: jpeg})
curl -X POST https://fal.run/xai/grok-imagine-image/edit \
-H Authorization: Key $FAL_KEY \
-H Content-Type: application/json \
-d $JSON_PAYLOAD
响应格式:
json
{
images: [
{
url: https://v3b.fal.media/files/...,
content_type: image/jpeg,
width: 1024,
height: 1024
}
],
revised_prompt: Enhanced prompt text...
}
第3步:通过OpenClaw发送图像
使用OpenClaw消息API发送编辑后的图像:
bash
openclaw message send \
--action send \
--channel \
--message \
--media
替代方案:直接API调用
bash
curl -X POST http://localhost:18789/message \
-H Authorization: Bearer $OPENCLAWGATEWAYTOKEN \
-H Content-Type: application/json \
-d {
action: send,
channel: ,
message: ,
media:
}
完整脚本示例
bash
#!/bin/bash
grok-imagine-edit-send.sh
检查必需的环境变量
if [ -z $FAL_KEY ]; then
echo Error: FAL_KEY environment variable not set
exit 1
fi
固定参考图像
REFERENCE_IMAGE=https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png
USER_CONTEXT=$1
CHANNEL=$2
MODE=${3:-auto} # mirror, direct, 或 auto
CAPTION=${4:-Edited with Grok Imagine}
if [ -z $USER_CONTEXT ] || [ -z $CHANNEL ]; then
echo Usage: $0 [mode] [caption]
echo Modes: mirror, direct, auto (default)
echo Example: $0 wearing a cowboy hat #general mirror
echo Example: $0 a cozy cafe #general direct
exit 1
fi
根据关键词自动检测模式
if [ $MODE == auto ]; then
if echo $USER_CONTEXT | grep -qiE outfit|wearing|clothes|dress|suit|fashion|full-body|mirror; then
MODE=mirror
elif echo $USER_CONTEXT | grep -qiE cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile; then
MODE=direct
else
MODE=mirror # 默认
fi
echo Auto-detected mode: $MODE
fi
根据模式构建提示
if [ $MODE == direct ]; then
EDIT_PROMPT=a close-up selfie taken