StarModel invitation
← Back to skills
extension
Category: Content & MediaAPI key requirement unconfirmed

agnes图片生成

Generate and edit images with the Agnes Image 2.5 Flash model (agnes-image-2.5-flash) over the Agnes AI API. Use this skill whenever the user wants to create, generate, draw, design, or make an image — including text-to-image, image-to-image conversion, style transfer, background change, relighting, multi-image composition, product visualization, posters, cover art, thumbnails, banners, concept art, or any visual artwork — even when they do not mention "Agnes" by name. Also use it whenever the user explicitly references the agnes-image-2.5-flash or agnes-image-2.1-flash model.

personAuthor: XiaohanyshubModelScope

Agnes Image Skill

Generate and edit images with the Agnes Image 2.5 Flash model (agnes-image-2.5-flash).

The model supports three workflows:

| Workflow | What it does | Needs input images? | | - | - | - | | Text-to-image | Generate an image from a text prompt | No | | Image-to-image | Transform / restyle / recolor an existing image | Yes, one | | Multi-image composite | Combine several reference images into one new image | Yes, several |

Prerequisites

  • API key. The script reads AGNES_API_KEY from the environment. Before running, check it exists (do not print the full key):
    [ -n "$AGNES_API_KEY" ] && echo "key set (${AGNES_API_KEY:0:6}…)" || echo "key missing"
    
    If it is missing, ask the user to set AGNES_API_KEY (and optionally AGNES_BASE_URL, which defaults to https://api.agnes-ai.cn/v1). Stop and wait until they confirm.
  • Python 3 for the bundled helper script.

Workflow

  1. Identify the workflow. Text-to-image, image-to-image (one input), or composite (several inputs). If the user references images, get a public HTTPS URL for each, or a local file you can encode as a Data URI (see Input images below).
  2. Craft a strong prompt. Follow the prompt structures in the next section — the model rewards explicit structure and detail. For image-to-image, always state both what to change and what to preserve.
  3. Pick size + ratio. Use a tiered size (1K, 2K, 3K, 4K) plus a ratio. 2K + 16:9 is a safe default for wide content. Full table in references/api.md.
  4. Run the helper. It builds the correct request (with response_format placed correctly inside extra_body), calls the API, and prints the image URL or saves a Base64 image to a file.
  5. Present the result. Give the user the image URL. If they want the file locally, re-run with --output b64 --out file.png.

Using the helper script

The script scripts/generate_image.py handles request construction and response parsing so you don't trip on the API's placement rules. Run it with Bash.

Text-to-image (URL output):

python3 "$SKILL_DIR/scripts/generate_image.py" \
  --prompt "A luminous floating city above a misty canyon at sunrise, cinematic realism" \
  --size 2K --ratio 16:9

Image-to-image (one input image, URL output):

python3 "$SKILL_DIR/scripts/generate_image.py" \
  --prompt "Transform the scene into a rain-soaked cyberpunk night with neon reflections; preserve the original composition" \
  --size 2K --ratio 16:9 \
  --images "https://example.com/input.png"

Multi-image composite:

python3 "$SKILL_DIR/scripts/generate_image.py" \
  --prompt "Combine the two characters into an intense fantasy battle scene, dynamic lighting, cinematic composition" \
  --size 2K --ratio 16:9 \
  --images "https://example.com/character-1.png,https://example.com/character-2.png"

Save to a local file (Base64):

python3 "$SKILL_DIR/scripts/generate_image.py" \
  --prompt "Clean product photo of a glass cube on white studio background, soft shadows, high detail" \
  --size 1K --ratio 1:1 \
  --output b64 --out "/tmp/agnes-out.png"

$SKILL_DIR is this skill's directory. The script prints the image URL (or the saved-file path) to stdout; diagnostics go to stderr. If you need the raw API call instead, see references/api.md for the curl form.

Input images

For image-to-image / composite, the model needs each input image reachable by the Agnes service:

  • Public HTTPS URL — preferred. Must not require login, cookies, or private headers.
  • Data URI — for local files, encode as data:image/png;base64,<BASE64>. You can build it inline, e.g. python3 -c "import base64,sys; print('data:image/png;base64,'+base64.b64encode(open(sys.argv[1],'rb').read()).decode())" /path/to/file.png and pass the result to --images.

Prompt structures

Good prompts are the single biggest quality lever. These structures come from the official docs.

Text-to-image: [主体] + [场景/环境] + [风格] + [光照] + [构图] + [质量要求]

日出时分薄雾峡谷上方的发光浮空城市,电影级写实风格,广角构图,丰富的建筑细节,柔和的金色光线,高视觉密度

Image-to-image: [改变要求] + [新风格/场景] + [添加或移除的元素] + [保留的元素]

将白天街道场景改为电影级赛博朋克夜景,添加霓虹招牌和湿滑路面倒影,同时保留原始街道布局、相机角度和主要建筑形状。

Multi-image composite: describe each reference image's role and how they relate in the final image.

将第一张图作为主要角色,第二张图作为产品参考,生成一张电影级活动海报,保留角色身份和产品外形,使用自然光照和干净的商业构图。

High-information-density scenes (this model's specialty): describe the visual hierarchy — main subject, background, important secondary details, style, lighting, composition.

建在悬崖上的大型奇幻港口城市,数百艘小船,层叠的石桥,发光的窗户,远山,多云的日落天空,电影级奇幻写实风格,广角构图,丰富的建筑细节,高视觉密度

When the user's request is vague ("make a cool poster"), do one round of enrichment yourself using these structures before calling the API — translate a terse request into a structured prompt and confirm direction with the user only if a key choice (subject, style) is genuinely ambiguous.

Rules and gotchas

These are the things that break requests — the helper script already follows them, but keep them in mind if you ever build a request by hand.

  • response_format must live inside extra_body, never at the top level. Top-level response_format is silently wrong. URL output → extra_body.response_format: "url"; Base64 → extra_body.response_format: "b64_json".
  • Image-to-image does not need tags: ["img2img"]. Just put input images in extra_body.image. Do not send tags.
  • Use tiered size + ratio together for predictable output dimensions. Exact sizes like 1920x1080 are not native and get remapped (e.g. to 1312x736). For 16:9 desktop wallpaper-style content, request size: "2K" + ratio: "16:9" then crop downstream.
  • Image generation can take a few to tens of seconds. The script timeout defaults to 360s. For very large outputs or heavy load, be patient.
  • Input image URL must be publicly accessible. If a URL returns 401/403 to the Agnes service, use a Data URI instead.

Quick size reference

| Ratio | 1K | 2K | 3K | 4K | | - | - | - | - | - | | 1:1 | 1024² | 2048² | 3072² | 4096² | | 16:9 | 1312×736 | 2624×1472 | 3936×2208 | 5248×2944 | | 9:16 | 736×1312 | 1472×2624 | 2208×3936 | 2944×5248 | | 4:3 | 1152×864 | 2304×1728 | 3456×2592 | 4608×3456 | | 3:4 | 864×1152 | 1728×2304 | 2592×3456 | 3456×4608 |

Full table (including 2:3, 3:2, 21:9) and all curl examples live in references/api.md. Read it when you need a non-standard ratio, the raw request/response shape, or troubleshooting detail.