{"id":"f72e947e-9e56-4ae6-9de9-6bad544cd281","entityType":"agent","slug":"clawhub-jiuwu2495-agnes-image-gen","name":"agnes-图片生成","canonicalUrl":"https://www.xpersona.co/agent/clawhub-jiuwu2495-agnes-image-gen","canonicalPath":"/agent/clawhub-jiuwu2495-agnes-image-gen","generatedAt":"2026-10-11T00:33:23.233Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":null},"description":"使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。 Skill: agnes-图片生成 Owner: jiuwu2495 Summary: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。 Tags: latest:1.0.3 Version history: v1.0.3 | 2026-07-30T03:30:31.493Z | user - Added automatic dual-endpoint failover: the system now tries a dome","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17amm86tg4znarg14ppbv33y18445er:agnes-image-gen","sourceUrl":"https://clawhub.ai/jiuwu2495/agnes-image-gen","homepage":"https://clawhub.ai/jiuwu2495/skills/agnes-image-gen","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/jiuwu2495/agnes-image-gen","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/jiuwu2495/skills/agnes-image-gen","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":62,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":null},"stars":null,"forks":null,"downloads":1248,"packageName":null,"latestVersion":"1.0.3","tractionLabel":"1.2K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T21:59:13.477Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T21:59:13.537Z","lastCrawledAt":"2026-10-10T21:59:13.477Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T21:59:13.477Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.3","createdAt":"2026-07-30T03:30:31.493Z","changelog":"- Added automatic dual-endpoint failover: the system now tries a domestic endpoint if the international endpoint is unreachable, with no manual intervention needed. - Connection is now checked at the TCP level with an 8s timeout before switching endpoints. - The final chosen endpoint is output for user reference. - No changes to inputs, outputs, or API usage; usage and core capabilities remain unchanged. - Internal files scripts/__pycache__/agnes_gen.cpython-313.pyc and skill-card.md were removed.","fileCount":4,"zipByteSize":14012},{"version":"1.0.2","createdAt":"2026-07-21T09:03:16.369Z","changelog":"- 升级支持 agnes-image-2.1-flash 新版模型，文本生图与图生图共用统一 API（/generations），不再分 /edits。 - 图生图功能升级：输入图片改为 extra_body.image 字段，支持 URL 或 base64 格式，流程更直观。 - 输出尺寸升级为档位式（1K/2K/3K/4K）+ ratio 宽高比搭配，适合多场景设计需求。 - 技能文档精简并聚焦新版模型，重点强调高信息密度、复杂构图、灵活尺寸控制能力。 - 删除 skill-card.md，增加 agnes_gen.py 脚本示例，支持一键生成与下载图片。 - 当前图像生成免费，调用 Agnes API 不消耗 WorkBuddy 积分。","fileCount":5,"zipByteSize":21786},{"version":"1.0.1","createdAt":"2026-06-05T09:34:33.758Z","changelog":"- 移除 skill-card.md 文件，精简 Skill 包内容。 - SKILL.md 增加了 推荐的封装脚本（scripts/agnes_gen.py）用法，建议用一条命令自动完成图片生成、重试、下载等流程。 - 明确标注了手动 curl 方式为备用选项，不再推荐，突出自动化脚本优势。 - 其余功能和 API 说明保持不变，整体体验优化但无重大逻辑变动。","fileCount":3,"zipByteSize":8994},{"version":"1.0.0","createdAt":"2026-06-04T02:46:52.821Z","changelog":"agnes-image-gen 1.0.0 - 新增技能，集成 Agnes AI 图片生成（文生图与图生图两类模型）。 - 支持自定义 API Key，优先级：用户提供 > 环境变量 > 内置默认。 - 优化生成图片的自然真实感，降低“AI感”，增强细节和真实元素。 - 提升中文配文逻辑连贯性及字体排版美观度，避免文字重影与重叠。 - 使用 curl 直连 Agnes API，不消耗 WorkBuddy 积分，按 Agnes 额度结算。 - 丰富文档，涵盖最佳实践、参数指南、常见问题与优化技巧。","fileCount":3,"zipByteSize":8032}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17amm86tg4znarg14ppbv33y18445er:agnes-image-gen","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T00:33:23.232Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-jiuwu2495-agnes-image-gen/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":null},"readme":"Skill: agnes-图片生成\n\nOwner: jiuwu2495\n\nSummary: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。\n\nTags: latest:1.0.3\n\nVersion history:\n\nv1.0.3 | 2026-07-30T03:30:31.493Z | user\n\n- Added automatic dual-endpoint failover: the system now tries a domestic endpoint if the international endpoint is unreachable, with no manual intervention needed.\n- Connection is now checked at the TCP level with an 8s timeout before switching endpoints.\n- The final chosen endpoint is output for user reference.\n- No changes to inputs, outputs, or API usage; usage and core capabilities remain unchanged.\n- Internal files scripts/__pycache__/agnes_gen.cpython-313.pyc and skill-card.md were removed.\n\nv1.0.2 | 2026-07-21T09:03:16.369Z | user\n\n- 升级支持 agnes-image-2.1-flash 新版模型，文本生图与图生图共用统一 API（/generations），不再分 /edits。\n- 图生图功能升级：输入图片改为 extra_body.image 字段，支持 URL 或 base64 格式，流程更直观。\n- 输出尺寸升级为档位式（1K/2K/3K/4K）+ ratio 宽高比搭配，适合多场景设计需求。\n- 技能文档精简并聚焦新版模型，重点强调高信息密度、复杂构图、灵活尺寸控制能力。\n- 删除 skill-card.md，增加 agnes_gen.py 脚本示例，支持一键生成与下载图片。\n- 当前图像生成免费，调用 Agnes API 不消耗 WorkBuddy 积分。\n\nv1.0.1 | 2026-06-05T09:34:33.758Z | user\n\n- 移除 skill-card.md 文件，精简 Skill 包内容。\n- SKILL.md 增加了 推荐的封装脚本（scripts/agnes_gen.py）用法，建议用一条命令自动完成图片生成、重试、下载等流程。\n- 明确标注了手动 curl 方式为备用选项，不再推荐，突出自动化脚本优势。\n- 其余功能和 API 说明保持不变，整体体验优化但无重大逻辑变动。\n\nv1.0.0 | 2026-06-04T02:46:52.821Z | auto\n\nagnes-image-gen 1.0.0\n\n- 新增技能，集成 Agnes AI 图片生成（文生图与图生图两类模型）。\n- 支持自定义 API Key，优先级：用户提供 > 环境变量 > 内置默认。\n- 优化生成图片的自然真实感，降低“AI感”，增强细节和真实元素。\n- 提升中文配文逻辑连贯性及字体排版美观度，避免文字重影与重叠。\n- 使用 curl 直连 Agnes API，不消耗 WorkBuddy 积分，按 Agnes 额度结算。\n- 丰富文档，涵盖最佳实践、参数指南、常见问题与优化技巧。\n\nArchive index:\n\nArchive v1.0.3: 4 files, 14012 bytes\n\nFiles: scripts/agnes_gen.py (17949b), skill-card.md (2402b), SKILL.md (15860b), _meta.json (134b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: agnes-image-gen\ndescription: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。\nagent_created: true\n---\n\n# Agnes Image Gen\n\n## 概述\n\n调用 Agnes AI 的升级版图像生成模型 **`agnes-image-2.1-flash`**（Sapiens AI 出品）。该模型同时支持：\n\n- **文生图（Text-to-Image）**：根据文本提示词生成全新图像\n- **图生图（Image-to-Image）**：基于输入图像进行转换、重绘、风格化编辑，并尽量保留原始构图\n\n通过 curl 直接调用 HTTP API，不走 WorkBuddy 的对话模型机制，因此**不消耗对话积分**。当前图像生成定价为 **$0 / 张**。\n\n## 触发条件\n\n当用户提出以下请求时加载本 skill：\n- 「用 Agnes 生成一张……的图片」\n- 「用 Agnes 画……」\n- 「Agnes 图片生成」\n- 「用这张图片生成……」「把这张图片改成……风格」「给这张图换个背景」（图生图）\n- 明确要求使用 Agnes API 进行文生图或图生图\n\n## 核心能力\n\n- **高信息密度图像**：适合复杂场景、丰富构图、多层视觉元素（精细场景、复杂环境、丰富构图）\n- **构图保留**：图生图编辑时尽量保留原始构图与主体布局\n- **灵活尺寸控制**：使用 `1K` / `2K` / `3K` / `4K` 档位，配合宽高比\n- **URL / Base64 输出**：支持图像 URL 或 Base64 数据返回\n- **适用场景**：创意设计、营销内容、产品可视化、社交媒体素材、图像转换（风格迁移 / 场景重打光 / 背景变换）\n\n## API Reference\n\n### Endpoint（双端点容灾）\n\n脚本自动按以下顺序尝试，前一个访问不了就切到下一个，**无需手动干预**：\n\n| 优先级 | Endpoint | 说明 |\n|--------|----------|------|\n| 1（主） | `https://apihub.agnes-ai.com/v1/images/generations` | 国际主端点 |\n| 2（容灾） | `https://apihub.agnes-ai.cn/v1/images/generations` | **国内容灾端点**：主端点 TCP 不可达时自动切换（国内网络访问 Agnes 更稳） |\n\n- 调用前会做轻量连通性探测（TCP 层，8s 超时），主端点不可达时**立即跳过**而非空等，再尝试国内网关。\n- 端点可达但请求失败（限速/5xx）会在该端点内重试，耗尽后才跳到下一端点。\n- 运行结束会打印「本次使用: <实际端点>」，方便确认走的是哪个。\n\n> 注意：文生图与图生图**共用同一端点** `/v1/images/generations`，不再使用 `/v1/images/edits`。\n\n### 请求头\n\n```\n-H \"Authorization: Bearer YOUR_API_KEY\"\n-H \"Content-Type: application/json\"\n```\n\n### 请求参数\n\n| 参数 | 类型 | 必填 | 说明 |\n|------|------|------|------|\n| `model` | string | 是 | 模型名称，固定为 `agnes-image-2.1-flash` |\n| `prompt` | string | 是 | 图像生成或图像编辑的文本指令 |\n| `size` | string | 是 | 输出尺寸档位，推荐 `1K` / `2K` / `3K` / `4K`；兼容 `1024x768` 这类历史精确写法（不支持的尺寸可能被标准化） |\n| `ratio` | string | 否 | 与档位式 `size` 配合的宽高比，支持 `1:1`、`3:4`、`4:3`、`16:9`、`9:16`、`2:3`、`3:2`、`21:9`，默认 `1:1` |\n| `image` | string[] | 图生图必填 | 输入图像数组（**注意：放在 `extra_body.image` 中**，见下方图生图示例） |\n| `return_base64` | boolean | 否 | 文生图需要以 Base64 返回时设为 `true` |\n| `extra_body` | object | 否 | 高级工作流附加参数（见下） |\n| `extra_body.response_format` | string | 否 | 输出格式：`url` 或 `b64_json` |\n| `extra_body.image` | string[] | 图生图必填 | 输入图像数组，支持公共图像 URL 或 `data:image/...;base64,...` Data URI |\n\n### 尺寸与宽高比（输出尺寸参考）\n\n为获得可预期的输出尺寸，建议将 `size` 与 `ratio` 配合使用：\n\n| Ratio | 1K | 2K | 3K | 4K |\n|-------|-----|-----|-----|-----|\n| `1:1` | 1024x1024 | 2048x2048 | 3072x3072 | 4096x4096 |\n| `3:4` | 864x1152 | 1728x2304 | 2592x3456 | 3456x4608 |\n| `4:3` | 1152x864 | 2304x1728 | 3456x2592 | 4608x3456 |\n| `16:9` | 1312x736 | 2624x1472 | 3936x2208 | 5248x2944 |\n| `9:16` | 736x1312 | 1472x2624 | 2208x3936 | 2944x5248 |\n| `2:3` | 832x1248 | 1664x2496 | 2496x3744 | 3328x4992 |\n| `3:2` | 1248x832 | 2496x1664 | 3744x2496 | 4992x3328 |\n| `21:9` | 1568x672 | 3136x1344 | 4704x2016 | 6272x2688 |\n\n> 若请求 `1920x1080` / `2560x1440` 这类非原生精确尺寸，服务会自动映射到最接近的档位与宽高比（如 16:9 的 `1K` 输出为 `1312x736`）。需要标准显示器素材时建议请求 `size:\"2K\"` + `ratio:\"16:9\"`，再下游裁剪。\n\n## 工作流程\n\n### 1. 文生图（Text-to-Image）\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"<用户描述的图片内容>\",\n    \"size\": \"2K\",\n    \"ratio\": \"1:1\",\n    \"extra_body\": {\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n- `size` 支持档位式（`1K`/`2K`/`3K`/`4K`）或兼容精确写法（`1024x1024` 等）\n- 需要 Base64 时把 `extra_body.response_format` 改为 `b64_json`，或用顶层 `return_base64: true`\n\n### 2. 图生图（Image-to-Image）\n\n图生图**同样调用 `/v1/images/generations`**，输入图像通过 `extra_body.image` 传入（数组，支持 URL 或 Data URI）：\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"将白天街道场景改为电影级赛博朋克夜景，添加霓虹招牌和湿滑路面倒影，保留原始街道布局与建筑形状\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"https://example.com/input-image.png\"],\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n- 输入图像为数组，可放多个（多图合成），每个元素为公共 HTTPS URL 或 `data:image/png;base64,...`\n- 输入图像 URL 必须可公开访问（无需登录/cookie）；不可公开时改用 Data URI Base64\n- **不需要**传递 `tags: [\"img2img\"]`\n\n### 3. 响应处理\n\nURL 输出：\n```json\n{\n  \"created\": 1780000000,\n  \"data\": [{\n    \"url\": \"https://storage.googleapis.com/agnes-aigc/xxx.png\",\n    \"b64_json\": null,\n    \"revised_prompt\": null\n  }]\n}\n```\n\nBase64 输出：\n```json\n{\n  \"created\": 1780000000,\n  \"data\": [{\n    \"url\": null,\n    \"b64_json\": \"iVBORw0KGgoAAAANSUhEUgAA...\",\n    \"revised_prompt\": null\n  }]\n}\n```\n\n- URL 输出：从 `data[0].url` 提取\n- Base64 输出：从 `data[0].b64_json` 解码保存\n\n### 4. 下载图片到本地\n\n**URL 输出**（PowerShell）：\n```powershell\nInvoke-WebRequest -Uri \"<图片URL>\" -OutFile \"<保存路径>/agnes_output.png\"\n```\n\n**URL 输出**（Python，跨平台，带时间戳）：\n```python\nimport urllib.request, os\nfrom datetime import datetime\nurl = \"<图片URL>\"\nts = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<workspace路径>\", f\"agnes_{ts}.png\")\nurllib.request.urlretrieve(url, save_path)\n```\n\n**Base64 输出**（Python）：\n```python\nimport base64, os\nfrom datetime import datetime\nb64 = \"<data[0].b64_json>\"\nts = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<workspace路径>\", f\"agnes_{ts}.png\")\nwith open(save_path, \"wb\") as f:\n    f.write(base64.b64decode(b64))\n```\n\n> 图片 URL 来自 Google Cloud Storage，有访问时效，应尽快下载到本地。若下载失败，可改用 HTML 页面直接引用远程 URL（`<img>` 加载）再叠加 CSS 文字制成海报。\n\n### 5. 展示给用户\n\n- 调用 `preview_url` 展示图片文件\n- 调用 `deliver_attachments` 交付图片附件\n\n## 调用示例\n\n### 示例 1：软件宣传海报（文生图，档位+宽高比）\n\n**用户请求**：「用 Agnes 生成一张科技感产品发布会海报，主题 AI 助手」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"科技感产品发布会海报，主题是AI助手，未来主义风格，蓝色调，holographic效果，现代简约设计\",\n    \"size\": \"2K\",\n    \"ratio\": \"1:1\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n### 示例 2：多张不同风格（文生图，n 参数）\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"咖啡店logo设计，简约现代风格，咖啡杯元素，温暖色调\",\n    \"size\": \"1K\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n> 需要多张时，部分场景可用 `n` 参数（旧写法）；当前档位式请求建议单张循环获取多种方案。\n\n### 示例 3：图片风格转换（图生图，URL 输入）\n\n**用户请求**：「把这张照片改成赛博朋克风格」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"转换为赛博朋克风格，霓虹灯光效，未来科技感，暗色调，高对比度，保留原构图\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"https://example.com/photo.jpg\"],\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n### 示例 4：图片元素修改（图生图，Base64 Data URI 输入）\n\n**用户请求**：「把图片中的天空改成星空」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"将天空替换为璀璨星空，银河清晰可见，深蓝色调，保留原主体与构图\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"data:image/png;base64,<BASE64_HERE>\"],\n      \"response_format\": \"b64_json\"\n    }\n  }'\n```\n\n### 示例 5：中文文本优化示例（含中文字样）\n\n**用户请求**：「生成一张带『新年快乐』字样的贺卡」\n\n**优化后的 prompt**：\n```\n精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\n```\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"精美新年贺卡设计，主视觉为'新年快乐'艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\",\n    \"size\": \"1K\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n## 中文文本生成优化\n\n### 官方推荐提示词结构\n\n**文生图**：`[主体] + [场景/环境] + [风格] + [光照] + [构图] + [质量要求]`\n```\n日出时分薄雾峡谷上方的发光浮空城市，电影级写实风格，广角构图，丰富的建筑细节，柔和的金色光线，高视觉密度\n```\n\n**图生图**：`[改变要求] + [新风格/场景] + [添加或移除的元素] + [需要保留的元素]`\n```\n将白天街道场景改为电影级赛博朋克夜景，添加霓虹招牌和湿滑路面倒影，同时保留原始街道布局、相机角度和主要建筑形状。\n```\n\n**高信息密度图像**：清晰描述视觉层次结构（主要主体、背景环境、重要次要细节、风格、光照、构图约束）\n```\n建在悬崖上的大型奇幻港口城市，数百艘小船，层叠的石桥，发光的窗户，远山，多云的日落天空，电影级奇幻写实风格，广角构图，丰富的建筑细节，高视觉密度\n```\n\n### 最佳实践\n\n1. **详细描述**：风格、颜色、氛围、元素、光照、构图尽量写全\n2. **关键词组合**：逗号分隔多个关键词，如「科技感, 蓝色调, 未来主义, 简约设计」\n3. **风格指定**：明确风格名称，如「水彩画风格」「像素艺术」「3D渲染」「电影级写实」\n4. **质量修饰词**：「高清」「精致」「专业级」「高视觉密度」\n5. **构图指导**：「居中构图」「对称设计」「留白艺术」「广角构图」\n6. **尺寸策略**：标准方图用 `size:\"1K\"`+`ratio:\"1:1\"`；横幅/封面用 `size:\"2K\"`+`ratio:\"16:9\"`；手机壁纸用 `9:16`\n\n### 常见问题解决\n\n- **中文字符显示不清晰**：prompt 中强调「清晰中文字体」「可读性」「高对比度」\n- **图片不符合预期**：使用更具体描述，避免模糊词汇，加「精确」「准确」\n- **需要特定风格**：明确风格名称，如「中国风水彩」「日系动漫」「欧美卡通」\n- **需要精确显示器分辨率**（如 1920x1080）：用 `size:\"2K\"`+`ratio:\"16:9\"`，下游裁剪\n\n## 错误与故障排除\n\n### 常见错误\n\n| 错误 | 原因 | 解决 |\n|------|------|------|\n| `model_not_found` | 模型名错误 | 确认使用 `agnes-image-2.1-flash` |\n| `rate_limit_exceeded` | 调用频率过高 | 等待后重试，降低并发 |\n| `invalid_image_format` | 图片格式/编码错误 | 确保 JPEG/PNG，Base64 编码正确 |\n| `prompt_too_long` | 提示词过长 | 精简，保留关键描述 |\n| 请求超时 | 生成耗时数秒到数十秒 | 客户端超时设为 `60s-360s` |\n| 输入图像 URL 无法访问 | 私有/需登录 | 改用 Data URI Base64 |\n\n### 高频坑（官方强调）\n\n1. **不要顶层放 `response_format`**：应放在 `extra_body.response_format`\n   - ❌ `{\"model\":..., \"response_format\": \"url\"}`\n   - ✅ `{\"model\":..., \"extra_body\": {\"response_format\": \"url\"}}`\n2. **图生图不要传 `tags: [\"img2img\"]`**：只需在 `extra_body.image` 提供输入图像\n3. **图生图缺少 image**：`extra_body.image` 为必填数组\n4. **文生图三必填**：`model` + `prompt` + `size`\n\n### 错误响应格式\n\n```json\n{\n  \"error\": {\n    \"message\": \"错误描述\",\n    \"type\": \"错误类型\",\n    \"code\": \"错误代码\"\n  }\n}\n```\n\n## 注意事项\n\n- API Key 已在请求中硬编码，无需用户额外提供（如需自定义，替换 `Authorization` 中的 Bearer 值）\n- 图片 URL 来自 Google Cloud Storage，有访问时效，应尽快下载到本地\n- 若 API 返回错误，如实报告给用户，不做猜测\n- 中文 prompt 已优化，可直接用中文描述，效果良好\n- 图生图统一走 `/v1/images/generations`，输入图像放 `extra_body.image`\n- 生成的图片可能含 AI 伪影，必要时可后期处理\n- 标准价格 `$0.003/张`，**当前免费 `$0/张`**\n\n## 最佳实践\n\n1. **明确需求**：调用前明确文生图还是图生图\n2. **优化 Prompt**：用详细、具体描述，遵循官方提示词结构\n3. **选尺寸档位**：用 `1K/2K/3K/4K` + `ratio` 获得可预期输出\n4. **及时保存**：生成后立即下载，避免 URL 过期\n5. **错误重试**：按错误类型对应处理；超时调大客户端超时时间\n6. **图生图保留构图**：prompt 中显式写「保留原始构图/主体布局」\n\nFile v1.0.3:_meta.json\n\n{\n  \"ownerId\": \"kn7c4gc7gyy33s73k6rqq90yrs82tyky\",\n  \"slug\": \"agnes-image-gen\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1785382231493\n}\n\nFile v1.0.3:skill-card.md\n\n## Description:\n\nAgnes Image Gen helps agents generate and edit images with Agnes AI, supporting text-to-image and image-to-image prompts, size selection, endpoint failover, and local result saving.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[jiuwu2495](https://clawhub.ai/user/jiuwu2495)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to request creative, marketing, product visualization, social media, and image transformation assets through Agnes text-to-image or image-to-image workflows.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill ships with and automatically uses a hardcoded Agnes API key.\n\nMitigation: Remove the embedded key, rotate it as compromised, and require a user-provided key through a secure environment variable or explicit per-run configuration.\n\nRisk: Prompts and selected local images are sent to Agnes servers for generation or editing.\n\nMitigation: Warn users before use and avoid sending confidential prompts, private images, or regulated data unless the deployment has approved Agnes for that data.\n\nRisk: Generated outputs may be saved locally and returned image URLs may be time-limited.\n\nMitigation: Disclose saved file locations, apply local file handling policy, and download required results promptly.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/jiuwu2495/skills/agnes-image-gen)\n- [Agnes AI](https://agnes-ai.com)\n- [Agnes image generations endpoint](https://apihub.agnes-ai.com/v1/images/generations)\n- [Agnes image generations fallback endpoint](https://apihub.agnes-ai.cn/v1/images/generations)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with shell commands, JSON API responses, generated image URLs, and local file paths]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save generated PNG files locally and may return time-limited image URLs or base64 image data.]\n\n## Skill Version(s):\n\n1.0.3 (source: server release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nArchive v1.0.2: 5 files, 21786 bytes\n\nFiles: scripts/__pycache__/agnes_gen.cpython-313.pyc (16448b), scripts/agnes_gen.py (15397b), skill-card.md (2201b), SKILL.md (15134b), _meta.json (134b)\n\nFile v1.0.2:SKILL.md\n\n---\nname: agnes-image-gen\ndescription: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。\nagent_created: true\n---\n\n# Agnes Image Gen\n\n## 概述\n\n调用 Agnes AI 的升级版图像生成模型 **`agnes-image-2.1-flash`**（Sapiens AI 出品）。该模型同时支持：\n\n- **文生图（Text-to-Image）**：根据文本提示词生成全新图像\n- **图生图（Image-to-Image）**：基于输入图像进行转换、重绘、风格化编辑，并尽量保留原始构图\n\n通过 curl 直接调用 HTTP API，不走 WorkBuddy 的对话模型机制，因此**不消耗对话积分**。当前图像生成定价为 **$0 / 张**。\n\n## 触发条件\n\n当用户提出以下请求时加载本 skill：\n- 「用 Agnes 生成一张……的图片」\n- 「用 Agnes 画……」\n- 「Agnes 图片生成」\n- 「用这张图片生成……」「把这张图片改成……风格」「给这张图换个背景」（图生图）\n- 明确要求使用 Agnes API 进行文生图或图生图\n\n## 核心能力\n\n- **高信息密度图像**：适合复杂场景、丰富构图、多层视觉元素（精细场景、复杂环境、丰富构图）\n- **构图保留**：图生图编辑时尽量保留原始构图与主体布局\n- **灵活尺寸控制**：使用 `1K` / `2K` / `3K` / `4K` 档位，配合宽高比\n- **URL / Base64 输出**：支持图像 URL 或 Base64 数据返回\n- **适用场景**：创意设计、营销内容、产品可视化、社交媒体素材、图像转换（风格迁移 / 场景重打光 / 背景变换）\n\n## API Reference\n\n### Endpoint\n\n```\nPOST https://apihub.agnes-ai.com/v1/images/generations\n```\n\n> 注意：文生图与图生图**共用同一端点** `/v1/images/generations`，不再使用 `/v1/images/edits`。\n\n### 请求头\n\n```\n-H \"Authorization: Bearer YOUR_API_KEY\"\n-H \"Content-Type: application/json\"\n```\n\n### 请求参数\n\n| 参数 | 类型 | 必填 | 说明 |\n|------|------|------|------|\n| `model` | string | 是 | 模型名称，固定为 `agnes-image-2.1-flash` |\n| `prompt` | string | 是 | 图像生成或图像编辑的文本指令 |\n| `size` | string | 是 | 输出尺寸档位，推荐 `1K` / `2K` / `3K` / `4K`；兼容 `1024x768` 这类历史精确写法（不支持的尺寸可能被标准化） |\n| `ratio` | string | 否 | 与档位式 `size` 配合的宽高比，支持 `1:1`、`3:4`、`4:3`、`16:9`、`9:16`、`2:3`、`3:2`、`21:9`，默认 `1:1` |\n| `image` | string[] | 图生图必填 | 输入图像数组（**注意：放在 `extra_body.image` 中**，见下方图生图示例） |\n| `return_base64` | boolean | 否 | 文生图需要以 Base64 返回时设为 `true` |\n| `extra_body` | object | 否 | 高级工作流附加参数（见下） |\n| `extra_body.response_format` | string | 否 | 输出格式：`url` 或 `b64_json` |\n| `extra_body.image` | string[] | 图生图必填 | 输入图像数组，支持公共图像 URL 或 `data:image/...;base64,...` Data URI |\n\n### 尺寸与宽高比（输出尺寸参考）\n\n为获得可预期的输出尺寸，建议将 `size` 与 `ratio` 配合使用：\n\n| Ratio | 1K | 2K | 3K | 4K |\n|-------|-----|-----|-----|-----|\n| `1:1` | 1024x1024 | 2048x2048 | 3072x3072 | 4096x4096 |\n| `3:4` | 864x1152 | 1728x2304 | 2592x3456 | 3456x4608 |\n| `4:3` | 1152x864 | 2304x1728 | 3456x2592 | 4608x3456 |\n| `16:9` | 1312x736 | 2624x1472 | 3936x2208 | 5248x2944 |\n| `9:16` | 736x1312 | 1472x2624 | 2208x3936 | 2944x5248 |\n| `2:3` | 832x1248 | 1664x2496 | 2496x3744 | 3328x4992 |\n| `3:2` | 1248x832 | 2496x1664 | 3744x2496 | 4992x3328 |\n| `21:9` | 1568x672 | 3136x1344 | 4704x2016 | 6272x2688 |\n\n> 若请求 `1920x1080` / `2560x1440` 这类非原生精确尺寸，服务会自动映射到最接近的档位与宽高比（如 16:9 的 `1K` 输出为 `1312x736`）。需要标准显示器素材时建议请求 `size:\"2K\"` + `ratio:\"16:9\"`，再下游裁剪。\n\n## 工作流程\n\n### 1. 文生图（Text-to-Image）\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"<用户描述的图片内容>\",\n    \"size\": \"2K\",\n    \"ratio\": \"1:1\",\n    \"extra_body\": {\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n- `size` 支持档位式（`1K`/`2K`/`3K`/`4K`）或兼容精确写法（`1024x1024` 等）\n- 需要 Base64 时把 `extra_body.response_format` 改为 `b64_json`，或用顶层 `return_base64: true`\n\n### 2. 图生图（Image-to-Image）\n\n图生图**同样调用 `/v1/images/generations`**，输入图像通过 `extra_body.image` 传入（数组，支持 URL 或 Data URI）：\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"将白天街道场景改为电影级赛博朋克夜景，添加霓虹招牌和湿滑路面倒影，保留原始街道布局与建筑形状\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"https://example.com/input-image.png\"],\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n- 输入图像为数组，可放多个（多图合成），每个元素为公共 HTTPS URL 或 `data:image/png;base64,...`\n- 输入图像 URL 必须可公开访问（无需登录/cookie）；不可公开时改用 Data URI Base64\n- **不需要**传递 `tags: [\"img2img\"]`\n\n### 3. 响应处理\n\nURL 输出：\n```json\n{\n  \"created\": 1780000000,\n  \"data\": [{\n    \"url\": \"https://storage.googleapis.com/agnes-aigc/xxx.png\",\n    \"b64_json\": null,\n    \"revised_prompt\": null\n  }]\n}\n```\n\nBase64 输出：\n```json\n{\n  \"created\": 1780000000,\n  \"data\": [{\n    \"url\": null,\n    \"b64_json\": \"iVBORw0KGgoAAAANSUhEUgAA...\",\n    \"revised_prompt\": null\n  }]\n}\n```\n\n- URL 输出：从 `data[0].url` 提取\n- Base64 输出：从 `data[0].b64_json` 解码保存\n\n### 4. 下载图片到本地\n\n**URL 输出**（PowerShell）：\n```powershell\nInvoke-WebRequest -Uri \"<图片URL>\" -OutFile \"<保存路径>/agnes_output.png\"\n```\n\n**URL 输出**（Python，跨平台，带时间戳）：\n```python\nimport urllib.request, os\nfrom datetime import datetime\nurl = \"<图片URL>\"\nts = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<workspace路径>\", f\"agnes_{ts}.png\")\nurllib.request.urlretrieve(url, save_path)\n```\n\n**Base64 输出**（Python）：\n```python\nimport base64, os\nfrom datetime import datetime\nb64 = \"<data[0].b64_json>\"\nts = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<workspace路径>\", f\"agnes_{ts}.png\")\nwith open(save_path, \"wb\") as f:\n    f.write(base64.b64decode(b64))\n```\n\n> 图片 URL 来自 Google Cloud Storage，有访问时效，应尽快下载到本地。若下载失败，可改用 HTML 页面直接引用远程 URL（`<img>` 加载）再叠加 CSS 文字制成海报。\n\n### 5. 展示给用户\n\n- 调用 `preview_url` 展示图片文件\n- 调用 `deliver_attachments` 交付图片附件\n\n## 调用示例\n\n### 示例 1：软件宣传海报（文生图，档位+宽高比）\n\n**用户请求**：「用 Agnes 生成一张科技感产品发布会海报，主题 AI 助手」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"科技感产品发布会海报，主题是AI助手，未来主义风格，蓝色调，holographic效果，现代简约设计\",\n    \"size\": \"2K\",\n    \"ratio\": \"1:1\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n### 示例 2：多张不同风格（文生图，n 参数）\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"咖啡店logo设计，简约现代风格，咖啡杯元素，温暖色调\",\n    \"size\": \"1K\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n> 需要多张时，部分场景可用 `n` 参数（旧写法）；当前档位式请求建议单张循环获取多种方案。\n\n### 示例 3：图片风格转换（图生图，URL 输入）\n\n**用户请求**：「把这张照片改成赛博朋克风格」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"转换为赛博朋克风格，霓虹灯光效，未来科技感，暗色调，高对比度，保留原构图\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"https://example.com/photo.jpg\"],\n      \"response_format\": \"url\"\n    }\n  }'\n```\n\n### 示例 4：图片元素修改（图生图，Base64 Data URI 输入）\n\n**用户请求**：「把图片中的天空改成星空」\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"将天空替换为璀璨星空，银河清晰可见，深蓝色调，保留原主体与构图\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"data:image/png;base64,<BASE64_HERE>\"],\n      \"response_format\": \"b64_json\"\n    }\n  }'\n```\n\n### 示例 5：中文文本优化示例（含中文字样）\n\n**用户请求**：「生成一张带『新年快乐』字样的贺卡」\n\n**优化后的 prompt**：\n```\n精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\n```\n\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"精美新年贺卡设计，主视觉为'新年快乐'艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\",\n    \"size\": \"1K\",\n    \"extra_body\": { \"response_format\": \"url\" }\n  }'\n```\n\n## 中文文本生成优化\n\n### 官方推荐提示词结构\n\n**文生图**：`[主体] + [场景/环境] + [风格] + [光照] + [构图] + [质量要求]`\n```\n日出时分薄雾峡谷上方的发光浮空城市，电影级写实风格，广角构图，丰富的建筑细节，柔和的金色光线，高视觉密度\n```\n\n**图生图**：`[改变要求] + [新风格/场景] + [添加或移除的元素] + [需要保留的元素]`\n```\n将白天街道场景改为电影级赛博朋克夜景，添加霓虹招牌和湿滑路面倒影，同时保留原始街道布局、相机角度和主要建筑形状。\n```\n\n**高信息密度图像**：清晰描述视觉层次结构（主要主体、背景环境、重要次要细节、风格、光照、构图约束）\n```\n建在悬崖上的大型奇幻港口城市，数百艘小船，层叠的石桥，发光的窗户，远山，多云的日落天空，电影级奇幻写实风格，广角构图，丰富的建筑细节，高视觉密度\n```\n\n### 最佳实践\n\n1. **详细描述**：风格、颜色、氛围、元素、光照、构图尽量写全\n2. **关键词组合**：逗号分隔多个关键词，如「科技感, 蓝色调, 未来主义, 简约设计」\n3. **风格指定**：明确风格名称，如「水彩画风格」「像素艺术」「3D渲染」「电影级写实」\n4. **质量修饰词**：「高清」「精致」「专业级」「高视觉密度」\n5. **构图指导**：「居中构图」「对称设计」「留白艺术」「广角构图」\n6. **尺寸策略**：标准方图用 `size:\"1K\"`+`ratio:\"1:1\"`；横幅/封面用 `size:\"2K\"`+`ratio:\"16:9\"`；手机壁纸用 `9:16`\n\n### 常见问题解决\n\n- **中文字符显示不清晰**：prompt 中强调「清晰中文字体」「可读性」「高对比度」\n- **图片不符合预期**：使用更具体描述，避免模糊词汇，加「精确」「准确」\n- **需要特定风格**：明确风格名称，如「中国风水彩」「日系动漫」「欧美卡通」\n- **需要精确显示器分辨率**（如 1920x1080）：用 `size:\"2K\"`+`ratio:\"16:9\"`，下游裁剪\n\n## 错误与故障排除\n\n### 常见错误\n\n| 错误 | 原因 | 解决 |\n|------|------|------|\n| `model_not_found` | 模型名错误 | 确认使用 `agnes-image-2.1-flash` |\n| `rate_limit_exceeded` | 调用频率过高 | 等待后重试，降低并发 |\n| `invalid_image_format` | 图片格式/编码错误 | 确保 JPEG/PNG，Base64 编码正确 |\n| `prompt_too_long` | 提示词过长 | 精简，保留关键描述 |\n| 请求超时 | 生成耗时数秒到数十秒 | 客户端超时设为 `60s-360s` |\n| 输入图像 URL 无法访问 | 私有/需登录 | 改用 Data URI Base64 |\n\n### 高频坑（官方强调）\n\n1. **不要顶层放 `response_format`**：应放在 `extra_body.response_format`\n   - ❌ `{\"model\":..., \"response_format\": \"url\"}`\n   - ✅ `{\"model\":..., \"extra_body\": {\"response_format\": \"url\"}}`\n2. **图生图不要传 `tags: [\"img2img\"]`**：只需在 `extra_body.image` 提供输入图像\n3. **图生图缺少 image**：`extra_body.image` 为必填数组\n4. **文生图三必填**：`model` + `prompt` + `size`\n\n### 错误响应格式\n\n```json\n{\n  \"error\": {\n    \"message\": \"错误描述\",\n    \"type\": \"错误类型\",\n    \"code\": \"错误代码\"\n  }\n}\n```\n\n## 注意事项\n\n- API Key 已在请求中硬编码，无需用户额外提供（如需自定义，替换 `Authorization` 中的 Bearer 值）\n- 图片 URL 来自 Google Cloud Storage，有访问时效，应尽快下载到本地\n- 若 API 返回错误，如实报告给用户，不做猜测\n- 中文 prompt 已优化，可直接用中文描述，效果良好\n- 图生图统一走 `/v1/images/generations`，输入图像放 `extra_body.image`\n- 生成的图片可能含 AI 伪影，必要时可后期处理\n- 标准价格 `$0.003/张`，**当前免费 `$0/张`**\n\n## 最佳实践\n\n1. **明确需求**：调用前明确文生图还是图生图\n2. **优化 Prompt**：用详细、具体描述，遵循官方提示词结构\n3. **选尺寸档位**：用 `1K/2K/3K/4K` + `ratio` 获得可预期输出\n4. **及时保存**：生成后立即下载，避免 URL 过期\n5. **错误重试**：按错误类型对应处理；超时调大客户端超时时间\n6. **图生图保留构图**：prompt 中显式写「保留原始构图/主体布局」\n\nFile v1.0.2:_meta.json\n\n{\n  \"ownerId\": \"kn7c4gc7gyy33s73k6rqq90yrs82tyky\",\n  \"slug\": \"agnes-image-gen\",\n  \"version\": \"1.0.2\",\n  \"publishedAt\": 1784624596369\n}\n\nFile v1.0.2:skill-card.md\n\n## Description: <br>\nGenerates and edits images through Agnes AI's agnes-image-2.1-flash API for text-to-image and image-to-image requests. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[jiuwu2495](https://clawhub.ai/user/jiuwu2495) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and developers use this skill to ask an agent to generate new images or transform input images with Agnes AI for creative design, marketing visuals, product concepts, and social media assets. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill ships with and can automatically use a hardcoded Agnes API key, creating credential exposure and account-control risk. <br>\nMitigation: Remove and rotate the bundled key before use; require an explicit user-provided or platform-managed key. <br>\nRisk: Prompts and input images are sent to a third-party Agnes API for generation or editing. <br>\nMitigation: Disclose the third-party data transfer and avoid sending sensitive prompts or private images unless the user has approved that use. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/jiuwu2495/skills/agnes-image-gen) <br>\n- [Agnes AI](https://agnes-ai.com) <br>\n- [Agnes image generations API endpoint](https://apihub.agnes-ai.com/v1/images/generations) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown guidance with shell, Python, and JSON snippets; generated image results may be returned as URLs, Base64 data, or saved file paths.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Calls a third-party image generation API and may download generated images to the local workspace.] <br>\n\n## Skill Version(s): <br>\n1.0.2 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.0.1: 3 files, 8994 bytes\n\nFiles: skill-card.md (2457b), SKILL.md (18784b), _meta.json (134b)\n\nFile v1.0.1:SKILL.md\n\n---\nname: agnes-image-gen\ndescription: 使用 Agnes AI 的图片生成模型生成图片，支持文生图（agnes-image-2.1-flash）和图生图（agnes-image-2.0-flash）。支持自定义 API Key，用户可使用自己的 Agnes Key。优化重点：降低AI生成图片的\"AI感\"，增强自然真实感；优化中文配文逻辑连贯性、字体排版精美度，避免文字重影重叠。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度。\nagent_created: true\n---\n\n# Agnes Image Gen\n\n## 概述\n\n调用 Agnes AI 的图片生成模型，支持两种模式：\n- **文生图**：使用 `agnes-image-2.1-flash` 模型，根据文本描述生成图片\n- **图生图**：使用 `agnes-image-2.0-flash` 模型，基于现有图片进行编辑和风格转换\n\n通过 curl 直接调用 HTTP API，不走 WorkBuddy 的对话模型机制，因此**不消耗对话积分**。\n\n## API Key 配置\n\n### 默认 API Key\n技能内置了一个默认 API Key，可直接使用，无需额外配置。\n\n### 自定义 API Key\n用户可以使用自己的 Agnes API Key，优先级高于默认 Key。\n\n**设置方式**：\n1. **环境变量**（推荐）：设置环境变量 `AGNES_API_KEY`\n   ```bash\n   # Windows PowerShell\n   $env:AGNES_API_KEY = \"your-api-key-here\"\n   \n   # Linux/macOS\n   export AGNES_API_KEY=\"your-api-key-here\"\n   ```\n\n2. **直接指定**：在调用时明确告知使用自己的 API Key\n   - 用户说：「用我的 Agnes Key 生成图片，Key 是 sk-xxx」\n   - AI 应使用用户提供的 Key\n\n**API Key 优先级**：\n1. 用户明确提供的 Key → 最高优先级\n2. 环境变量 `AGNES_API_KEY` → 次优先级\n3. 技能内置默认 Key → 最低优先级（兜底）\n\n**API Key 格式**：\n- 通常以 `sk-` 开头\n- 长度约 48-64 个字符\n- 示例：`sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz`\n\n### 获取 API Key\n访问 [Agnes AI 官网](https://agnes-ai.com) 注册账号后，在控制台获取 API Key。\n\n## 触发条件\n\n当用户提出以下请求时加载本 skill：\n- 「用 Agnes 生成一张……的图片」\n- 「用 Agnes 画……」\n- 「Agnes 图片生成」\n- 「用这张图片生成……」（图生图）\n- 「把这张图片改成……风格」（图生图）\n- 明确要求使用 Agnes API 进行文生图或图生图\n\n## 模型选择指南\n\n### agnes-image-2.1-flash（文生图）\n- **用途**：根据文本描述生成全新图片\n- **特点**：生成速度快，支持多种风格\n- **适用场景**：海报设计、插画创作、概念图生成\n\n### agnes-image-2.0-flash（图生图）\n- **用途**：基于现有图片进行编辑、风格转换、元素修改\n- **特点**：保持原图构图，支持局部修改和整体风格转换\n- **适用场景**：图片风格化、背景替换、元素添加/删除\n\n## 工作流程\n\n### 推荐：使用封装脚本（一条命令搞定）\n\n脚本路径: `scripts/agnes_gen.py`\n\n**文生图**:\n```bash\npython scripts/agnes_gen.py text2img --prompt \"图片描述\" --size 1024x1024 --n 1\n```\n\n**图生图**:\n```bash\npython scripts/agnes_gen.py img2img --image ./input.jpg --prompt \"编辑指令\" --size 1024x1024\n```\n\n脚本自动处理：重试、友好错误提示、下载图片到本地。无需手动执行任何额外步骤。\n\n### 备用：手动 curl（不推荐，缺少重试和自动下载）\n\n### 1. 文生图（agnes-image-2.1-flash）\n\n```bash\n# AGNES_API_KEY 应替换为实际的 API Key（用户提供的、环境变量中的、或内置默认值）\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"<用户描述的图片内容>\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n**支持参数说明：**\n- `model`: 固定为 `agnes-image-2.1-flash`\n- `prompt`: 图片描述（支持中英文，中文效果已优化）\n- `n`: 生成张数，默认为 1，最多支持 4 张\n- `size`: 图片尺寸，支持 `1024x1024`、`1024x768`、`768x1024`、`512x512`\n\n### 2. 图生图（agnes-image-2.0-flash）\n\n```bash\n# AGNES_API_KEY 应替换为实际的 API Key\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"<base64编码的图片数据或图片URL>\",\n    \"prompt\": \"<编辑指令描述>\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n**支持参数说明：**\n- `model`: 固定为 `agnes-image-2.0-flash`\n- `image`: 原始图片（支持 base64 编码或 URL）\n- `prompt`: 编辑指令（支持中英文）\n- `n`: 生成张数，默认为 1\n- `size`: 输出图片尺寸\n\n### 3. 响应处理\n\nAPI 响应格式示例：\n```json\n{\n  \"created\": 1780468823,\n  \"data\": [{\n    \"url\": \"https://storage.googleapis.com/agnes-aigc-test/images/...\",\n    \"revised_prompt\": \"优化后的提示词（如有）\"\n  }],\n  \"usage\": {\n    \"total_tokens\": 0\n  }\n}\n```\n\n从 `data[0].url` 提取图片 URL。\n\n### 4. 下载图片到本地\n\n**Windows 环境**使用 PowerShell 下载：\n\n```powershell\nInvoke-WebRequest -Uri \"<图片URL>\" -OutFile \"<保存路径>/agnes_output.png\"\n```\n\n或使用 Python（跨平台）：\n\n```python\nimport urllib.request\nimport os\nfrom datetime import datetime\n\n# 生成带时间戳的文件名\ntimestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<当前workspace路径>\", f\"agnes_{timestamp}.png\")\nurllib.request.urlretrieve(url, save_path)\n```\n\n若下载失败，可改用 HTML 页面直接引用远程 URL（图片通过 `<img>` 加载），再叠加 CSS 文字制成海报。\n\n### 5. 展示给用户\n\n- 调用 `preview_url` 展示图片文件\n- 调用 `deliver_attachments` 交付图片附件\n\n## 调用示例\n\n### 示例 1：生成产品海报（文生图）\n\n**用户请求**：「用 Agnes 生成一张科技感十足的产品发布会海报，主题是AI助手」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"科技感产品发布会海报，主题是AI助手，未来主义风格，蓝色调， holographic效果，现代简约设计\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 2：生成多张不同风格（文生图）\n\n**用户请求**：「生成3张不同风格的咖啡店logo」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"咖啡店logo设计，简约现代风格，咖啡杯元素，温暖色调\",\n    \"n\": 3,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 3：图片风格转换（图生图）\n\n**用户请求**：「把这张照片改成赛博朋克风格」\n\n**准备工作**：\n```python\nimport base64\nimport urllib.request\n\n# 读取本地图片并转换为 base64\nwith open(\"input_image.jpg\", \"rb\") as image_file:\n    encoded_string = base64.b64encode(image_file.read()).decode('utf-8')\n```\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"data:image/jpeg;base64,<base64编码数据>\",\n    \"prompt\": \"转换为赛博朋克风格，霓虹灯光效，未来科技感，暗色调，高对比度\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 4：图片元素修改（图生图）\n\n**用户请求**：「把图片中的天空改成星空」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"https://example.com/original_image.jpg\",\n    \"prompt\": \"将天空替换为璀璨星空，银河清晰可见，深蓝色调\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 5：中文文本优化示例\n\n**用户请求**：「生成一张带有\"新年快乐\"字样的贺卡」\n\n**优化后的 prompt**：\n```\n精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\n```\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n## 中文文本生成优化\n\n### 最佳实践\n\n1. **详细描述**：提供尽可能详细的描述，包括风格、颜色、氛围、元素等\n2. **关键词组合**：使用逗号分隔多个关键词，如「科技感, 蓝色调, 未来主义, 简约设计」\n3. **风格指定**：明确指定艺术风格，如「水彩画风格」「像素艺术」「3D渲染」\n4. **质量修饰词**：添加质量相关的描述，如「高清」「精致」「专业级」\n5. **构图指导**：描述构图方式，如「居中构图」「对称设计」「留白艺术」\n\n### 中文 Prompt 模板\n\n**产品海报**：\n```\n[产品类型]海报设计，[主题描述]，[风格]，[色调]，[氛围]，[装饰元素]，[质量描述]\n```\n\n**插画创作**：\n```\n[场景描述]，[人物/物体]，[动作/状态]，[艺术风格]，[色彩搭配]，[光影效果]，[细节描述]\n```\n\n**Logo 设计**：\n```\n[品牌/公司]logo设计，[核心元素]，[设计风格]，[色彩方案]，[象征意义]，[应用场景]\n```\n\n### 常见问题解决\n\n**问题1**：中文字符显示不清晰\n**解决方案**：在 prompt 中强调「清晰中文字体」「可读性」「高对比度」\n\n**问题2**：生成的图片不符合预期\n**解决方案**：使用更具体的描述，避免模糊词汇，添加「精确」「准确」等修饰词\n\n**问题3**：需要特定风格\n**解决方案**：明确指定风格名称，如「中国风水彩」「日系动漫」「欧美卡通」\n\n## 降低AI感与优化中文配文\n\n### 核心目标\n生成更自然、更少AI味的图片，同时确保中文配文逻辑连贯、字体排版精美、无重影重叠。\n\n### 降低AI感的关键技巧\n\n#### 1. 增加自然与真实感描述\n在 prompt 中添加以下关键词，引导模型生成更自然、有纹理、不完美的图像：\n- **自然元素**：自然光线、有机形态、不规则纹理、真实质感、生活气息\n- **避免AI特征**：避免过度完美、过度对称、过度光滑、过度渲染\n- **细节丰富**：添加微小瑕疵、自然磨损、环境痕迹、光影变化\n\n**示例 prompt 优化**：\n- 原始：`科技感产品海报，蓝色调，未来主义风格`\n- 优化：`科技感产品海报，蓝色调，未来主义风格，自然光线下的真实质感，有机形态设计，避免过度光滑渲染，带有细微环境纹理`\n\n#### 2. 指定真实世界参考\n使用真实世界中的风格、材质、场景作为参考：\n- `真实照片风格，非数字渲染`\n- `手工绘制质感，带有笔触痕迹`\n- `胶片摄影颗粒感，自然色彩还原`\n- `实物拍摄，非3D建模`\n\n#### 3. 避免典型AI生成模式\n明确排除常见的AI生成特征：\n- `避免过度完美对称`\n- `避免不自然的光滑表面`\n- `避免不真实的颜色饱和度`\n- `避免机械感过强的几何形状`\n\n### 优化中文配文的关键技巧\n\n#### 1. 逻辑连贯性\n确保配文内容逻辑清晰、语义连贯：\n- **明确主题**：清晰定义图片要表达的核心信息\n- **结构化描述**：使用主谓宾结构，避免碎片化关键词堆砌\n- **上下文关联**：确保文字与图片内容紧密相关\n\n**示例**：\n- 原始：`新年快乐，红色背景，烟花`\n- 优化：`一张温馨的新年贺卡，主视觉为手写体\"新年快乐\"，红色背景上绽放着金色烟花，整体传达喜庆与祝福的氛围`\n\n#### 2. 字体排版精美\n指定字体风格和排版要求，确保文字美观易读：\n- **字体风格**：书法体、手写体、印刷体、艺术字\n- **排版要求**：清晰可读、层次分明、布局合理\n- **质量强调**：高清锐利、无模糊、无锯齿\n\n**示例 prompt 添加**：\n```\n主视觉为\"新年快乐\"高清书法字体，笔触清晰锐利，无重影无重叠，字体边缘干净利落，专业排版设计\n```\n\n#### 3. 避免文字重影与重叠\n明确要求文字清晰，避免常见问题：\n- **清晰度要求**：字体清晰锐利，无模糊、无重影\n- **布局要求**：文字位置合理，不与其他元素重叠\n- **对比度要求**：文字与背景对比鲜明，易于阅读\n\n**示例 prompt 添加**：\n```\n文字清晰锐利，无重影无重叠，字体边缘干净，与背景对比鲜明，专业排版无错位\n```\n\n### 综合优化 Prompt 模板\n\n#### 带文字的图片生成模板：\n```\n[场景/主题描述]，[风格/艺术形式]，[色调/氛围]，[主要文字内容]使用[字体风格]清晰展示，字体高清锐利无重影无重叠，[自然/真实感描述]，[避免AI特征]，[质量描述]\n```\n\n#### 示例：优化后的新年贺卡 prompt\n```\n温馨的新年贺卡设计，手绘插画风格，暖色调，主视觉为\"新年快乐\"高清书法字体，笔触清晰锐利无重影无重叠，自然光线下带有纸张纹理质感，避免过度完美渲染，整体传达喜庆与祝福的氛围，专业排版设计，高清精致\n```\n\n### 测试与迭代建议\n\n1. **对比测试**：生成多个版本，对比AI感与自然感\n2. **文字检查**：重点检查文字是否清晰、有无重影重叠\n3. **细节观察**：检查纹理、光影、瑕疵是否自然\n4. **迭代优化**：根据结果调整prompt中的关键词权重\n\n## 错误处理\n\n### 推荐方式：使用封装脚本\n\n优先使用 `scripts/agnes_gen.py` 调用 API，脚本已内置以下能力：\n- **自动重试**：网络故障或服务端临时错误（429/5xx）最多自动重试 3 次，指数退避\n- **友好错误提示**：技术性错误自动翻译成大白话 + 明确的操作步骤\n- **自动下载到本地**：图片生成后立刻下载，不依赖临时 URL\n\n```bash\npython scripts/agnes_gen.py text2img --prompt \"一只可爱的猫\" --size 1024x1024\n```\n\n### 常见错误及大白话攻略\n\n脚本会根据错误类型给出对应提示，这里列出完整映射供参考：\n\n| 技术错误 | 大白话解释 | 怎么做 |\n|---------|-----------|--------|\n| `invalid_api_key` | API Key 无效 | 登录 agnes-ai.com 控制台重新复制 Key（sk-开头那种），或者直接用内置 Key |\n| `authentication_error` | 身份验证失败 | Key 可能复制漏了字符或已过期，重新获取一个试试；也可能是账户欠费 |\n| `rate_limit_exceeded` | 请求太频繁被限速了 | 等几十秒会自动重试，不用手动操作。下次可以把一次生成的张数设大一点 |\n| `model_not_found` | 模型名称不对或暂时下线 | 确认用的是 `agnes-image-2.1-flash`（文生图）或 `agnes-image-2.0-flash`（图生图） |\n| `invalid_image_format` | 图片格式有问题 | 只支持 JPG/PNG，检查文件是否损坏或链接能否正常打开 |\n| `prompt_too_long` | 描述内容太长了 | 精简一下，只留关键信息，一般中文 200 字以内没问题 |\n| `network_error` | 连不上服务器 | 检查自己网络，或者 Agnes 那边抽风了，脚本会自动重试 |\n| `timeout` | 请求超时 | 图片尺寸太大生成慢，试试 512x512；网络不好换个环境 |\n\n### 手动 curl 时的错误处理\n\n如果直接使用 curl（不用封装脚本），错误响应格式为：\n\n```json\n{\n  \"error\": {\n    \"message\": \"错误描述\",\n    \"type\": \"错误类型\",\n    \"code\": \"错误代码\"\n  }\n}\n```\n\n自行处理时参考上方表格，将技术错误翻译成用户能听懂的话，并且给出下一步怎么做。**不要只丢一个错误码给用户**。\n\n## 注意事项\n\n### 调用方式\n- **推荐使用封装脚本** `scripts/agnes_gen.py`，自带自动重试、友好错误提示、自动下载。比裸调 curl 省心很多\n- 支持自定义 API Key，用户可通过环境变量 `AGNES_API_KEY`、`--key` 参数、或直接提供\n- 默认使用内置 API Key，无需额外配置即可使用\n\n### 图片保存（重要）\n- ⚠️ **图片 URL 来自 Google Cloud Storage，有效期短（通常几小时到一天）**\n- ✅ **封装脚本已自动下载**，生成后图片立刻保存到本地，无需担心过期\n- ❌ 如果用裸 curl，必须在生成后立即用 PowerShell 或 Python 下载到本地\n\n### 品质优化\n- 中文 prompt 已优化，可直接使用中文描述，效果良好\n- 保存路径使用当前 workspace 目录（Windows 下自动适配）\n- 图生图功能需要先将图片转换为 base64 编码或提供可访问的 URL\n- 生成的图片可能包含 AI 生成的伪影，必要时可进行后期处理\n- **降低AI感**：在 prompt 中明确要求自然、真实、有纹理的特征，避免过度完美渲染\n- **中文配文质量**：强调字体清晰无重影，逻辑连贯，排版精美\n- **质量检查**：生成后务必检查文字清晰度和整体自然感，必要时调整 prompt 重新生成\n\n### 错误处理\n- **不要只丢技术错误码给用户**，翻译成大白话并给出解决步骤\n- 网络/服务端临时错误会自动重试 3 次，用户无感\n- 限速错误也会自动等待后重试\n\n## 最佳实践\n\n1. **明确需求**：在调用前明确是文生图还是图生图\n2. **优化 Prompt**：使用详细、具体的描述，避免模糊词汇\n3. **降低AI感**：在prompt中添加自然、真实、有纹理的描述，避免过度完美渲染\n4. **优化中文配文**：确保文字逻辑连贯，指定字体风格，强调清晰无重影\n5. **选择合适的尺寸**：根据用途选择合适的图片尺寸\n6. **批量生成**：需要多种方案时，使用 `n` 参数生成多张\n7. **及时保存**：生成后立即下载保存，避免 URL 过期\n8. **错误重试**：遇到错误时，根据错误类型采取相应措施\n9. **质量检查**：生成后重点检查文字清晰度和整体自然感\n\nFile v1.0.1:_meta.json\n\n{\n  \"ownerId\": \"kn7c4gc7gyy33s73k6rqq90yrs82tyky\",\n  \"slug\": \"agnes-image-gen\",\n  \"version\": \"1.0.1\",\n  \"publishedAt\": 1780652073758\n}\n\nFile v1.0.1:skill-card.md\n\n## Description: <br>\nUses Agnes AI image-generation models to create images from text prompts and edit existing images, with guidance for custom API keys, prompt quality, natural-looking outputs, and clearer Chinese text rendering. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[jiuwu2495](https://clawhub.ai/user/jiuwu2495) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and creative users use this skill to generate or edit images through Agnes AI models, including text-to-image prompts, image-to-image edits, style changes, and Chinese text layout refinement. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill handles reusable API keys and may expose credentials if users paste keys into chat. <br>\nMitigation: Prefer setting AGNES_API_KEY through the environment and avoid sharing long-lived keys directly in prompts. <br>\nRisk: Prompts and input images are sent to Agnes AI for generation or editing. <br>\nMitigation: Avoid confidential images, proprietary prompts, personal data, or material that should not be processed by a third-party image service. <br>\nRisk: The documented one-command wrapper script is referenced, but the artifact evidence contains only SKILL.md. <br>\nMitigation: Verify the wrapper script is present and reviewed before relying on the documented automated workflow. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/jiuwu2495/agnes-image-gen) <br>\n- [Agnes AI](https://agnes-ai.com) <br>\n- [Agnes image generations API](https://apihub.agnes-ai.com/v1/images/generations) <br>\n- [Agnes image edits API](https://apihub.agnes-ai.com/v1/images/edits) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance, files] <br>\n**Output Format:** [Markdown guidance with shell commands and generated image files or image URLs] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May require an AGNES_API_KEY and may send prompts or images to Agnes AI.] <br>\n\n## Skill Version(s): <br>\n1.0.1 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nArchive v1.0.0: 3 files, 8032 bytes\n\nFiles: skill-card.md (2424b), SKILL.md (16694b), _meta.json (134b)\n\nFile v1.0.0:SKILL.md\n\n---\nname: agnes-image-gen\ndescription: 使用 Agnes AI 的图片生成模型生成图片，支持文生图（agnes-image-2.1-flash）和图生图（agnes-image-2.0-flash）。支持自定义 API Key，用户可使用自己的 Agnes Key。优化重点：降低AI生成图片的\"AI感\"，增强自然真实感；优化中文配文逻辑连贯性、字体排版精美度，避免文字重影重叠。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度。\nagent_created: true\n---\n\n# Agnes Image Gen\n\n## 概述\n\n调用 Agnes AI 的图片生成模型，支持两种模式：\n- **文生图**：使用 `agnes-image-2.1-flash` 模型，根据文本描述生成图片\n- **图生图**：使用 `agnes-image-2.0-flash` 模型，基于现有图片进行编辑和风格转换\n\n通过 curl 直接调用 HTTP API，不走 WorkBuddy 的对话模型机制，因此**不消耗对话积分**。\n\n## API Key 配置\n\n### 默认 API Key\n技能内置了一个默认 API Key，可直接使用，无需额外配置。\n\n### 自定义 API Key\n用户可以使用自己的 Agnes API Key，优先级高于默认 Key。\n\n**设置方式**：\n1. **环境变量**（推荐）：设置环境变量 `AGNES_API_KEY`\n   ```bash\n   # Windows PowerShell\n   $env:AGNES_API_KEY = \"your-api-key-here\"\n   \n   # Linux/macOS\n   export AGNES_API_KEY=\"your-api-key-here\"\n   ```\n\n2. **直接指定**：在调用时明确告知使用自己的 API Key\n   - 用户说：「用我的 Agnes Key 生成图片，Key 是 sk-xxx」\n   - AI 应使用用户提供的 Key\n\n**API Key 优先级**：\n1. 用户明确提供的 Key → 最高优先级\n2. 环境变量 `AGNES_API_KEY` → 次优先级\n3. 技能内置默认 Key → 最低优先级（兜底）\n\n**API Key 格式**：\n- 通常以 `sk-` 开头\n- 长度约 48-64 个字符\n- 示例：`sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz`\n\n### 获取 API Key\n访问 [Agnes AI 官网](https://agnes-ai.com) 注册账号后，在控制台获取 API Key。\n\n## 触发条件\n\n当用户提出以下请求时加载本 skill：\n- 「用 Agnes 生成一张……的图片」\n- 「用 Agnes 画……」\n- 「Agnes 图片生成」\n- 「用这张图片生成……」（图生图）\n- 「把这张图片改成……风格」（图生图）\n- 明确要求使用 Agnes API 进行文生图或图生图\n\n## 模型选择指南\n\n### agnes-image-2.1-flash（文生图）\n- **用途**：根据文本描述生成全新图片\n- **特点**：生成速度快，支持多种风格\n- **适用场景**：海报设计、插画创作、概念图生成\n\n### agnes-image-2.0-flash（图生图）\n- **用途**：基于现有图片进行编辑、风格转换、元素修改\n- **特点**：保持原图构图，支持局部修改和整体风格转换\n- **适用场景**：图片风格化、背景替换、元素添加/删除\n\n## 工作流程\n\n### 1. 文生图（agnes-image-2.1-flash）\n\n```bash\n# AGNES_API_KEY 应替换为实际的 API Key（用户提供的、环境变量中的、或内置默认值）\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"<用户描述的图片内容>\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n**支持参数说明：**\n- `model`: 固定为 `agnes-image-2.1-flash`\n- `prompt`: 图片描述（支持中英文，中文效果已优化）\n- `n`: 生成张数，默认为 1，最多支持 4 张\n- `size`: 图片尺寸，支持 `1024x1024`、`1024x768`、`768x1024`、`512x512`\n\n### 2. 图生图（agnes-image-2.0-flash）\n\n```bash\n# AGNES_API_KEY 应替换为实际的 API Key\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"<base64编码的图片数据或图片URL>\",\n    \"prompt\": \"<编辑指令描述>\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n**支持参数说明：**\n- `model`: 固定为 `agnes-image-2.0-flash`\n- `image`: 原始图片（支持 base64 编码或 URL）\n- `prompt`: 编辑指令（支持中英文）\n- `n`: 生成张数，默认为 1\n- `size`: 输出图片尺寸\n\n### 3. 响应处理\n\nAPI 响应格式示例：\n```json\n{\n  \"created\": 1780468823,\n  \"data\": [{\n    \"url\": \"https://storage.googleapis.com/agnes-aigc-test/images/...\",\n    \"revised_prompt\": \"优化后的提示词（如有）\"\n  }],\n  \"usage\": {\n    \"total_tokens\": 0\n  }\n}\n```\n\n从 `data[0].url` 提取图片 URL。\n\n### 4. 下载图片到本地\n\n**Windows 环境**使用 PowerShell 下载：\n\n```powershell\nInvoke-WebRequest -Uri \"<图片URL>\" -OutFile \"<保存路径>/agnes_output.png\"\n```\n\n或使用 Python（跨平台）：\n\n```python\nimport urllib.request\nimport os\nfrom datetime import datetime\n\n# 生成带时间戳的文件名\ntimestamp = datetime.now().strftime(\"%Y%m%d_%H%M%S\")\nsave_path = os.path.join(\"<当前workspace路径>\", f\"agnes_{timestamp}.png\")\nurllib.request.urlretrieve(url, save_path)\n```\n\n若下载失败，可改用 HTML 页面直接引用远程 URL（图片通过 `<img>` 加载），再叠加 CSS 文字制成海报。\n\n### 5. 展示给用户\n\n- 调用 `preview_url` 展示图片文件\n- 调用 `deliver_attachments` 交付图片附件\n\n## 调用示例\n\n### 示例 1：生成产品海报（文生图）\n\n**用户请求**：「用 Agnes 生成一张科技感十足的产品发布会海报，主题是AI助手」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"科技感产品发布会海报，主题是AI助手，未来主义风格，蓝色调， holographic效果，现代简约设计\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 2：生成多张不同风格（文生图）\n\n**用户请求**：「生成3张不同风格的咖啡店logo」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"咖啡店logo设计，简约现代风格，咖啡杯元素，温暖色调\",\n    \"n\": 3,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 3：图片风格转换（图生图）\n\n**用户请求**：「把这张照片改成赛博朋克风格」\n\n**准备工作**：\n```python\nimport base64\nimport urllib.request\n\n# 读取本地图片并转换为 base64\nwith open(\"input_image.jpg\", \"rb\") as image_file:\n    encoded_string = base64.b64encode(image_file.read()).decode('utf-8')\n```\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"data:image/jpeg;base64,<base64编码数据>\",\n    \"prompt\": \"转换为赛博朋克风格，霓虹灯光效，未来科技感，暗色调，高对比度\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 4：图片元素修改（图生图）\n\n**用户请求**：「把图片中的天空改成星空」\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/edits\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.0-flash\",\n    \"image\": \"https://example.com/original_image.jpg\",\n    \"prompt\": \"将天空替换为璀璨星空，银河清晰可见，深蓝色调\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n### 示例 5：中文文本优化示例\n\n**用户请求**：「生成一张带有\"新年快乐\"字样的贺卡」\n\n**优化后的 prompt**：\n```\n精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\n```\n\n**调用命令**：\n```bash\ncurl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $AGNES_API_KEY\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"精美新年贺卡设计，主视觉为\"新年快乐\"艺术字体，金色书法风格，红色背景，烟花装饰，喜庆氛围，中国传统元素，高清精致\",\n    \"n\": 1,\n    \"size\": \"1024x1024\"\n  }'\n```\n\n## 中文文本生成优化\n\n### 最佳实践\n\n1. **详细描述**：提供尽可能详细的描述，包括风格、颜色、氛围、元素等\n2. **关键词组合**：使用逗号分隔多个关键词，如「科技感, 蓝色调, 未来主义, 简约设计」\n3. **风格指定**：明确指定艺术风格，如「水彩画风格」「像素艺术」「3D渲染」\n4. **质量修饰词**：添加质量相关的描述，如「高清」「精致」「专业级」\n5. **构图指导**：描述构图方式，如「居中构图」「对称设计」「留白艺术」\n\n### 中文 Prompt 模板\n\n**产品海报**：\n```\n[产品类型]海报设计，[主题描述]，[风格]，[色调]，[氛围]，[装饰元素]，[质量描述]\n```\n\n**插画创作**：\n```\n[场景描述]，[人物/物体]，[动作/状态]，[艺术风格]，[色彩搭配]，[光影效果]，[细节描述]\n```\n\n**Logo 设计**：\n```\n[品牌/公司]logo设计，[核心元素]，[设计风格]，[色彩方案]，[象征意义]，[应用场景]\n```\n\n### 常见问题解决\n\n**问题1**：中文字符显示不清晰\n**解决方案**：在 prompt 中强调「清晰中文字体」「可读性」「高对比度」\n\n**问题2**：生成的图片不符合预期\n**解决方案**：使用更具体的描述，避免模糊词汇，添加「精确」「准确」等修饰词\n\n**问题3**：需要特定风格\n**解决方案**：明确指定风格名称，如「中国风水彩」「日系动漫」「欧美卡通」\n\n## 降低AI感与优化中文配文\n\n### 核心目标\n生成更自然、更少AI味的图片，同时确保中文配文逻辑连贯、字体排版精美、无重影重叠。\n\n### 降低AI感的关键技巧\n\n#### 1. 增加自然与真实感描述\n在 prompt 中添加以下关键词，引导模型生成更自然、有纹理、不完美的图像：\n- **自然元素**：自然光线、有机形态、不规则纹理、真实质感、生活气息\n- **避免AI特征**：避免过度完美、过度对称、过度光滑、过度渲染\n- **细节丰富**：添加微小瑕疵、自然磨损、环境痕迹、光影变化\n\n**示例 prompt 优化**：\n- 原始：`科技感产品海报，蓝色调，未来主义风格`\n- 优化：`科技感产品海报，蓝色调，未来主义风格，自然光线下的真实质感，有机形态设计，避免过度光滑渲染，带有细微环境纹理`\n\n#### 2. 指定真实世界参考\n使用真实世界中的风格、材质、场景作为参考：\n- `真实照片风格，非数字渲染`\n- `手工绘制质感，带有笔触痕迹`\n- `胶片摄影颗粒感，自然色彩还原`\n- `实物拍摄，非3D建模`\n\n#### 3. 避免典型AI生成模式\n明确排除常见的AI生成特征：\n- `避免过度完美对称`\n- `避免不自然的光滑表面`\n- `避免不真实的颜色饱和度`\n- `避免机械感过强的几何形状`\n\n### 优化中文配文的关键技巧\n\n#### 1. 逻辑连贯性\n确保配文内容逻辑清晰、语义连贯：\n- **明确主题**：清晰定义图片要表达的核心信息\n- **结构化描述**：使用主谓宾结构，避免碎片化关键词堆砌\n- **上下文关联**：确保文字与图片内容紧密相关\n\n**示例**：\n- 原始：`新年快乐，红色背景，烟花`\n- 优化：`一张温馨的新年贺卡，主视觉为手写体\"新年快乐\"，红色背景上绽放着金色烟花，整体传达喜庆与祝福的氛围`\n\n#### 2. 字体排版精美\n指定字体风格和排版要求，确保文字美观易读：\n- **字体风格**：书法体、手写体、印刷体、艺术字\n- **排版要求**：清晰可读、层次分明、布局合理\n- **质量强调**：高清锐利、无模糊、无锯齿\n\n**示例 prompt 添加**：\n```\n主视觉为\"新年快乐\"高清书法字体，笔触清晰锐利，无重影无重叠，字体边缘干净利落，专业排版设计\n```\n\n#### 3. 避免文字重影与重叠\n明确要求文字清晰，避免常见问题：\n- **清晰度要求**：字体清晰锐利，无模糊、无重影\n- **布局要求**：文字位置合理，不与其他元素重叠\n- **对比度要求**：文字与背景对比鲜明，易于阅读\n\n**示例 prompt 添加**：\n```\n文字清晰锐利，无重影无重叠，字体边缘干净，与背景对比鲜明，专业排版无错位\n```\n\n### 综合优化 Prompt 模板\n\n#### 带文字的图片生成模板：\n```\n[场景/主题描述]，[风格/艺术形式]，[色调/氛围]，[主要文字内容]使用[字体风格]清晰展示，字体高清锐利无重影无重叠，[自然/真实感描述]，[避免AI特征]，[质量描述]\n```\n\n#### 示例：优化后的新年贺卡 prompt\n```\n温馨的新年贺卡设计，手绘插画风格，暖色调，主视觉为\"新年快乐\"高清书法字体，笔触清晰锐利无重影无重叠，自然光线下带有纸张纹理质感，避免过度完美渲染，整体传达喜庆与祝福的氛围，专业排版设计，高清精致\n```\n\n### 测试与迭代建议\n\n1. **对比测试**：生成多个版本，对比AI感与自然感\n2. **文字检查**：重点检查文字是否清晰、有无重影重叠\n3. **细节观察**：检查纹理、光影、瑕疵是否自然\n4. **迭代优化**：根据结果调整prompt中的关键词权重\n\n## 错误处理\n\n### 常见错误及解决方案\n\n**错误1**：`model_not_found`\n- **原因**：模型名称错误或不可用\n- **解决**：检查模型名称是否正确，确认使用 `agnes-image-2.1-flash` 或 `agnes-image-2.0-flash`\n\n**错误2**：`rate_limit_exceeded`\n- **原因**：API 调用频率过高\n- **解决**：等待一段时间后重试，或减少并发请求\n\n**错误3**：`invalid_image_format`\n- **原因**：图片格式不支持或 base64 编码错误\n- **解决**：确保图片为 JPEG/PNG 格式，base64 编码正确\n\n**错误4**：`prompt_too_long`\n- **原因**：提示词过长\n- **解决**：精简提示词，保留关键描述\n\n**错误5**：`invalid_api_key` 或 `authentication_error`\n- **原因**：API Key 无效、过期或格式错误\n- **解决**：\n  1. 检查 API Key 是否正确复制（以 `sk-` 开头）\n  2. 确认 API Key 是否过期，登录 Agnes 控制台重新获取\n  3. 如果使用自定义 Key 失败，可尝试使用内置默认 Key\n\n### 错误响应格式\n\n```json\n{\n  \"error\": {\n    \"message\": \"错误描述\",\n    \"type\": \"错误类型\",\n    \"code\": \"错误代码\"\n  }\n}\n```\n\n## 注意事项\n\n- 支持自定义 API Key，用户可通过环境变量或直接提供自己的 Key\n- 默认使用内置 API Key，无需额外配置即可使用\n- 图片 URL 来自 Google Cloud Storage，有访问时效，应尽快下载到本地\n- 若 API 返回错误（如 `model_not_found`、`rate_limit`），如实报告给用户，不做猜测\n- 中文 prompt 已优化，可直接使用中文描述，效果良好\n- 保存路径使用当前 workspace 目录（Windows 下自动适配）\n- 图生图功能需要先将图片转换为 base64 编码或提供可访问的 URL\n- 生成的图片可能包含 AI 生成的伪影，必要时可进行后期处理\n- **降低AI感**：在prompt中明确要求自然、真实、有纹理的特征，避免过度完美渲染\n- **中文配文质量**：强调字体清晰无重影，逻辑连贯，排版精美\n- **质量检查**：生成后务必检查文字清晰度和整体自然感，必要时调整prompt重新生成\n\n## 最佳实践\n\n1. **明确需求**：在调用前明确是文生图还是图生图\n2. **优化 Prompt**：使用详细、具体的描述，避免模糊词汇\n3. **降低AI感**：在prompt中添加自然、真实、有纹理的描述，避免过度完美渲染\n4. **优化中文配文**：确保文字逻辑连贯，指定字体风格，强调清晰无重影\n5. **选择合适的尺寸**：根据用途选择合适的图片尺寸\n6. **批量生成**：需要多种方案时，使用 `n` 参数生成多张\n7. **及时保存**：生成后立即下载保存，避免 URL 过期\n8. **错误重试**：遇到错误时，根据错误类型采取相应措施\n9. **质量检查**：生成后重点检查文字清晰度和整体自然感\n\nFile v1.0.0:_meta.json\n\n{\n  \"ownerId\": \"kn7c4gc7gyy33s73k6rqq90yrs82tyky\",\n  \"slug\": \"agnes-image-gen\",\n  \"version\": \"1.0.0\",\n  \"publishedAt\": 1780541212821\n}\n\nFile v1.0.0:skill-card.md\n\n## Description: <br>\nGenerates and edits images with Agnes AI text-to-image and image-to-image models, with guidance for API key handling, prompt construction, and saving results. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[jiuwu2495](https://clawhub.ai/user/jiuwu2495) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nDevelopers and creative users use this skill to call Agnes AI for image generation or image editing from an agent, then retrieve and present the resulting image. It is useful for posters, illustrations, logos, style transfers, and Chinese text prompt refinement. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Prompts and edited source images may be sent to Agnes AI. <br>\nMitigation: Use the skill only when third-party image processing is acceptable, and avoid submitting private or sensitive images. <br>\nRisk: API keys are sensitive, and the skill supports direct key entry and a shared built-in fallback key. <br>\nMitigation: Prefer AGNES_API_KEY as an environment variable, avoid pasting real API keys into chat, and do not rely on a shared built-in key for private or accountable work. <br>\nRisk: Generated images may contain artifacts or unclear rendered text. <br>\nMitigation: Review generated images before use, especially images with text, and regenerate or post-process when quality is insufficient. <br>\n\n\n## Reference(s): <br>\n- [Agnes AI](https://agnes-ai.com) <br>\n- [Agnes AI image generations endpoint](https://apihub.agnes-ai.com/v1/images/generations) <br>\n- [Agnes AI image edits endpoint](https://apihub.agnes-ai.com/v1/images/edits) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [guidance, shell commands, code, configuration, text] <br>\n**Output Format:** [Markdown with curl commands, JSON response examples, and small Python or PowerShell snippets.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May produce image URLs or local image files when Agnes AI API calls succeed.] <br>\n\n## Skill Version(s): <br>\n1.0.0 (source: server release evidence) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>","readmeExcerpt":"Skill: agnes-图片生成 Owner: jiuwu2495 Summary: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。 Tags: latest:1.0.3 Version history: v1.0.3 | 2026-07-30T03:30:31.493Z | user - Added automatic dual-endpoint failover: the system now tries a dome","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"-H \"Authorization: Bearer YOUR_API_KEY\"\n-H \"Content-Type: application/json\""},{"language":"bash","snippet":"curl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{"},{"language":"bash","snippet":"curl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"<用户描述的图片内容>\",\n    \"size\": \"2K\",\n    \"ratio\": \"1:1\",\n    \"extra_body\": {\n      \"response_format\": \"url\"\n    }\n  }'"},{"language":"bash","snippet":"curl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{"},{"language":"bash","snippet":"curl -s -X POST \"https://apihub.agnes-ai.com/v1/images/generations\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer sk-8Rzd2yCbFzOi1vxojseH8C5D8w3u4aMdNWsPNzxk0G7339Cz\" \\\n  -d '{\n    \"model\": \"agnes-image-2.1-flash\",\n    \"prompt\": \"将白天街道场景改为电影级赛博朋克夜景，添加霓虹招牌和湿滑路面倒影，保留原始街道布局与建筑形状\",\n    \"size\": \"2K\",\n    \"extra_body\": {\n      \"image\": [\"https://example.com/input-image.png\"],\n      \"response_format\": \"url\"\n    }\n  }'"},{"language":"json","snippet":"{\n  \"created\": 1780000000,\n  \"data\": [{\n    \"url\": \"https://storage.googleapis.com/agnes-aigc/xxx.png\",\n    \"b64_json\": null,\n    \"revised_prompt\": null\n  }]\n}"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: agnes-image-gen\ndescription: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。\nagent_created: true\n---\n\n# Agnes Image Gen\n\n## 概述\n\n调用 Agnes AI 的升级版图像生成模型 **`agnes-image-2.1-flash`**（Sapiens AI 出品）。该模型同时支持：\n\n- **文生图（Text-to-Image）**：根据文本提示词生成全新图像\n- **图生图（Image-to-Image）**：基于输入图像进行转换、重绘、风格化编辑，并尽量保留原始构图\n\n通过 curl 直接调用 HTTP API，不走 WorkBuddy 的对话模型机制，因此**不消耗对话积分**。当前图像生成定价为 **$0 / 张**。\n\n## 触发条件\n\n当用户提出以下请求时加载本 skill：\n- 「用 Agnes 生成一张……的图片」\n- 「用 Agnes 画……」\n- 「Agnes 图片生成」\n- 「用这张图片生成……」「把这张图片改成……风格」「给这张图换个背景」（图生图）\n- 明确要求使用 Agnes API 进行文生图或图生图\n\n## 核心能力\n\n- **高信息密度图像**：适合复杂场景、丰富构图、多层视觉元素（精细场景、复杂环境、丰富构图）\n- **构图保留**：图生图编辑时尽量保留原始构图与主体布局\n- **灵活尺寸控制**：使用 `1K` / `2K` / `3K` / `4K` 档位，配合宽高比\n- **URL / Base64 输出**：支持图像 URL 或 Base64 数据返回\n- **适用场景**：创意设计、营销内容、产品可视化、社交媒体素材、图像转换（风格迁移 / 场景重打光 / 背景变换）\n\n## API Reference\n\n### Endpoint（双端点容灾）\n\n脚本自动按以下顺序尝试，前一个访问不了就切到下一个，**无需手动干预**：\n\n| 优先级 | Endpoint | 说明 |\n|--------|----------|------|\n| 1（主） | `https://apihub.agnes-ai.com/v1/images/generations` | 国际主端点 |\n| 2（容灾） | `https://apihub.agnes-ai.cn/v1/images/generations` | **国内容灾端点**：主端点 TCP 不可达时自动切换（国内网络访问 Agnes 更稳） |\n\n- 调用前会做轻量连通性探测（TCP 层，8s 超时），主端点不可达时**立即跳过**而非空等，再尝试国内网关。\n- 端点可达但请求失败（限速/5xx）会在该端点内重试，耗尽后才跳到下一端点。\n- 运行结束会打印「本次使用: <实际端点>」，方便确认走的是哪个。\n\n> 注意：文生图与图生图**共用同一端点** `/v1/images/generations`，不再使用 `/v1/images/edits`。\n\n### 请求头\n\n```\n-H \"Authorization: Bearer YOUR_API_KEY\"\n-H \"Content-Type: application/json\"\n```\n\n### 请求参数\n\n| 参数 | 类型 | 必填 | 说明 |\n|------|------|------|------|\n| `model` | string | 是 | 模型名称，固定为 `agnes-image-2.1-flash` |\n| `prompt` | string | 是 | 图像生成或图像编辑的文本指令 |\n| `size` | string | 是 | 输出尺寸档位，推荐 `1K` / `2K` / `3K` / `4K`；兼容 `1024x768` 这类历史精确写法（不支持的尺寸可能被标准化） |\n| `ratio` | string | 否 | 与档位式 `size` 配合的宽高比，支持 `1:1`、`3:4`、`4:3`、`16:9`、`9:16`、`2:3`、`3:2`、`21:9`，默认 `1:1` |\n| `image` | string[] | 图生图必填 | 输入图像数组（**注意：放在 `extra_body.image` 中**，见下方图生图示例） |\n| `return_base64` | boolean | 否 | 文生图需要以 Base64 返回时设为 `true` |\n| `extra_body` | object | 否 | 高级工作流附加参数（见下） |\n| `extra_body.response_format` | string | 否 | 输出格式：`url` 或 `b64_json` |\n| `extra_body.image` | string[] | 图生图必填 | 输入图像数组，支持公共图像 URL 或 `data:image/...;base64,...` Data URI |\n\n### 尺寸与宽高比（输出尺寸参考）\n\n为获得可预期的输出尺寸，建议将 `size` 与 `ratio` 配合使用：\n\n| Ratio | 1K | 2K | 3K | 4K |\n|-------|-----|-----|-----|-----|\n| `1:1` | 1024x1024 | 2048x2048 | 3072x3072 | 4096x4096 |\n| `3:4` | 864x1152 | 1728x2304 | 2592x3456 | 3456x4608 |\n| `4:3` | 1152x864 | 2304x1728 | 3456x2592 | 4608x3456 |\n| `16:9` | 1312x736 | 2624x1472 | 3936x2208 | 5248x2944 |\n| `9:16` | 736x1312 | 1472x2624 | 2208x3936 | 2944x5248 |\n| `2:3` | 832x1248 | 1664x2496 | 2496x3744 | 3328x4992 |\n| `3:2` | 1248x832 | 2496x1664 | 3744x2496 | 4992x3328 |\n| `21:9` | 1568x672 | 3136x1344 | 4704x2016 | 6272x2688 |\n\n> 若请求 `1920x1080` / `2560x1440` 这类非原生精确尺寸，服务会自动映射到最接近的档位与宽高比（如 16:9 的 `1K` 输出为 `1312x736`）。"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7c4gc7gyy33s73k6rqq90yrs82tyky\",\n  \"slug\": \"agnes-image-gen\",\n  \"version\": \"1.0.3\",\n  \"publishedAt\": 1785382231493\n}"},{"path":"skill-card.md","content":"## Description:\n\nAgnes Image Gen helps agents generate and edit images with Agnes AI, supporting text-to-image and image-to-image prompts, size selection, endpoint failover, and local result saving.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[jiuwu2495](https://clawhub.ai/user/jiuwu2495)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to request creative, marketing, product visualization, social media, and image transformation assets through Agnes text-to-image or image-to-image workflows.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill ships with and automatically uses a hardcoded Agnes API key.\n\nMitigation: Remove the embedded key, rotate it as compromised, and require a user-provided key through a secure environment variable or explicit per-run configuration.\n\nRisk: Prompts and selected local images are sent to Agnes servers for generation or editing.\n\nMitigation: Warn users before use and avoid sending confidential prompts, private images, or regulated data unless the deployment has approved Agnes for that data.\n\nRisk: Generated outputs may be saved locally and returned image URLs may be time-limited.\n\nMitigation: Disclose saved file locations, apply local file handling policy, and download required results promptly.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/jiuwu2495/skills/agnes-image-gen)\n- [Agnes AI](https://agnes-ai.com)\n- [Agnes image generations endpoint](https://apihub.agnes-ai.com/v1/images/generations)\n- [Agnes image generations fallback endpoint](https://apihub.agnes-ai.cn/v1/images/generations)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown guidance with shell commands, JSON API responses, generated image URLs, and local file paths]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save generated PNG files locally and may return time-limited image URLs or base64 image data.]\n\n## Skill Version(s):\n\n1.0.3 (source: server release metadata)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。 Skill: agnes-图片生成 Owner: jiuwu2495 Summary: 使用 Agnes AI 升级版图像生成模型 agnes-image-2.1-flash 生成图片。同时支持文生图（text-to-image）与图生图（image-to-image）。当用户说「用 Agnes 生成图片」「用 Agnes 画一张」「Agnes 生成」「用这张图生成/改成……」或明确要求使用 Agnes API 进行文生图/图生图时，加载本 skill。不消耗 WorkBuddy 积分，仅消耗 Agnes API 额度（当前图像生成免费）。 Tags: latest:1.0.3 Version history: v1.0.3 | 2026-07-30T03:30:31.493Z | user - Added automatic dual-endpoint failover: the system now tries a dome","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":983,"uniquenessScore":53,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-10T21:59:13.537Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T00:33:23.233Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}