๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

hf-sdxl-image

by @slippersheepig

Generate an image from a text prompt through the Hugging Face Inference API using stabilityai/stable-diffusion-xl-base-1.0 and the HUGGINGFACE_TOKEN environm...

๐Ÿ“‹ Tips & Best Practices

Missing token

If the script says Missing HUGGINGFACE_TOKEN environment variable., export the token before running it.

export HUGGINGFACE_TOKEN=hf_xxx

Optional model override

To switch to another compatible Hugging Face Inference API model, set HF_IMAGE_MODEL.

export HF_IMAGE_MODEL=stabilityai/stable-diffusion-3-medium-diffusers

If HF_IMAGE_MODEL is unset, the script uses stabilityai/stable-diffusion-xl-base-1.0.

401 or 403

The token is missing, invalid, expired, or does not have permission for the endpoint.

503 or model loading errors

Retry with --wait-for-model.

JSON instead of an image

Read the full JSON error body and surface it to the user. Do not pretend generation succeeded.

Storage policy

The default policy is temporary-file delivery.

  • Generate into a temporary local path for normal chat delivery
  • Return the saved file path so OpenClaw can send the file to the current conversation
  • Delete the temporary file immediately after successful delivery
  • Keep a persistent local copy only when the user explicitly asks for that behavior
  • View on ClawHub
    TERMINAL
    clawhub install hf-sdxl-image

    ๐Ÿงช Use this skill with your agent

    Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

    ๐Ÿ” Can't find the right skill?

    Search 60,000+ AI agent skills โ€” free, no login needed.

    Search Skills โ†’