Skip to main content
skill CX Codex

agnes-ai-generation — Claude Code skill: what it does, how to install

Calls Agnes and Sapiens AI generation APIs for text, images, and video directly from your agent. Useful for scripting media generation and testing Agnes 2.0 Flash models.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Yacey/agnes-ai-generation-skill --skill agnes-ai-generation -a claude-code
Open on GitHub

What agnes-ai-generation does

The skill operates via scripts/agnes_api.py, avoiding the need to write curl calls manually. It handles standard and streaming text generation with agnes-2.0-flash, image generation with agnes-image-2.1-flash, and video creation using agnes-video-v2.0 from prompts or keyframes.

Running calls requires an API key set in AGNES_API_KEY, AGNES_API_TOKEN, or APIHUB_AGNES_API_KEY. The script validates media constraints locally: frame count must follow 8n + 1 up to 441, defaulting to 121 frames at 24 fps. Video creation is asynchronous, polling status by video_id until done.

Autonomous multi-turn function calling is unreliable with this provider, so keep to basic text completion endpoints rather than agent tool loops. Prompts for video or image generation should be translated to English before dispatch to prevent provider-side failures.

What it helps with

  • generate text and stream completions using Agnes models
  • create and edit images through the Agnes image API
  • render videos from text prompts or keyframe images with polling
  • validate image dimensions and frame counts before sending requests

Example prompts for the agent

  • Generate a concise product intro using agnes-2.0-flash
  • Create a video from prompt with status polling via agnes_api.py
  • Run a smoke test for image editing with scripts/agnes_api.py

How to install agnes-ai-generation

1Skills CLI (Vercel)

npx skills add Yacey/agnes-ai-generation-skill --skill agnes-ai-generation -a claude-code

2Manually: put the files in place

~/.claude/skills/agnes-ai-generation/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/agnes-ai-generation/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about agnes-ai-generation

How to install agnes-ai-generation in Claude Code?

Install the skill by running npx skills add Yacey/agnes-ai-generation-skill --skill agnes-ai-generation -a claude-code.

What does agnes-ai-generation do?

It provides a Python interface to Agnes AI endpoints for text, image, and video generation without manual HTTP requests.

Which environment variables are required?

You need to set an API key in AGNES_API_KEY, AGNES_API_TOKEN, or APIHUB_AGNES_API_KEY.

Source text

SKILL.md · MIT
---
name: agnes-ai-generation
description: Call Agnes AI / Sapiens AI generation APIs for text, image, and video. Use when the user asks to use Agnes models, Agnes Image, Agnes Video, Agnes 2.0 Flash, apihub.agnes-ai.com, or to generate text, images, edit images, create videos, animate images, create keyframe videos, or test Agnes API calls.
---

# Agnes AI Generation

Use this skill to call Agnes text, image, and video generation APIs through `https://apihub.agnes-ai.com`.

## Quick Start

1. Read `references/api.md` when endpoint details, parameters, or response fields are needed.
2. Use `scripts/agnes_api.py` for real API calls instead of rewriting curl by hand.
3. Require an API key in `AGNES_API_KEY`, `AGNES_API_TOKEN`, or `APIHUB_AGNES_API_KEY`. Never print the key.
4. For light live verification, run `smoke-test`; it avoids video creation by default. Add `--include-image-edit` for image-to-image, and add `--video-case <case>` explicitly for video modes. Treat the skill as fully tested only when basic text, text streaming, text tool calling, text-to-image, image-to-image, text-to-video, image-to-video, multi-image video, keyframe video, and video retrieval return successful responses.

## Commands

Text generation:

```bash
python scripts/agnes_api.py text --prompt "Write a concise product tagline for an AI assistant."
```

Streaming text:

```bash
python scripts/agnes_api.py text --prompt "Write a short product intro." --stream
```

Streaming output is normalized and includes aggregated `content`, `events`, `done`, and a short `raw_prefix`.

Image generation:

```bash
python scripts/agnes_api.py image --prompt "A luminous floating city above a misty canyon at sunrise, cinematic realism" --size 1024x768
```

Image-to-image:

```bash
python scripts/agnes_api.py image --prompt "Turn the scene into a rainy cyberpunk night while preserving composition" --image https://example.com/input.png --size 1024x768
```

Text-to-video with polling:

```bash
python scripts/agnes_api.py video --prompt "A cinematic shot of a cat walking on the beach at sunset" --poll
```

Image-to-video:

```bash
python scripts/agnes_api.py video --prompt "Animate subtle camera movement and natural lighting" --image https://example.com/image.png --poll
```

Keyframe / multi-image video:

```bash
python scripts/agnes_api.py video --prompt "Create a smooth cinematic transition between the two keyframes" --image https://example.com/a.png --image https://example.com/b.png --mode keyframes --poll
```

Retrieve a video task:

```bash
python scripts/agnes_api.py video-get video_123456
```

Light live smoke test:

```bash
python scripts/agnes_api.py smoke-test
```

Image edit smoke test:

```bash
python scripts/agnes_api.py smoke-test --include-image-edit
```

Single video smoke test:

```bash
python scripts/agnes_api.py smoke-test --video-case text-to-video
```

## Workflow

- Prefer `agnes-2.0-flash` for text chat/completions.
- Do not use Agnes Responses API multi-turn function calling for autonomous tool workflows. Live testing showed the provider can return `function_call` with overall `status=completed`, and submitting `function_call_output` with `previous_response_id` may fail. Use this skill's chat completions path for text generation and treat tool-calling as best-effort request-shape compatibility only.
- Prefer `agnes-image-2.1-flash` for text-to-image, image-to-image, and high-information-density image generation. High-density generation is prompt-driven; include subject hierarchy, environment, secondary details, lighting, composition, and quality requirements.
- Prefer `agnes-video-v2.0` for text-to-video, image-to-video, multi-image video, keyframe animation, prompt-based motion and scene control, cinematic output, asynchronous task creation, polling-based result retrieval, and seed-based reproducibility.
- For image and video generation, convert any non-English user prompt to a fluent English generation prompt before calling the image/video API. English prompts are more stable for Agnes video generation. Preserve concrete visual details, style, lighting, composition, motion, camera instructions, and constraints during translation.
- For videos, remember the API is asynchronous: create a task first, then poll or retrieve by `video_id` when the create response includes it. The script falls back to legacy `task_id` lookup only when `video_id` is absent.
- The script validates image sizes, video frame counts, frame rates, and dimensions before sending requests. `num_frames` must be `8n + 1` and `<= 441`; `81` or `121` are good short values.
- The video command defaults to `num_frames=121` and `frame_rate=24` for more stable generation. Video smoke tests default to `num_frames=81` and `frame_rate=24`.
- Warn the user before costly or long-running live video generation unless they explicitly asked to test or generate video.
- Test video capabilities one at a time with `smoke-test --video-case <case>` to avoid creating many tasks at once. Supported cases are `text-to-video`, `image-to-video`, `multi-image`, and `keyframes`.

## Current Validation Notes

- Confirmed locally: skill metadata validation and Python syntax.
- Confirmed by live API: basic text, streaming text, tool-calling request shape, text-to-image, image-to-image, high-information-density text-to-image, Chinese prompt translation for image/video, completed text-to-video URL retrieval, and completed image-to-video URL retrieval.
- Caveat: Agnes may accept tool-calling request parameters without consistently returning `tool_calls`; use `smoke-test --strict-tools` when strict tool-call validation is required.
- Caveat: Agnes Responses API multi-turn function calling is not reliable for agent tool loops; do not rely on it for Codex/Claude-style automatic tool continuation.
- Supported by the script and smoke-test selector, but not re-run end-to-end in the latest pass: multi-image video and keyframe animation.
- Not yet confirmed end-to-end: completed URL retrieval for every multi-image video and keyframe animation task. A previous text-to-video task returned a provider-side `division by zero` error, so keep video retries visible and report provider errors clearly.

## Output Handling

- Return generated image/video URLs directly by default. Do not download, save, open, or inspect generated media unless the user explicitly asks for a local file or visual inspection.
- For image responses, expect URL-style results when `extra_body.response_format` is `url`.
- For video responses, extract URLs from `video_url`, `url`, or `remixed_from_video_id` when `status` is `completed`.
- For video retrieval, prefer `GET /agnesapi?video_id=...&model_name=agnes-video-v2.0`; legacy `GET /v1/videos/{task_id}` remains a fallback.
- If a request fails, report HTTP status and provider error body without exposing the API key.

© Yacey · MIT · Yacey/agnes-ai-generation-skill

Similar skills

Everything for AI and ML →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor