用途:用 Agnes Image 2.1 Flash 模型生成或转换图像,支持文生图(text-to-image)和图生图(image-to-image)。
凭据规则:从环境变量读取 API 密钥,不要将密钥硬编码到提示词、脚本、技能文件、提交记录或 shell 历史中。首选变量:export AGNES_API_KEY="...";辅助脚本也接受 AGNES_TOKEN 作为回退。
快速开始(文生图): python3 scripts/agnes_image.py generate --prompt "A luminous floating city above a misty canyon at sunrise, cinematic realism" --size 1024x768 --output-dir ./outputs/agnes-free-image
图生图(使用公开图片 URL): python3 scripts/agnes_image.py generate --prompt "Transform the scene into a rain-soaked cyberpunk night while preserving the composition" --image-url "https://example.com/input.png" --size 1024x768 --output-dir ./outputs/agnes-free-image
不调用 API 校验请求结构: python3 scripts/agnes_image.py generate --prompt "A detailed AI workflow dashboard poster, clean editorial style" --size 1024x1024 --dry-run
提示词结构:文生图使用 [Subject] + [Scene / Environment] + [Style] + [Lighting] + [Composition] + [Quality Requirements];图生图需同时说明应改变和应保持不变的内容。
工作流:判断是文生图还是图生图;把模糊的视觉需求转成含主体、环境、风格、光照、构图与细节程度的具体提示词;使用 scripts/agnes_image.py generate,复杂提示词或参考图建议先用 --dry-run;当响应包含可下载 URL 时,用 --output-dir 将返回的图片 URL 保存到本地;需要原始响应结构或高级参数时阅读 references/api.md。
说明:端点 POST https://apihub.agnes-ai.com/v1/images/generations,模型 agnes-image-2.1-flash,辅助脚本默认尺寸 1024x768;图生图输入图片必须可通过 URL 访问,并以 extra_body.image 发送;辅助脚本通过 extra_body.response_format: "url" 请求 URL 响应。
限制:图生图要求输入图片为 URL 可访问形式;未提供免费额度、价格、速率限制或支持的更多尺寸等细节。