| name | aihubmix-image |
| description | Generate images with Aihubmix APIs, especially openai-compatible gpt-image-2 and GPT-Image-1 image generation. Supports prompt files, OpenAI-compatible image generation, reference-image editing in openai mode, optional zimage native mode, output downloads, dry-run payload inspection, and saved JSON responses. |
Aihubmix Image
Use this skill to generate images through Aihubmix.
Core Rules
- Never store real API keys in shared files.
- Prefer
AIHUBMIX_API_KEY or a private --env-file .env over --api-key.
- Use the bundled script instead of rewriting API callers.
- Default to
--mode openai for gpt-image-2 or GPT-Image-1 compatible generation.
- Use
--mode zimage only when the user asks for Aihubmix native /v1/models/{model_path}/predictions workflow.
- Save generated images into the current project unless the user asks for preview-only output.
- If reference images are used, state each image's role and treat them as edit/reference inputs in
openai mode.
- If network/DNS fails in a sandboxed environment, rerun the same command with the required network permission.
Files
- Script:
scripts/aihubmix_image.py
- User README:
README.md
- Usage reference:
references/usage.md
- Prompting reference:
references/prompting.md
- Config template:
assets/.env.example
- Example prompt:
assets/example_prompt.txt
Read references/usage.md when you need command examples or option details. Read references/prompting.md when preparing complex prompts or when a prompt is refused.
Standard Workflow
- Decide whether the request uses direct prompt text or a prompt file.
- Decide mode:
openai: default image generation via /v1/images/generations.
zimage: native Aihubmix prediction workflow via /v1/models/{model_path}/predictions.
- Decide whether reference images are needed and label their role.
- In
openai mode, reference images trigger /v1/images/edits.
- In
zimage mode, currently avoid --reference-image.
- Put the API key in
AIHUBMIX_API_KEY, a private .env file, or use the user-provided key only for the command.
- Run:
python3 <skill_dir>/scripts/aihubmix_image.py \
--env-file .env \
--prompt-file <prompt.txt> \
--name <output_name> \
--out-dir <output_dir> \
--size 1536x864 \
--quality auto \
--save-response
- Add one or more
--reference-image <path-or-url> options if needed.
- Inspect the generated image before judging success.
- If the image fails the user's constraints, revise the prompt and regenerate rather than manually hiding major generated-image errors.
Troubleshooting
Missing API key: set AIHUBMIX_API_KEY or pass --api-key.
HTTP 401: the token is invalid.
- Network/DNS failure: rerun with network permission.
- Policy refusal: rewrite into a neutral, non-harmful, non-identifying, or clearly educational/demo form; see
references/prompting.md.
- Reference image ignored: try fewer references and make each role explicit in the prompt.