mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-12 05:51:44 +08:00
6d063734ae
* feat(baoyu-imagine): add DashScope Wan 2.7 image model support Closes #139. Adds the new `wan2.7-image-pro` and `wan2.7-image` model family to the DashScope provider so users can call Wan 2.7 directly through the official Aliyun (Bailian) API instead of going through Replicate. - Register `wan2.7-image-pro` and `wan2.7-image` as a new `wan27` family in the DashScope provider with their own size resolution rules: pixel range `[768*768, 4096*4096]` for `wan2.7-image-pro` text-to-image, `[768*768, 2048*2048]` for `wan2.7-image-pro` with refs and for the base `wan2.7-image` model in any mode, with aspect ratios validated against the documented `[1:8, 8:1]` band. - Allow up to 9 reference images per request (image editing / multi-image fusion). Local files are inlined as base64 data URLs; `http(s)://` paths are forwarded as-is. Other DashScope models still reject `--ref` with a hint to switch to a wan2.7 model or another provider. - Drop `prompt_extend` from the request body for the Wan 2.7 family (not part of the Wan 2.7 API surface) and skip the Qwen-only negative prompt for this family. - Allow `--provider dashscope --ref ...` in `detectProvider` so users can opt into Wan 2.7 reference workflows, while keeping Wan 2.7 out of the auto-detect ref priority list. - Add provider, reference, and usage-example documentation, plus unit tests covering family routing, size derivation across the three pixel-budget modes, ratio rejection, explicit-size validation, and the new `--provider dashscope` ref opt-in path. Made-with: Cursor * fix(baoyu-imagine): force n=1 for DashScope wan2.7 to avoid silent multi-image billing Cross-checked the implementation against the official Wan 2.7 image generation & editing API reference and found that the API defaults `parameters.n` to 4 in non-collage mode (1-4 range, billed per image). baoyu-imagine has single-image save semantics — only the first image in the response is kept — so without an explicit `n: 1` users would silently pay for 3 discarded images per request. - Always send `parameters.n: 1` in the wan2.7 request body - Reject `--n > 1` for wan2.7 with a clear error pointing at the single-image save semantics - Add tests asserting the request body shape (n=1, no prompt_extend, no negative_prompt) and the --n>1 rejection - Document the defaults-vs-skill mismatch in the dashscope reference Made-with: Cursor * Fix DashScope Wan 2.7 review feedback
4.6 KiB
4.6 KiB
Usage Examples
Extended CLI examples. SKILL.md shows the minimum set; read this file when the user asks about provider-specific invocation, batch generation, or less-common flags.
Core Patterns
# Basic text-to-image
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image cat.png
# With aspect ratio
${BUN_X} {baseDir}/scripts/main.ts --prompt "A landscape" --image out.png --ar 16:9
# High quality
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --quality 2k
# Prompt from files
${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png
# With reference images (any provider family that supports refs)
${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --ref source.png
Per-Provider
# OpenAI
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider openai --model gpt-image-2
# Azure OpenAI (model = deployment name)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider azure --model gpt-image-2
# OpenAI GPT Image 2 custom 4K size
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cinematic landscape" --image out.png --provider openai --model gpt-image-2 --size 3840x2160
# Google with explicit model
${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --provider google --model gemini-3-pro-image-preview --ref source.png
# OpenRouter (recommended default)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider openrouter
# OpenRouter with reference
${BUN_X} {baseDir}/scripts/main.ts --prompt "Make blue" --image out.png --provider openrouter --model google/gemini-3.1-flash-image-preview --ref source.png
# DashScope (default model)
${BUN_X} {baseDir}/scripts/main.ts --prompt "一只可爱的猫" --image out.png --provider dashscope
# DashScope Qwen-Image 2.0 Pro (custom size, Chinese text)
${BUN_X} {baseDir}/scripts/main.ts --prompt "为咖啡品牌设计一张 21:9 横幅海报,包含清晰中文标题" --image out.png --provider dashscope --model qwen-image-2.0-pro --size 2048x872
# DashScope legacy fixed-size
${BUN_X} {baseDir}/scripts/main.ts --prompt "一张电影感海报" --image out.png --provider dashscope --model qwen-image-max --size 1664x928
# DashScope Wan 2.7 Image Pro (4K text-to-image)
${BUN_X} {baseDir}/scripts/main.ts --prompt "一间有着精致窗户的花店" --image out.png --provider dashscope --model wan2.7-image-pro --size 4096x4096
# DashScope Wan 2.7 Image with reference image (multi-image fusion)
${BUN_X} {baseDir}/scripts/main.ts --prompt "把图2的涂鸦喷绘在图1的汽车上" --image out.png --provider dashscope --model wan2.7-image-pro --ref car.webp paint.webp
# Z.AI GLM-image
${BUN_X} {baseDir}/scripts/main.ts --prompt "一张带清晰中文标题的科技海报" --image out.png --provider zai
# Z.AI with custom size
${BUN_X} {baseDir}/scripts/main.ts --prompt "A science illustration with labels" --image out.png --provider zai --model glm-image --size 1472x1088
# MiniMax
${BUN_X} {baseDir}/scripts/main.ts --prompt "A fashion editorial portrait" --image out.jpg --provider minimax
# MiniMax with subject reference (character/portrait consistency)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A girl by the library window" --image out.jpg --provider minimax --model image-01 --ref portrait.png --ar 16:9
# Replicate (default: google/nano-banana-2)
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cat" --image out.png --provider replicate
# Replicate Seedream 4.5
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cinematic portrait" --image out.png --provider replicate --model bytedance/seedream-4.5 --ar 3:2
# Replicate Wan 2.7 Image Pro
${BUN_X} {baseDir}/scripts/main.ts --prompt "A concept frame" --image out.png --provider replicate --model wan-video/wan-2.7-image-pro --size 2048x1152
Batch Mode
# Batch from saved prompt files
${BUN_X} {baseDir}/scripts/main.ts --batchfile batch.json
# Batch with explicit worker count
${BUN_X} {baseDir}/scripts/main.ts --batchfile batch.json --jobs 4 --json
Batch File Format
{
"jobs": 4,
"tasks": [
{
"id": "hero",
"promptFiles": ["prompts/hero.md"],
"image": "out/hero.png",
"provider": "replicate",
"model": "google/nano-banana-2",
"ar": "16:9",
"quality": "2k"
},
{
"id": "diagram",
"promptFiles": ["prompts/diagram.md"],
"image": "out/diagram.png",
"ref": ["references/original.png"]
}
]
}
Paths in promptFiles, image, and ref are resolved relative to the batch file's directory. jobs is optional (overridden by CLI --jobs). A top-level array without the jobs wrapper is also accepted.