Turn a one-sentence prompt into a 2K HD image: under the hood it calls the Gitee AI Serverless API's
z-image-turbo model (8-step ultra-fast generation), with about 100 free images per day, requiring only a
free token. It doesn't depend on any paid service.
Visual web version:freeimg.shenzjd.com — If you don't want to write prompts, just use the web version: built-in 18,000+ curated prompt library、12 preset styles(Official Account cover / Xiaohongshu cover / knowledge card / poster / 3D cartoon / Chinese style, etc.), 7 size ratios, history, and image hosting upload. The Skill handles letting the AI generate images directly in the conversation, while the web version handles manual fine-tuning and browsing the prompt library; both share the same token.
When to Use
- User asks to generate / draw / create an image (icon, cover, illustration, poster, avatar)
- User mentions text-to-image / drawing / generate image / AI art / generate avatar / generate cover
- User wants quick AI images without paid API keys (z-image-turbo is free)
When NOT to Use:
- User wants to edit an existing image (this skill is text-to-image only)
- User explicitly needs another model (DALL·E, Midjourney, Flux…) — use the corresponding skill/API
- No network access or Gitee AI is unreachable
Core Pattern
Step 0: First use — configure a free token
Get a token (free, three steps, see details on the freeimg.shenzjd.com page tutorial): Log in to ai.gitee.com/serverless-api → On any model details page click "Online Experience" → "API" → "Add Token" → copy.
The script reads the token in the following priority order (Do not write the token into the repository, logs, or conversation output):
- Environment variable
GITEE_AI_API_KEY - Local config file
~/.freeimg/config.env(contents one line:GITEE_AI_API_KEY=xxxx)
If neither is present, the script prints the above acquisition guide and exits; the AI should guide the user through Step 0,
and write the token into ~/.freeimg/config.env(chmod 600), only once.
Step 1: Generate image
scripts/generate.mjs --prompt "提示词" --out 输出.png \
[--width 1024] [--height 1024] [--steps 8] [--negative "负向提示词"]
--width/--height: must be a multiple of 8; for common combinations see Quick Reference--steps: default 8 (recommended value for the turbo model, higher is slower)--negative: when not passed, defaults to文字,字母,水印,签名,模糊- The API occasionally returns 502; the script already has 2 built-in backoff retries; if it still fails, try again at another time
Step 2: Delivery
- After generationfirst view the image(Read tool) to confirm quality, then hand it to the user; if unsatisfied, change the prompt and regenerate, don't give the user a bad image
- When a small size is needed (such as an App avatar 144×144), use
sips -Z 144 原图 --out 小图.png(macOS) or ImageMagickconvert -resizeto resize - Prompts in Chinese are fine; the model understands Chinese well; structure:
风格 + 主体 + 细节 + 构图 + 无文字无水印
Quick Reference
| Requirement | Parameters | Purpose |
|---|---|---|
| 1:1 square image | --width 1024 --height 1024(for HD use 2048×2048) |
Avatar, icon, knowledge card |
| 4:3 landscape image | --width 2048 --height 1536 |
Official Account cover (900×383 can be cropped later) |
| 3:4 portrait image | --width 1536 --height 2048 |
Xiaohongshu cover |
| 16:9 wide image | --width 2048 --height 1152 |
PPT illustration, banner |
Prompt template:
{风格,如 扁平卡通插画/3D 渲染/水彩}:{主体与细节},{构图,如 居中特写、四周留裁剪余量},{用途,如 App 图标、缩小时仍清晰},无文字,无水印
Environment variables:GITEE_AI_API_KEY(token),FREEIMG_CONFIG(custom config file path).
Common Mistakes
- Commit the token to the repository: the token is equivalent to a free-quota account; only put it in
~/.freeimg/config.envor an environment variable;.envfiles are always.gitignore - Size is not a multiple of 8: for example 1000×1000 will be rejected by the API or silently rounded; use 1024/1536/2048
- Garbled text in the image: z-image is unstable at rendering text; when text is needed, add it later with a design tool, and declare "no text" in the prompt
- Deliver without checking after generation: The model occasionally produces deformed hands/off-center composition; you must Read to inspect before giving it to the user
- Still retrying after quota is exhausted: About 100 free images per day; when a 429/403 is returned, tell the user to try again tomorrow or switch tokens