{
  "schemaVersion": "1.0",
  "item": {
    "slug": "clawra-selfie-minimax",
    "name": "Clawra Selfie (MiniMax)",
    "source": "tencent",
    "type": "skill",
    "category": "通讯协作",
    "sourceUrl": "https://clawhub.ai/HonestQiao/clawra-selfie-minimax",
    "canonicalUrl": "https://clawhub.ai/HonestQiao/clawra-selfie-minimax",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/clawra-selfie-minimax",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=clawra-selfie-minimax",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "bin/cli.js",
      "package.json",
      "scripts/clawra-selfie-enhanced.sh",
      "scripts/clawra-selfie.sh"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/clawra-selfie-minimax"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/clawra-selfie-minimax",
    "agentPageUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent",
    "manifestUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Clawra Selfie",
        "body": "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.\n\n💡 Tip: The enhanced script automatically detects which API key is available (MiniMax takes priority by default)."
      },
      {
        "title": "Reference Image",
        "body": "The skill uses a fixed reference image hosted on jsDelivr CDN:\n\nhttps://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png"
      },
      {
        "title": "When to Use",
        "body": "User says \"send a pic\", \"send me a pic\", \"send a photo\", \"send a selfie\"\nUser says \"send a pic of you...\", \"send a selfie of you...\"\nUser asks \"what are you doing?\", \"how are you doing?\", \"where are you?\"\nUser describes a context: \"send a pic wearing...\", \"send a pic at...\"\nUser wants Clawra to appear in a specific outfit, location, or situation"
      },
      {
        "title": "Required Environment Variables",
        "body": "Option 1: fal.ai (Grok Imagine)\n\nFAL_KEY=your_fal_api_key          # Get from https://fal.ai/dashboard/keys\n\nOption 2: MiniMax (Recommended - usually faster/more reliable)\n\nMINIMAX_API_KEY=your_minimax_api_key  # Get from https://platform.minimaxi.com\n\nCommon:\n\nOPENCLAW_GATEWAY_TOKEN=your_token  # From: openclaw doctor --generate-gateway-token\n\n⚠️ Security Note: Never hardcode API keys in scripts. Use environment variables."
      },
      {
        "title": "Workflow",
        "body": "Get user prompt for how to edit the image\nEdit image via fal.ai Grok Imagine Edit API with fixed reference\nExtract image URL from response\nSend to OpenClaw with target channel(s)"
      },
      {
        "title": "Step 1: Collect User Input",
        "body": "Ask the user for:\n\nUser context: What should the person in the image be doing/wearing/where?\nMode (optional): mirror or direct selfie style\nTarget channel(s): Where should it be sent? (e.g., #general, @username, channel ID)\nPlatform (optional): Which platform? (discord, telegram, whatsapp, slack)"
      },
      {
        "title": "Mode 1: Mirror Selfie (default)",
        "body": "Best for: outfit showcases, full-body shots, fashion content\n\nmake a pic of this person, but [user's context]. the person is taking a mirror selfie\n\nExample: \"wearing a santa hat\" →\n\nmake a pic of this person, but wearing a santa hat. the person is taking a mirror selfie"
      },
      {
        "title": "Mode 2: Direct Selfie",
        "body": "Best for: close-up portraits, location shots, emotional expressions\n\na close-up selfie taken by herself at [user's context], direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\n\nExample: \"a cozy cafe with warm lighting\" →\n\na 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 arm's length, face fully visible"
      },
      {
        "title": "Mode Selection Logic",
        "body": "Keywords in RequestAuto-Select Modeoutfit, wearing, clothes, dress, suit, fashionmirrorcafe, restaurant, beach, park, city, locationdirectclose-up, portrait, face, eyes, smiledirectfull-body, mirror, reflectionmirror"
      },
      {
        "title": "Step 2: Generate Image",
        "body": "You have two options for image generation:\n\nOption A: MiniMax API (Recommended)\n\n# Set API key\nexport MINIMAX_API_KEY=\"your_minimax_api_key\"\n\n# Call the enhanced script\n/home/honestqiao/.openclaw/workspace/skills/clawra-selfie/scripts/clawra-selfie-enhanced.sh \\\n  \"A girl wearing a red dress, smiling, at a beach sunset\" \\\n  \"telegram\" \\\n  \"Beach vibes! 🌊\" \\\n  \"minimax\"\n\nMiniMax API Details:\n\nEndpoint: https://api.minimaxi.com/v1/image_generation\nModel: image-01\nResponse: Base64 encoded image\nAspect ratios supported: 1:1, 3:4, 4:3, 9:16, 16:9, 21:9\n\nOption B: fal.ai (Grok Imagine)\n\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\n# Mode 1: Mirror Selfie\nPROMPT=\"make a pic of this person, but <USER_CONTEXT>. the person is taking a mirror selfie\"\n\n# Mode 2: Direct Selfie\nPROMPT=\"a close-up selfie taken by herself at <USER_CONTEXT>, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\n\n# Build JSON payload with jq (handles escaping properly)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\ncurl -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\"\n\nResponse Format:\n\n{\n  \"images\": [\n    {\n      \"url\": \"https://v3b.fal.media/files/...\",\n      \"content_type\": \"image/jpeg\",\n      \"width\": 1024,\n      \"height\": 1024\n    }\n  ],\n  \"revised_prompt\": \"Enhanced prompt text...\"\n}"
      },
      {
        "title": "Step 3: Send Image via OpenClaw",
        "body": "Use the OpenClaw messaging API to send the edited image:\n\nopenclaw message send \\\n  --action send \\\n  --channel \"<TARGET_CHANNEL>\" \\\n  --message \"<CAPTION_TEXT>\" \\\n  --media \"<IMAGE_URL>\"\n\nAlternative: Direct API call\n\ncurl -X POST \"http://localhost:18789/message\" \\\n  -H \"Authorization: Bearer $OPENCLAW_GATEWAY_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"action\": \"send\",\n    \"channel\": \"<TARGET_CHANNEL>\",\n    \"message\": \"<CAPTION_TEXT>\",\n    \"media\": \"<IMAGE_URL>\"\n  }'"
      },
      {
        "title": "Complete Script Example",
        "body": "#!/bin/bash\n# grok-imagine-edit-send.sh\n\n# Check required environment variables\nif [ -z \"$FAL_KEY\" ]; then\n  echo \"Error: FAL_KEY environment variable not set\"\n  exit 1\nfi\n\n# Fixed reference image\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\nUSER_CONTEXT=\"$1\"\nCHANNEL=\"$2\"\nMODE=\"${3:-auto}\"  # mirror, direct, or auto\nCAPTION=\"${4:-Edited with Grok Imagine}\"\n\nif [ -z \"$USER_CONTEXT\" ] || [ -z \"$CHANNEL\" ]; then\n  echo \"Usage: $0 <user_context> <channel> [mode] [caption]\"\n  echo \"Modes: mirror, direct, auto (default)\"\n  echo \"Example: $0 'wearing a cowboy hat' '#general' mirror\"\n  echo \"Example: $0 'a cozy cafe' '#general' direct\"\n  exit 1\nfi\n\n# Auto-detect mode based on keywords\nif [ \"$MODE\" == \"auto\" ]; then\n  if echo \"$USER_CONTEXT\" | grep -qiE \"outfit|wearing|clothes|dress|suit|fashion|full-body|mirror\"; then\n    MODE=\"mirror\"\n  elif echo \"$USER_CONTEXT\" | grep -qiE \"cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile\"; then\n    MODE=\"direct\"\n  else\n    MODE=\"mirror\"  # default\n  fi\n  echo \"Auto-detected mode: $MODE\"\nfi\n\n# Construct the prompt based on mode\nif [ \"$MODE\" == \"direct\" ]; then\n  EDIT_PROMPT=\"a close-up selfie taken by herself at $USER_CONTEXT, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\nelse\n  EDIT_PROMPT=\"make a pic of this person, but $USER_CONTEXT. the person is taking a mirror selfie\"\nfi\n\necho \"Mode: $MODE\"\necho \"Editing reference image with prompt: $EDIT_PROMPT\"\n\n# Edit image (using jq for proper JSON escaping)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$EDIT_PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\nRESPONSE=$(curl -s -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\")\n\n# Extract image URL\nIMAGE_URL=$(echo \"$RESPONSE\" | jq -r '.images[0].url')\n\nif [ \"$IMAGE_URL\" == \"null\" ] || [ -z \"$IMAGE_URL\" ]; then\n  echo \"Error: Failed to edit image\"\n  echo \"Response: $RESPONSE\"\n  exit 1\nfi\n\necho \"Image edited: $IMAGE_URL\"\necho \"Sending to channel: $CHANNEL\"\n\n# Send via OpenClaw\nopenclaw message send \\\n  --action send \\\n  --channel \"$CHANNEL\" \\\n  --message \"$CAPTION\" \\\n  --media \"$IMAGE_URL\"\n\necho \"Done!\""
      },
      {
        "title": "Node.js/TypeScript Implementation",
        "body": "import { fal } from \"@fal-ai/client\";\nimport { exec } from \"child_process\";\nimport { promisify } from \"util\";\n\nconst execAsync = promisify(exec);\n\nconst REFERENCE_IMAGE = \"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\";\n\ninterface GrokImagineResult {\n  images: Array<{\n    url: string;\n    content_type: string;\n    width: number;\n    height: number;\n  }>;\n  revised_prompt?: string;\n}\n\ntype SelfieMode = \"mirror\" | \"direct\" | \"auto\";\n\nfunction detectMode(userContext: string): \"mirror\" | \"direct\" {\n  const mirrorKeywords = /outfit|wearing|clothes|dress|suit|fashion|full-body|mirror/i;\n  const directKeywords = /cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile/i;\n\n  if (directKeywords.test(userContext)) return \"direct\";\n  if (mirrorKeywords.test(userContext)) return \"mirror\";\n  return \"mirror\"; // default\n}\n\nfunction buildPrompt(userContext: string, mode: \"mirror\" | \"direct\"): string {\n  if (mode === \"direct\") {\n    return `a close-up selfie taken by herself at ${userContext}, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible`;\n  }\n  return `make a pic of this person, but ${userContext}. the person is taking a mirror selfie`;\n}\n\nasync function editAndSend(\n  userContext: string,\n  channel: string,\n  mode: SelfieMode = \"auto\",\n  caption?: string\n): Promise<string> {\n  // Configure fal.ai client\n  fal.config({\n    credentials: process.env.FAL_KEY!\n  });\n\n  // Determine mode\n  const actualMode = mode === \"auto\" ? detectMode(userContext) : mode;\n  console.log(`Mode: ${actualMode}`);\n\n  // Construct the prompt\n  const editPrompt = buildPrompt(userContext, actualMode);\n\n  // Edit reference image with Grok Imagine\n  console.log(`Editing image: \"${editPrompt}\"`);\n\n  const result = await fal.subscribe(\"xai/grok-imagine-image/edit\", {\n    input: {\n      image_url: REFERENCE_IMAGE,\n      prompt: editPrompt,\n      num_images: 1,\n      output_format: \"jpeg\"\n    }\n  }) as { data: GrokImagineResult };\n\n  const imageUrl = result.data.images[0].url;\n  console.log(`Edited image URL: ${imageUrl}`);\n\n  // Send via OpenClaw\n  const messageCaption = caption || `Edited with Grok Imagine`;\n\n  await execAsync(\n    `openclaw message send --action send --channel \"${channel}\" --message \"${messageCaption}\" --media \"${imageUrl}\"`\n  );\n\n  console.log(`Sent to ${channel}`);\n  return imageUrl;\n}\n\n// Usage Examples\n\n// Mirror mode (auto-detected from \"wearing\")\neditAndSend(\n  \"wearing a cyberpunk outfit with neon lights\",\n  \"#art-gallery\",\n  \"auto\",\n  \"Check out this AI-edited art!\"\n);\n// → Mode: mirror\n// → Prompt: \"make a pic of this person, but wearing a cyberpunk outfit with neon lights. the person is taking a mirror selfie\"\n\n// Direct mode (auto-detected from \"cafe\")\neditAndSend(\n  \"a cozy cafe with warm lighting\",\n  \"#photography\",\n  \"auto\"\n);\n// → Mode: direct\n// → Prompt: \"a close-up selfie taken by herself at a cozy cafe with warm lighting, direct eye contact...\"\n\n// Explicit mode override\neditAndSend(\"casual street style\", \"#fashion\", \"direct\");"
      },
      {
        "title": "Supported Platforms",
        "body": "OpenClaw supports sending to:\n\nPlatformChannel FormatExampleDiscord#channel-name or channel ID#general, 123456789Telegram@username or chat ID@mychannel, -100123456WhatsAppPhone number (JID format)1234567890@s.whatsapp.netSlack#channel-name#randomSignalPhone number+1234567890MS TeamsChannel reference(varies)"
      },
      {
        "title": "Grok Imagine Edit Parameters",
        "body": "ParameterTypeDefaultDescriptionimage_urlstringrequiredURL of image to edit (fixed in this skill)promptstringrequiredEdit instructionnum_images1-41Number of images to generateoutput_formatenum\"jpeg\"jpeg, png, webp"
      },
      {
        "title": "1. Install fal.ai client (for Node.js usage)",
        "body": "npm install @fal-ai/client"
      },
      {
        "title": "2. Install OpenClaw CLI",
        "body": "npm install -g openclaw"
      },
      {
        "title": "3. Configure OpenClaw Gateway",
        "body": "openclaw config set gateway.mode=local\nopenclaw doctor --generate-gateway-token"
      },
      {
        "title": "4. Start OpenClaw Gateway",
        "body": "openclaw gateway start"
      },
      {
        "title": "Error Handling",
        "body": "FAL_KEY missing: Ensure the API key is set in environment\nImage edit failed: Check prompt content and API quota\nOpenClaw send failed: Verify gateway is running and channel exists\nRate limits: fal.ai has rate limits; implement retry logic if needed"
      },
      {
        "title": "Tips",
        "body": "Mirror mode context examples (outfit focus):\n\n\"wearing a santa hat\"\n\"in a business suit\"\n\"wearing a summer dress\"\n\"in streetwear fashion\"\n\n\n\nDirect mode context examples (location/portrait focus):\n\n\"a cozy cafe with warm lighting\"\n\"a sunny beach at sunset\"\n\"a busy city street at night\"\n\"a peaceful park in autumn\"\n\n\n\nMode selection: Let auto-detect work, or explicitly specify for control\n\n\nBatch sending: Edit once, send to multiple channels\n\n\nScheduling: Combine with OpenClaw scheduler for automated posts"
      }
    ],
    "body": "Clawra Selfie\n\nGenerate AI images using either MiniMax or xAI's Grok Imagine model and distribute them across messaging platforms (WhatsApp, Telegram, Discord, Slack, etc.) via OpenClaw.\n\n💡 Tip: The enhanced script automatically detects which API key is available (MiniMax takes priority by default).\n\nReference Image\n\nThe skill uses a fixed reference image hosted on jsDelivr CDN:\n\nhttps://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\n\nWhen to Use\nUser says \"send a pic\", \"send me a pic\", \"send a photo\", \"send a selfie\"\nUser says \"send a pic of you...\", \"send a selfie of you...\"\nUser asks \"what are you doing?\", \"how are you doing?\", \"where are you?\"\nUser describes a context: \"send a pic wearing...\", \"send a pic at...\"\nUser wants Clawra to appear in a specific outfit, location, or situation\nQuick Reference\nRequired Environment Variables\n\nOption 1: fal.ai (Grok Imagine)\n\nFAL_KEY=your_fal_api_key          # Get from https://fal.ai/dashboard/keys\n\n\nOption 2: MiniMax (Recommended - usually faster/more reliable)\n\nMINIMAX_API_KEY=your_minimax_api_key  # Get from https://platform.minimaxi.com\n\n\nCommon:\n\nOPENCLAW_GATEWAY_TOKEN=your_token  # From: openclaw doctor --generate-gateway-token\n\n\n⚠️ Security Note: Never hardcode API keys in scripts. Use environment variables.\n\nWorkflow\nGet user prompt for how to edit the image\nEdit image via fal.ai Grok Imagine Edit API with fixed reference\nExtract image URL from response\nSend to OpenClaw with target channel(s)\nStep-by-Step Instructions\nStep 1: Collect User Input\n\nAsk the user for:\n\nUser context: What should the person in the image be doing/wearing/where?\nMode (optional): mirror or direct selfie style\nTarget channel(s): Where should it be sent? (e.g., #general, @username, channel ID)\nPlatform (optional): Which platform? (discord, telegram, whatsapp, slack)\nPrompt Modes\nMode 1: Mirror Selfie (default)\n\nBest for: outfit showcases, full-body shots, fashion content\n\nmake a pic of this person, but [user's context]. the person is taking a mirror selfie\n\n\nExample: \"wearing a santa hat\" →\n\nmake a pic of this person, but wearing a santa hat. the person is taking a mirror selfie\n\nMode 2: Direct Selfie\n\nBest for: close-up portraits, location shots, emotional expressions\n\na close-up selfie taken by herself at [user's context], direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\n\n\nExample: \"a cozy cafe with warm lighting\" →\n\na 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 arm's length, face fully visible\n\nMode Selection Logic\nKeywords in Request\tAuto-Select Mode\noutfit, wearing, clothes, dress, suit, fashion\tmirror\ncafe, restaurant, beach, park, city, location\tdirect\nclose-up, portrait, face, eyes, smile\tdirect\nfull-body, mirror, reflection\tmirror\nStep 2: Generate Image\n\nYou have two options for image generation:\n\nOption A: MiniMax API (Recommended)\n# Set API key\nexport MINIMAX_API_KEY=\"your_minimax_api_key\"\n\n# Call the enhanced script\n/home/honestqiao/.openclaw/workspace/skills/clawra-selfie/scripts/clawra-selfie-enhanced.sh \\\n  \"A girl wearing a red dress, smiling, at a beach sunset\" \\\n  \"telegram\" \\\n  \"Beach vibes! 🌊\" \\\n  \"minimax\"\n\n\nMiniMax API Details:\n\nEndpoint: https://api.minimaxi.com/v1/image_generation\nModel: image-01\nResponse: Base64 encoded image\nAspect ratios supported: 1:1, 3:4, 4:3, 9:16, 16:9, 21:9\nOption B: fal.ai (Grok Imagine)\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\n# Mode 1: Mirror Selfie\nPROMPT=\"make a pic of this person, but <USER_CONTEXT>. the person is taking a mirror selfie\"\n\n# Mode 2: Direct Selfie\nPROMPT=\"a close-up selfie taken by herself at <USER_CONTEXT>, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\n\n# Build JSON payload with jq (handles escaping properly)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\ncurl -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\"\n\n\nResponse Format:\n\n{\n  \"images\": [\n    {\n      \"url\": \"https://v3b.fal.media/files/...\",\n      \"content_type\": \"image/jpeg\",\n      \"width\": 1024,\n      \"height\": 1024\n    }\n  ],\n  \"revised_prompt\": \"Enhanced prompt text...\"\n}\n\nStep 3: Send Image via OpenClaw\n\nUse the OpenClaw messaging API to send the edited image:\n\nopenclaw message send \\\n  --action send \\\n  --channel \"<TARGET_CHANNEL>\" \\\n  --message \"<CAPTION_TEXT>\" \\\n  --media \"<IMAGE_URL>\"\n\n\nAlternative: Direct API call\n\ncurl -X POST \"http://localhost:18789/message\" \\\n  -H \"Authorization: Bearer $OPENCLAW_GATEWAY_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"action\": \"send\",\n    \"channel\": \"<TARGET_CHANNEL>\",\n    \"message\": \"<CAPTION_TEXT>\",\n    \"media\": \"<IMAGE_URL>\"\n  }'\n\nComplete Script Example\n#!/bin/bash\n# grok-imagine-edit-send.sh\n\n# Check required environment variables\nif [ -z \"$FAL_KEY\" ]; then\n  echo \"Error: FAL_KEY environment variable not set\"\n  exit 1\nfi\n\n# Fixed reference image\nREFERENCE_IMAGE=\"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\"\n\nUSER_CONTEXT=\"$1\"\nCHANNEL=\"$2\"\nMODE=\"${3:-auto}\"  # mirror, direct, or auto\nCAPTION=\"${4:-Edited with Grok Imagine}\"\n\nif [ -z \"$USER_CONTEXT\" ] || [ -z \"$CHANNEL\" ]; then\n  echo \"Usage: $0 <user_context> <channel> [mode] [caption]\"\n  echo \"Modes: mirror, direct, auto (default)\"\n  echo \"Example: $0 'wearing a cowboy hat' '#general' mirror\"\n  echo \"Example: $0 'a cozy cafe' '#general' direct\"\n  exit 1\nfi\n\n# Auto-detect mode based on keywords\nif [ \"$MODE\" == \"auto\" ]; then\n  if echo \"$USER_CONTEXT\" | grep -qiE \"outfit|wearing|clothes|dress|suit|fashion|full-body|mirror\"; then\n    MODE=\"mirror\"\n  elif echo \"$USER_CONTEXT\" | grep -qiE \"cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile\"; then\n    MODE=\"direct\"\n  else\n    MODE=\"mirror\"  # default\n  fi\n  echo \"Auto-detected mode: $MODE\"\nfi\n\n# Construct the prompt based on mode\nif [ \"$MODE\" == \"direct\" ]; then\n  EDIT_PROMPT=\"a close-up selfie taken by herself at $USER_CONTEXT, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible\"\nelse\n  EDIT_PROMPT=\"make a pic of this person, but $USER_CONTEXT. the person is taking a mirror selfie\"\nfi\n\necho \"Mode: $MODE\"\necho \"Editing reference image with prompt: $EDIT_PROMPT\"\n\n# Edit image (using jq for proper JSON escaping)\nJSON_PAYLOAD=$(jq -n \\\n  --arg image_url \"$REFERENCE_IMAGE\" \\\n  --arg prompt \"$EDIT_PROMPT\" \\\n  '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: \"jpeg\"}')\n\nRESPONSE=$(curl -s -X POST \"https://fal.run/xai/grok-imagine-image/edit\" \\\n  -H \"Authorization: Key $FAL_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"$JSON_PAYLOAD\")\n\n# Extract image URL\nIMAGE_URL=$(echo \"$RESPONSE\" | jq -r '.images[0].url')\n\nif [ \"$IMAGE_URL\" == \"null\" ] || [ -z \"$IMAGE_URL\" ]; then\n  echo \"Error: Failed to edit image\"\n  echo \"Response: $RESPONSE\"\n  exit 1\nfi\n\necho \"Image edited: $IMAGE_URL\"\necho \"Sending to channel: $CHANNEL\"\n\n# Send via OpenClaw\nopenclaw message send \\\n  --action send \\\n  --channel \"$CHANNEL\" \\\n  --message \"$CAPTION\" \\\n  --media \"$IMAGE_URL\"\n\necho \"Done!\"\n\nNode.js/TypeScript Implementation\nimport { fal } from \"@fal-ai/client\";\nimport { exec } from \"child_process\";\nimport { promisify } from \"util\";\n\nconst execAsync = promisify(exec);\n\nconst REFERENCE_IMAGE = \"https://cdn.jsdelivr.net/gh/SumeLabs/clawra@main/assets/clawra.png\";\n\ninterface GrokImagineResult {\n  images: Array<{\n    url: string;\n    content_type: string;\n    width: number;\n    height: number;\n  }>;\n  revised_prompt?: string;\n}\n\ntype SelfieMode = \"mirror\" | \"direct\" | \"auto\";\n\nfunction detectMode(userContext: string): \"mirror\" | \"direct\" {\n  const mirrorKeywords = /outfit|wearing|clothes|dress|suit|fashion|full-body|mirror/i;\n  const directKeywords = /cafe|restaurant|beach|park|city|close-up|portrait|face|eyes|smile/i;\n\n  if (directKeywords.test(userContext)) return \"direct\";\n  if (mirrorKeywords.test(userContext)) return \"mirror\";\n  return \"mirror\"; // default\n}\n\nfunction buildPrompt(userContext: string, mode: \"mirror\" | \"direct\"): string {\n  if (mode === \"direct\") {\n    return `a close-up selfie taken by herself at ${userContext}, direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible`;\n  }\n  return `make a pic of this person, but ${userContext}. the person is taking a mirror selfie`;\n}\n\nasync function editAndSend(\n  userContext: string,\n  channel: string,\n  mode: SelfieMode = \"auto\",\n  caption?: string\n): Promise<string> {\n  // Configure fal.ai client\n  fal.config({\n    credentials: process.env.FAL_KEY!\n  });\n\n  // Determine mode\n  const actualMode = mode === \"auto\" ? detectMode(userContext) : mode;\n  console.log(`Mode: ${actualMode}`);\n\n  // Construct the prompt\n  const editPrompt = buildPrompt(userContext, actualMode);\n\n  // Edit reference image with Grok Imagine\n  console.log(`Editing image: \"${editPrompt}\"`);\n\n  const result = await fal.subscribe(\"xai/grok-imagine-image/edit\", {\n    input: {\n      image_url: REFERENCE_IMAGE,\n      prompt: editPrompt,\n      num_images: 1,\n      output_format: \"jpeg\"\n    }\n  }) as { data: GrokImagineResult };\n\n  const imageUrl = result.data.images[0].url;\n  console.log(`Edited image URL: ${imageUrl}`);\n\n  // Send via OpenClaw\n  const messageCaption = caption || `Edited with Grok Imagine`;\n\n  await execAsync(\n    `openclaw message send --action send --channel \"${channel}\" --message \"${messageCaption}\" --media \"${imageUrl}\"`\n  );\n\n  console.log(`Sent to ${channel}`);\n  return imageUrl;\n}\n\n// Usage Examples\n\n// Mirror mode (auto-detected from \"wearing\")\neditAndSend(\n  \"wearing a cyberpunk outfit with neon lights\",\n  \"#art-gallery\",\n  \"auto\",\n  \"Check out this AI-edited art!\"\n);\n// → Mode: mirror\n// → Prompt: \"make a pic of this person, but wearing a cyberpunk outfit with neon lights. the person is taking a mirror selfie\"\n\n// Direct mode (auto-detected from \"cafe\")\neditAndSend(\n  \"a cozy cafe with warm lighting\",\n  \"#photography\",\n  \"auto\"\n);\n// → Mode: direct\n// → Prompt: \"a close-up selfie taken by herself at a cozy cafe with warm lighting, direct eye contact...\"\n\n// Explicit mode override\neditAndSend(\"casual street style\", \"#fashion\", \"direct\");\n\nSupported Platforms\n\nOpenClaw supports sending to:\n\nPlatform\tChannel Format\tExample\nDiscord\t#channel-name or channel ID\t#general, 123456789\nTelegram\t@username or chat ID\t@mychannel, -100123456\nWhatsApp\tPhone number (JID format)\t1234567890@s.whatsapp.net\nSlack\t#channel-name\t#random\nSignal\tPhone number\t+1234567890\nMS Teams\tChannel reference\t(varies)\nGrok Imagine Edit Parameters\nParameter\tType\tDefault\tDescription\nimage_url\tstring\trequired\tURL of image to edit (fixed in this skill)\nprompt\tstring\trequired\tEdit instruction\nnum_images\t1-4\t1\tNumber of images to generate\noutput_format\tenum\t\"jpeg\"\tjpeg, png, webp\nSetup Requirements\n1. Install fal.ai client (for Node.js usage)\nnpm install @fal-ai/client\n\n2. Install OpenClaw CLI\nnpm install -g openclaw\n\n3. Configure OpenClaw Gateway\nopenclaw config set gateway.mode=local\nopenclaw doctor --generate-gateway-token\n\n4. Start OpenClaw Gateway\nopenclaw gateway start\n\nError Handling\nFAL_KEY missing: Ensure the API key is set in environment\nImage edit failed: Check prompt content and API quota\nOpenClaw send failed: Verify gateway is running and channel exists\nRate limits: fal.ai has rate limits; implement retry logic if needed\nTips\n\nMirror mode context examples (outfit focus):\n\n\"wearing a santa hat\"\n\"in a business suit\"\n\"wearing a summer dress\"\n\"in streetwear fashion\"\n\nDirect mode context examples (location/portrait focus):\n\n\"a cozy cafe with warm lighting\"\n\"a sunny beach at sunset\"\n\"a busy city street at night\"\n\"a peaceful park in autumn\"\n\nMode selection: Let auto-detect work, or explicitly specify for control\n\nBatch sending: Edit once, send to multiple channels\n\nScheduling: Combine with OpenClaw scheduler for automated posts"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/HonestQiao/clawra-selfie-minimax",
    "publisherUrl": "https://clawhub.ai/HonestQiao/clawra-selfie-minimax",
    "owner": "HonestQiao",
    "version": "1.2.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax",
    "downloadUrl": "https://openagent3.xyz/downloads/clawra-selfie-minimax",
    "agentUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent",
    "manifestUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/clawra-selfie-minimax/agent.md"
  }
}