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...
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.
clawhub install hf-sdxl-image