Files
market/skills/dashscope-image-gen/SKILL.md
Yige 8f7953948f fix: 补齐市场静态事实并保持旧客户端兼容 (#184)
## 中文

补齐已有 owner 与已锁定上游内容可证明的许可证、技能类型和收录版本。保留 Anthropic Source Available
和其他附加条件,不把所有内容统一标为 MIT,不提升 listing-only 的安装准入。

README 保留最新的双语结构及以 manifest 为准的数量口径,增加静态目录不存访问量、下载量、评分或 Stars 的边界。

发布兼容性:**本 PR 不包含**两支团队新增的本地化字段,也不包含微信支付 `latestVersion:
1.0`;旧客户端会拒绝这些新字段,另以待发布 PR 保留,等匹配客户端发布后再合并。

验证:47 项目录校验测试、19 项 i18n 测试、5 项合集生成测试通过;完整目录/i18n/翻译新鲜度检查通过,6
个固定来源合集的生成检查通过,2 个浮动来源按既有规则明确跳过。发现并修复了生成器在 Windows 使用反斜杠造成的误报:输出改为 POSIX
路径,比较规则不放宽、不重写合集数据。

## English

Fill only license, type and listed-release facts supported by existing
owners or pinned upstream content. Preserve custom license restrictions
and acquisition eligibility. Keep the current bilingual README and
manifest-derived inventory; do not author usage analytics.

This PR deliberately excludes localized team fields and the two-part
WeChat Pay version that older clients reject. Those changes remain
pending a compatible client release.

Validation passes: 47 catalog-validator tests, 19 i18n tests, five
collection-generator tests, complete catalog and translation checks, and
generated inventory checks for six pinned collections. Two mutable
sources remain explicitly skipped. Fix Windows-generated path separators
without weakening comparison or changing declared children.
2026-09-22 01:09:03 +08:00

9.4 KiB
Raw Blame History

name, description, license, version, type, risk_level, status, disable-model-invocation, provider, tags, requires, metadata, market
name description license version type risk_level status disable-model-invocation provider tags requires metadata market
dashscope-image-gen Use this skill when the user wants to generate images. Supports multiple models: gpt-image-2 (default, via DesireCore Cloud), wan2.7-image-pro and wan2.7-image (when user has DashScope configured). Uses OpenAI-compatible /images/generations API for synchronous image generation. Use when the user mentions: generate image, draw, text-to-image, create image, AI painting, illustration, design picture. MIT 1.4.2 procedural low enabled true auto
media
image
generation
dashscope
alibaba
tools
Bash
author updated_at i18n
desirecore 2026-07-14
default_locale source_locale locales zh-CN en-US
en-US zh-CN
zh-CN
en-US
name short_desc description body source_hash translated_by
AI 文生图 AI 文本生成图片技能(支持 GPT Image / 通义万相) 当用户希望生成图片时使用此技能。支持多种模型:gpt-image-2(默认,通过 DesireCore Cloud)、wan2.7-image-pro / wan2.7-image(用户自行配置阿里云 DashScope 时可用)。通过 OpenAI 兼容的 /images/generations API 同步生成图片。 用户提到 生成图片、画图、文生图、创建图片、AI 绘画、生成插图、画一张、帮我画、设计图片。 ./SKILL.zh-CN.md sha256:b3d5f7a91c2e4068 human
name short_desc description body source_hash translated_by
AI Image Generation AI text-to-image generation (GPT Image / Wan models) Use this skill when the user wants to generate images. Supports multiple models: gpt-image-2 (default via DesireCore Cloud), wan2.7-image-pro / wan2.7-image (when user has DashScope configured). Uses the OpenAI-compatible /images/generations API. Trigger keywords: generate image, draw, text-to-image, create image, AI painting, illustration, design picture. ./SKILL.md sha256:8398726504b70586 human
icon short_desc category maintainer channel
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><rect x="3" y="3" width="18" height="18" rx="3" stroke="#34C759" stroke-width="1.5" fill="#34C759" fill-opacity="0.1"/><path d="M7 14l3-4 2.5 3 3.5-5 4 6H7z" fill="#34C759" fill-opacity="0.4" stroke="#34C759" stroke-width="1.2" stroke-linejoin="round"/><circle cx="15.5" cy="8.5" r="1.5" fill="#34C759" fill-opacity="0.6"/></svg> AI text-to-image generation (GPT Image / Wan models) media
name verified
DesireCore Official true
latest

dashscope-image-gen Skill

Mandatory Rules (violations cause failure)

  1. STRICTLY follow the execution steps below — do NOT improvise, explore alternative endpoints, or try models not listed in this document
  2. Must access agent-service over HTTPS — the API address is already provided in the system prompt under the local API section (e.g. https://127.0.0.1:PORT); use it directly with -k to skip certificate verification
  3. Must upload to media-store via /api/media/upload — /tmp is only a transient download/decode location, never use a local path as the final output
  4. Must use the dc-media:// protocol to display images — the only form the frontend can render correctly
  5. Use Bash curl throughout — do not use the HttpRequest tool or Python
  6. Use /images/generations endpoint — synchronous call; the response contains b64_json image data
  7. Only use models listed below — do NOT try dall-e-3, qwen-vl, or any model not in the Model Selection table

Provider & Default Compute

You do NOT need to specify a provider — just pass "serviceType": "image_gen" and the system will automatically route to the correct provider.

Never try to query provider lists, read compute.json, or explore available models through API calls. The models listed below are guaranteed to work.

Model Selection

Model Characteristics When to use
gpt-image-2 High quality, fast, versatile styles Default — use when user does not specify a model
wan2.7-image Standard high quality (requires DashScope provider) Only when user explicitly asks for Wan / DashScope
wan2.7-image-pro Flagship, 4K resolution (requires DashScope provider) Only when user explicitly asks for top quality Wan model

Default rule: if the user does not specify a model, use gpt-image-2.

Note: wan2.7-image and wan2.7-image-pro only work when the user has configured their own Alibaba Cloud DashScope provider. If you get an error with these models, fall back to gpt-image-2.

Full Execution Flow (strictly follow these steps)

How to get the API address

The system prompt already contains the agent-service API address under the local API section (e.g. Agent Service: https://127.0.0.1:61000). Extract the URL from there and use it directly.

If for any reason you cannot find it in the system prompt, use this fallback:

PORT=$(cat "${DESIRECORE_HOME:-$HOME/.desirecore}/agent-service.port")
# Then use https://127.0.0.1:${PORT}

Step 1: Generate the image (single curl command)

Call /images/generations through media-proxy. You MUST use this exact request structure — do not add messages, response_format, or any other parameters not shown here:

# Save response to a temp file to avoid base64 flooding the terminal
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media-proxy" \
  -H "Content-Type: application/json" \
  -d '{
    "serviceType": "image_gen",
    "endpoint": "/images/generations",
    "body": {
      "model": "gpt-image-2",
      "prompt": "Replace this with the image description (English usually gives better results)",
      "size": "1024x1024",
      "n": 1
    },
    "responseType": "json"
  }' -o /tmp/dashscope-response.json

# Check success and extract b64_json directly to image file (NEVER cat the response to stdout)
python3 -c "
import json, base64, sys
with open('/tmp/dashscope-response.json') as f:
    resp = json.load(f)
if not resp.get('success'):
    print('ERROR:', json.dumps(resp, ensure_ascii=False)[:500])
    sys.exit(1)
b64 = resp['data']['data'][0]['b64_json']
with open('/tmp/dashscope-gen.png', 'wb') as f:
    f.write(base64.b64decode(b64))
print('OK: saved to /tmp/dashscope-gen.png')
"

CRITICAL: The response contains a large base64 image (~2MB). NEVER print the raw response or b64_json to the terminal. Always save to file with -o and extract with the python3 script above.

Response format (saved in /tmp/dashscope-response.json):

{
  "success": true,
  "data": {
    "created": 1781060911,
    "data": [{"b64_json": "<very large base64 string>"}],
    "size": "1024x1024"
  }
}

Step 2: Upload to media-store

curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
  -F "file=@/tmp/dashscope-gen.png;type=image/png"

Pick the mediaId field from the JSON response (format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png).

Step 3: Render the image via the dc-media protocol

In your reply text, write Markdown image syntax directly:

![Image description](dc-media://replace-with-mediaId)

For example: ![White fox in a forest](dc-media://a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6.png)

The frontend will translate dc-media:// into a reachable image URL and render it.

Parameter Mapping

Size selection

Pass size in the body object:

{
  "model": "gpt-image-2",
  "prompt": "your image description",
  "size": "1024x1024",
  "n": 1
}
User intent size value
Square / avatar / default "1024x1024"
Landscape / scenery / wallpaper "1536x1024"
Portrait / mobile / poster "1024x1536"

Optional parameters (top-level body fields)

Parameter Description
n Number of images, 1-4, default 1
size Image size, e.g. "1024x1024"

Multiple Image Generation

When n > 1, download and upload each image, then render them one by one:

![Image 1 description](dc-media://mediaId1)
![Image 2 description](dc-media://mediaId2)

Error Handling

Error Meaning Action
"No matching provider" No enabled provider supports image_gen Tell user to enable a provider with image_gen support in settings
"API Key not configured" API Key missing Tell user to configure API key
statusCode: 401 API Key invalid or expired Tell user to check API key
statusCode: 429 Rate limited Wait and retry once
statusCode: 400 + model_price_error Model not available on current provider Switch to gpt-image-2 and retry
statusCode: 400 Other bad parameters Check model name and size are from the tables above

On model error: If wan2.7-image or wan2.7-image-pro fails with model_price_error, automatically retry with gpt-image-2. Do NOT ask the user before retrying.

On other errors: Report the error to the user clearly. Do NOT try alternative endpoints or read config files.

Notes

  • Image generation calls are synchronous and typically return in 10-60 seconds
  • English prompts usually produce the best results; Chinese is also supported
  • When the user does not specify a model or size, default to gpt-image-2 + 1024x1024