Install
openclaw skills install @nextai/nextai-image-forgeUse when an agent invokes ImageForge to generate or edit raster images with NextAI Code, configure API key/model, diagnose setup, or check whether the image-forge skill has a newer version.
openclaw skills install @nextai/nextai-image-forgeUse this skill to generate or edit raster images through the fixed NextAI Code image API.
On every ImageForge skill use, run ensure-ready as the first command:
WORKSPACE_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
IMAGE_FORGE_SCRIPT=""
for candidate in \
"$WORKSPACE_ROOT/.agents/skills/image-forge/scripts/image_forge.py" \
"$PWD/.agents/skills/image-forge/scripts/image_forge.py" \
"$HOME/.agents/skills/image-forge/scripts/image_forge.py"; do
if [ -f "$candidate" ]; then IMAGE_FORGE_SCRIPT="$candidate"; break; fi
done
if [ -z "$IMAGE_FORGE_SCRIPT" ]; then
echo "ImageForge helper not found. Reinstall or update the image-forge skill."
exit 2
fi
python3 "$IMAGE_FORGE_SCRIPT" ensure-ready
ensure-ready runs preflight. If configuration is missing, it stops the current flow, starts setup-server, waits for the user to save API key/model, then runs preflight again. Do not do any other work until preflight passes.
After ensure-ready passes and before any image generation or editing command, Read references/image-brief.md.
You MUST complete the Image Brief Brainstorming Workflow before calling generate or edit. Maintain a visible checklist for the workflow. Do not compress the workflow into one brief. Do not answer the user's first normal image request with an Approved Image Brief, final prompt, or generation command.
Do not run generate or edit until the agent has explored context, asked clarifying questions one at a time, proposed 2-3 approaches, presented design sections, captured design confirmations, completed brief self-review, and the user approves the brief. Ask one question at a time and stop after the first question.
The helper enforces this gate: normal generation/editing must pass a structured --brief '<approved brief>' with question/answer evidence, 2-3 approaches, design confirmations, self-review, and explicit user approval. Hollow or one-line briefs are rejected before any provider call.
Direct mode: if the user explicitly says to generate/edit directly, not ask questions, or use the prompt exactly as written, skip clarification questions, briefly restate the execution understanding, then proceed with --direct. Do not use --direct unless the user explicitly asked to skip clarification.
scripts/image_forge.py over hand-written HTTP commands.https://www.nextai-code.com/v1. Never use or suggest another API URL.gpt-image-2 unless the user configures another NextAI-supported model..png image files and do not create output sidecar .json files.preflight reports missing API key or model, start the local setup-server yourself; do not ask the user to run setup commands.--brief '<approved brief>' or --direct.Use the IMAGE_FORGE_SCRIPT resolver above instead of hard-coding a single install directory. npx skills add may install to a workspace .agents/skills/image-forge directory, while other agents may install to $HOME/.agents/skills/image-forge.
Do not make normal users configure PATH. image-forge is only a convenience alias when already available; otherwise run python3 "$IMAGE_FORGE_SCRIPT" <command>.
Configuration priority:
https://www.nextai-code.com/v1IMAGE_FORGE_API_KEY, IMAGE_FORGE_MODEL.image-forge/config.json for defaultModel and outputDir~/.config/image-forge/secrets.json for apiKeyIMAGE_FORGE_API_URL and .image-forge/config.json apiUrl are accepted only when they equal https://www.nextai-code.com or https://www.nextai-code.com/v1; any other URL is rejected before provider calls.
Configuration gate:
IMAGE_FORGE_SCRIPT.python3 "$IMAGE_FORGE_SCRIPT" ensure-ready
ensure-ready returns ready.The setup page listens on 127.0.0.1, uses a one-time token URL, never echoes the API key, shows the locked NextAI Code URL, links to https://www.nextai-code.com for registration/API key retrieval, persists configuration, and shuts down after saving.
Required readiness check:
python3 "$IMAGE_FORGE_SCRIPT" ensure-ready
If this command fails, do not continue the user's image task until configuration is complete.
python3 "$IMAGE_FORGE_SCRIPT" ensure-ready.python3 "$IMAGE_FORGE_SCRIPT" setup only if a browser form is unavailable; it prints the fixed NextAI Code URL and asks only for model/key.python3 "$IMAGE_FORGE_SCRIPT" setup-server only for manual diagnostics.python3 "$IMAGE_FORGE_SCRIPT" preflight.python3 "$IMAGE_FORGE_SCRIPT" generate --brief '<approved brief>' --prompt '<approved prompt>'.python3 "$IMAGE_FORGE_SCRIPT" edit --brief '<approved brief>' --image '<path>' --prompt '<approved instruction>'.python3 "$IMAGE_FORGE_SCRIPT" doctor.python3 "$IMAGE_FORGE_SCRIPT" check-version.references/openai-compatible-images.md (NextAI Code fixed-base edition)references/image-brief.mdreferences/installation.mdreferences/troubleshooting.mdReport the generated or edited image path, model, output size, and any degraded version-check or provider-compatibility status. Default outputs are written directly to the project root. Never report secrets.