Agnes Ai
/install agnes-ai
name: agnes-ai description: Wraps the Agnes AI API for image and video generation. Use when the user asks to generate images, pictures, photos, or videos with Agnes AI. Two image models: agnes-image-2.0-flash (image-to-image, multi-image) and agnes-image-2.1-flash (high-density text-to-image). OpenAI-compatible protocol. Requires an API key provided on first use.
Agnes AI — Image & Video Generation
Overview
Agnes AI provides image and video generation models accessible through an OpenAI-compatible HTTP API. Use this skill whenever the user wants to generate images or videos with Agnes AI.
- API Base URL:
https://apihub.agnes-ai.com/v1 - Auth: Bearer token (
AGNES_API_KEY) - Protocol: OpenAI-compatible request/response format
Model Selection
| User Intent | Model | Endpoint |
|---|---|---|
| Generate images from text (high info density preferred) | agnes-image-2.1-flash |
POST /v1/images/generations |
| Edit/existing image, image-to-image, multi-image composition | agnes-image-2.0-flash |
POST /v1/images/generations |
| Generate videos, clips, animations | agnes-video-v2.0 |
POST /v1/video/generations |
Model choice guidance:
- Default to
agnes-image-2.1-flashfor text-to-image (better high-information-density output) - Use
agnes-image-2.0-flashwhen the user provides an input image for editing, style transfer, or multi-image composition - If unsure, ask the user which model they prefer, or default to
agnes-image-2.1-flashfor text-to-image
API Key Setup
IMPORTANT: Before any image or video generation, you MUST check for the API key. Do NOT proceed to call the API without a valid key. This check happens the first time the user asks you to generate something with Agnes (not during skill installation).
Checking for the Key
When the skill is triggered (user asks to generate an image/video), check these locations in order:
- Environment variable
AGNES_API_KEY - File
~/.agnes-ai/api_key
If No Key Found
Immediately stop and ask the user:
要使用 Agnes AI 生成功能,需要先配置 API Key。请提供你的 Agnes AI API Key,我会安全存储在本地。 (获取方式:登录 https://apihub.agnes-ai.com 后在控制台查看)
Do NOT attempt to call the API without a key.
Saving the Key
Save the key the user provides by writing it to ~/.agnes-ai/api_key (plain text, no trailing newline).
Then set the environment variable for the current session:
mkdir -p ~/.agnes-ai
echo -n "sk-your-key-here" > ~/.agnes-ai/api_key
export AGNES_API_KEY="sk-your-key-here"
After saving, proceed with the generation request.
Never echo or log the API key value in any user-visible output.
Image Generation
Trigger: user asks to generate / create / make an image, picture, photo, illustration, poster, or visual with Agnes.
Model Selection Logic
- If the user provides an input image (image-to-image, editing, style transfer) → use
agnes-image-2.0-flash - If the user wants multi-image composition → use
agnes-image-2.0-flash - Default (text-to-image) → use
agnes-image-2.1-flash
Call the API
Use the bundled script (scripts/generate.py in the same directory as this SKILL.md) for reliable execution.
The script requires Python3 (standard library only, no dependencies):
# Text-to-image (agnes-image-2.1-flash, default)
python3 scripts/generate.py image \
--prompt "\x3Cprompt>" \
--size "\x3Csize>" \
--output "\x3Coutput_path>"
# Image-to-image (agnes-image-2.0-flash)
python3 scripts/generate.py image \
--prompt "\x3Cprompt>" \
--image "\x3Cinput_image_url_or_path>" \
--size "\x3Csize>" \
--output "\x3Coutput_path>"
# Multi-image composition (agnes-image-2.0-flash)
python3 scripts/generate.py image \
--prompt "\x3Cprompt>" \
--image "url1" "url2" \
--size "\x3Csize>" \
--output "\x3Coutput_path>"
Or call the API directly with curl:
# Text-to-image (agnes-image-2.1-flash)
curl -s -X POST "https://apihub.agnes-ai.com/v1/images/generations" \
-H "Authorization: Bearer $AGNES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "agnes-image-2.1-flash",
"prompt": "\x3Cprompt>",
"size": "\x3Csize>"
}'
# Image-to-image (agnes-image-2.0-flash)
curl -s -X POST "https://apihub.agnes-ai.com/v1/images/generations" \
-H "Authorization: Bearer $AGNES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "agnes-image-2.0-flash",
"tags": ["img2img"],
"prompt": "\x3Cprompt>",
"size": "\x3Csize>",
"extra_body": {
"image": ["\x3Cinput_image_url>"],
"response_format": "url"
}
}'
Parameters
| Parameter | Description | Default |
|---|---|---|
prompt |
Text description of the desired image (required) | — |
size |
Image dimensions. Supported: 1024x1024, 1792x1024, 1024x1792 |
1024x1024 |
n |
Number of images to generate | 1 |
extra_body.image |
Input image URL(s) for image-to-image or multi-image tasks | — |
tags |
Task type tag, e.g. ["img2img"] for image-to-image |
— |
Recommended Prompt Structure
[Subject] + [Scene / Environment] + [Style] + [Lighting] + [Composition] + [Quality Requirements]
Example:
A luminous floating city above a misty canyon at sunrise, cinematic realism, wide-angle composition, rich architectural details, soft golden light, high visual density
For image-to-image, also describe what to change AND what to preserve:
Transform the scene into a rain-soaked cyberpunk night with neon reflections while preserving the original composition and main subject layout.
Response Handling
The API returns an OpenAI-compatible response:
{
"data": [
{
"url": "https://..."
}
],
"usage": {
"generated_images": 1
}
}
The url field contains a temporary download link. Download the image with curl or wget and save locally.
If b64_json is present, decode it with base64 -d to get the raw image bytes.
After saving the image file locally, deliver it to the user — display a preview if your platform supports it, or attach the file to your response. Tell the user where the file was saved.
Video Generation
Trigger: user asks to generate / create / make a video, clip, animation, or motion content with Agnes.
Call the API
Use the bundled script (scripts/generate.py in the same directory as this SKILL.md`):
python3 scripts/generate.py video \
--prompt "\x3Cprompt>" \
--duration \x3Cseconds> \
--output "\x3Coutput_path>"
Or call the API directly with curl:
curl -s -X POST "https://apihub.agnes-ai.com/v1/video/generations" \
-H "Authorization: Bearer $AGNES_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "agnes-video-v2.0",
"prompt": "\x3Cprompt>",
"duration": \x3Cseconds>
}'
Parameters
| Parameter | Description | Default |
|---|---|---|
prompt |
Text description of the desired video (required) | — |
duration |
Video duration in seconds | 5 |
Response Handling
Video generation is asynchronous. The API returns a task ID:
{
"id": "task_abc123",
"status": "processing"
}
Poll for completion:
curl -s "https://apihub.agnes-ai.com/v1/video/generations/\x3Ctask_id>" \
-H "Authorization: Bearer $AGNES_API_KEY"
When status becomes completed, the response contains a url or output field with the video download link.
Download it and deliver to the user.
The bundled scripts/generate.py script handles polling automatically — prefer using it over raw curl.
Supported Image Sizes
1024x1024— square (default)1792x1024— landscape1024x1792— portrait
Error Handling
If the API returns a non-200 status:
- Check that the API key is valid and has not expired
- Verify the prompt is not empty and does not violate content policy
- If the error persists, tell the user the error message and suggest checking their Agnes AI dashboard
After Generation
After successfully generating and saving an image or video file:
- Tell the user the file path and deliver/attach the file to them
- For images: show a preview or display the file if your platform supports inline rendering
- For videos: provide a way for the user to view or download the file
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install agnes-ai - 安装完成后,直接呼叫该 Skill 的名称或使用
/agnes-ai触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Agnes Ai 是什么?
Generate images or videos via Agnes AI API using user-provided prompts, handling API key setup, file download, and asynchronous video status polling. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 66 次。
如何安装 Agnes Ai?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install agnes-ai」即可一键安装,无需额外配置。
Agnes Ai 是免费的吗?
是的,Agnes Ai 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Agnes Ai 支持哪些平台?
Agnes Ai 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Agnes Ai?
由 Song Xianfeng(@songxf1024)开发并维护,当前版本 v1.0.3。