← Back to Skills Marketplace
slippersheepig

hf-sdxl-image

by slippersheepig · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ⚠ suspicious
308
Downloads
0
Stars
0
Active Installs
8
Versions
Install in OpenClaw
/install hf-sdxl-image
Description
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...
README (SKILL.md)

HF SDXL Image

Generate a single image from a text prompt with the Hugging Face router endpoint. The skill defaults to stabilityai/stable-diffusion-xl-base-1.0 and can be switched to another compatible Hugging Face Inference API model by setting HF_IMAGE_MODEL.

Chat-oriented workflow

When you ask to generate an image:

  1. Convert your request into a prompt.
  2. Run scripts/generate_hf_sdxl.py with the --output /tmp/openclaw/ argument.
  3. The script saves the image to a temporary path and prints the file path to stdout.
  4. Send the image back through the current conversation provider's required image/file-send format.
  5. After successful delivery, delete the temporary file unless the user explicitly asked to keep it.

Provider-specific delivery rule

This skill only generates and saves an image file. It does not define a universal send format.

When returning the image in chat, always follow the current session provider's required outbound media format. Different providers may require different delivery methods, wrappers, or tools. Do not assume that simply reading a local file path, pasting a path, or relying on one provider's auto-routing behavior will work on another provider.

Required behavior:

  • Detect the current session provider/channel before sending.
  • Use that provider's correct media-send path and syntax.
  • If the provider requires a provider-specific wrapper or message format for images, use it.
  • If the provider does not reliably auto-send images from a local file read, do not rely on that fallback.
  • Treat image delivery as provider-specific, not skill-generic.

Examples of what to avoid:

  • Do not assume read on an image path will always send the image correctly.
  • Do not assume Telegram-style or QQ-style delivery rules apply to other providers.
  • Do not claim success until the image has actually been sent through the current provider's proper format.

Strong trigger examples

Use this skill for requests like:

  • "生成一张图片:夕阳下的海边小镇"
  • "画一张赛博朋克风格的城市夜景"
  • "帮我做一张封面图,主题是 AI 和机器人"
  • "用 Hugging Face 生成一张可爱的熊在图书馆读书"
  • "用 SDXL 出一张未来感海报"
  • "create an illustration of a scholar bear reading in a grand library"

Command

Default delivery workflow:

python3 scripts/generate_hf_sdxl.py "a cozy cyberpunk alley at night, cinematic lighting" --wait-for-model --output /tmp/openclaw/

With a model override:

HF_IMAGE_MODEL=stabilityai/stable-diffusion-3-medium-diffusers python3 scripts/generate_hf_sdxl.py "a cozy cyberpunk alley at night, cinematic lighting" --wait-for-model --output /tmp/openclaw/

Use a temporary directory for normal chat delivery. Only point --output at a persistent user-chosen location when the user explicitly asks to save or export the image.

Behavior

  • Sends POST https://router.huggingface.co/hf-inference/models/\x3Cmodel-id>
  • Reads the bearer token from HUGGINGFACE_TOKEN
  • Reads the model id from HF_IMAGE_MODEL when set; otherwise uses stabilityai/stable-diffusion-xl-base-1.0
  • Sends JSON with inputs set to the prompt
  • Requests image output with a single supported Accept header value
  • Requires --output and saves the generated image to that path or directory
  • Prints the saved file path to stdout so OpenClaw can send the file to the current conversation
  • Only generates and stores the image locally; provider-specific outbound delivery must be handled by the caller according to the active chat provider
  • Uses a temporary local file as the standard transport step for reliable delivery
  • Expects OpenClaw to delete temporary files after a successful send
  • Fails loudly when the API returns JSON or an HTTP error

Parameters

  • Positional prompt: image prompt text
  • --output: required output file path or directory; use a temporary directory for normal chat delivery, or a persistent location only when the user explicitly requests a saved file
  • --timeout: HTTP timeout in seconds; defaults to 180
  • --wait-for-model: set options.wait_for_model=true so cold starts wait instead of failing fast

Troubleshooting

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

Resource

scripts/generate_hf_sdxl.py

Use this script for deterministic generation and repeatable testing.

Usage Guidance
This skill appears to be what it claims (it calls the Hugging Face router endpoint and saves the returned image locally), but the package metadata failed to declare required environment variables. Before installing, confirm you will provide a HUGGINGFACE_TOKEN (and optionally HF_IMAGE_MODEL) and that the token's permissions are scoped appropriately. Review the included script (it only POSTs to router.huggingface.co) and ensure you trust the runtime environment that will hold your token: if a compromised agent or skill were able to run autonomously, the token could be used to make API calls. Also verify how your OpenClaw instance sends images to the chat provider (SKILL.md requires provider-specific delivery and deletion of temporary files—this script prints the file path but does not perform deletion). If you proceed, prefer a scoped or temporary HF token and/or run the skill in an environment with limited privileges. Finally, ask the publisher to update the registry metadata to list HUGGINGFACE_TOKEN (primary credential) and HF_IMAGE_MODEL (optional) so requirements are explicit.
Capability Analysis
Type: OpenClaw Skill Name: hf-sdxl-image Version: 1.1.1 The skill bundle is a legitimate tool for generating images via the Hugging Face Inference API. The Python script (scripts/generate_hf_sdxl.py) uses standard libraries to send requests to the official Hugging Face router endpoint and saves the resulting image locally. The instructions in SKILL.md correctly guide the agent on handling temporary files and provider-specific delivery without any signs of prompt injection or malicious behavior.
Capability Tags
requires-oauth-token
Capability Assessment
Purpose & Capability
The skill's stated purpose (generate images via the Hugging Face Inference API) matches the included script and instructions. However, the registry metadata does not declare the HUGGINGFACE_TOKEN (required by the script) or the optional HF_IMAGE_MODEL environment variable. That omission is an inconsistency between claimed requirements and actual runtime needs.
Instruction Scope
SKILL.md stays on-topic: it explains converting prompts, running the provided script, saving a temporary file, and delivering the image via the active conversation provider. It does not instruct reading unrelated files or calling external endpoints beyond the Hugging Face router. It correctly instructs callers to handle provider-specific delivery and temporary-file deletion.
Install Mechanism
This is an instruction-only skill with a small included Python script. There is no install spec, no archive downloads, and no unusual install locations. The runtime uses Python stdlib modules only (urllib), which is proportionate to the task.
Credentials
The script requires HUGGINGFACE_TOKEN (mandatory) and reads HF_IMAGE_MODEL when present. The skill's registry metadata declares no required env vars or primary credential. Requiring an API token to call the HF inference endpoint is reasonable, but the metadata omission is a mismatch that can mislead users about what secrets the skill needs. The number of env vars is small and appropriate for the function, but they must be declared.
Persistence & Privilege
The skill does not request persistent installation, system-wide config access, or always: true. It writes only a temporary image file (or to a user-provided path) and relies on the caller to delete temp files after delivery, which is stated in SKILL.md.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install hf-sdxl-image
  3. After installation, invoke the skill by name or use /hf-sdxl-image
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.1.1
Clarify that generated images must be sent using the active chat provider's required outbound image format instead of assuming a universal local-file delivery flow.
v1.1.0
Changed delivery flow to require --output and use temporary local files for chat handoff. OpenClaw now sends generated images from the saved path and removes temporary files after successful delivery. Removed base64 and raw stdout image output modes.
v1.0.1
Deliver generated images to chat by default without local persistence; only save to a local file when explicitly requested by the user.
v1.0.0
Prefer direct image delivery to chat by default; only fall back to local file path when direct send is unavailable or fails.
v0.1.3
Fix SKILL.MD
v0.1.2
Add HF_IMAGE_MODEL Environment variable
v0.1.1
Add HF_IMAGE_MODEL Environment variable
v0.1.0
Initial release
Metadata
Slug hf-sdxl-image
Version 1.1.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 8
Frequently Asked Questions

What is hf-sdxl-image?

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... It is an AI Agent Skill for Claude Code / OpenClaw, with 308 downloads so far.

How do I install hf-sdxl-image?

Run "/install hf-sdxl-image" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is hf-sdxl-image free?

Yes, hf-sdxl-image is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does hf-sdxl-image support?

hf-sdxl-image is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created hf-sdxl-image?

It is built and maintained by slippersheepig (@slippersheepig); the current version is v1.1.1.

💬 Comments