🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Skill X Post Ai Image

by @zero2ai-hub

Generate an AI image via Gemini and post it to X (Twitter) using OAuth1. Supports text-only or text+image tweets.

Versionv1.0.1
Downloads765
Installs1
TERMINAL
clawhub install skill-x-post-ai-image

πŸ“– About This Skill


name: skill-x-post-ai-image description: Generate an AI image via Gemini and post it to X (Twitter) using OAuth1. Supports text-only or text+image tweets. metadata: openclaw: requires: { bins: ["uv", "xurl"] }

X Post with AI-Generated Image

Generate a Gemini AI image from a text prompt, compress it, and post it as a tweet β€” all in one command.

Prerequisites

  • xurl CLI (X/Twitter auth) β€” see xurl skill
  • GEMINI_API_KEY env var
  • nano-banana-pro skill installed (OpenClaw)
  • uv Python runner
  • Setup

    export GEMINI_API_KEY="your-gemini-api-key"
    export X_CONSUMER_KEY="..."
    export X_CONSUMER_SECRET="..."
    export X_ACCESS_TOKEN="..."
    export X_ACCESS_TOKEN_SECRET="..."
    

    Usage

    # Post tweet with AI-generated image
    python3 scripts/post_with_image.py \
      --text "Your tweet text here" \
      --prompt "AI image prompt β€” describe the visual"

    Text-only tweet

    python3 scripts/post_with_image.py \ --text "Your tweet text" \ --no-image

    How it works

    1. Calls Gemini image generation with prompt β†’ PNG 2. Compresses + resizes to 1200Γ—675 JPEG (Twitter optimal) 3. Uploads via Twitter media API (OAuth1) 4. Posts tweet with media via xurl

    Inputs

    | Param | Description | |-------|-------------| | --text | Tweet text (required) | | --prompt | Image generation prompt (optional) | | --no-image | Skip image, post text only |

    Output

    Tweet posted; media ID and confirmation logged to stdout.

    πŸ’‘ Examples

    # Post tweet with AI-generated image
    python3 scripts/post_with_image.py \
      --text "Your tweet text here" \
      --prompt "AI image prompt β€” describe the visual"

    Text-only tweet

    python3 scripts/post_with_image.py \ --text "Your tweet text" \ --no-image

    βš™οΈ Configuration

    export GEMINI_API_KEY="your-gemini-api-key"
    export X_CONSUMER_KEY="..."
    export X_CONSUMER_SECRET="..."
    export X_ACCESS_TOKEN="..."
    export X_ACCESS_TOKEN_SECRET="..."