Skip to content

danissimo888/opencode-agnes-skill

Repository files navigation

Agnes AI Skill for OpenCode

中文文档

An OpenCode Agent Skill that lets you use all Agnes AI 2.0 models as a custom provider. Pure markdown and JSON — no dependencies, no build step.

Agnes 2.0 Models

All models are currently free to use.

Model Type Model ID
Agnes 2.0 Flash Text/Chat (256K context) agnes-2.0-flash
Agnes Image 2.0 Flash Image editing & multi-image composition agnes-image-2.0-flash
Agnes Image 2.1 Flash Text-to-image & image-to-image agnes-image-2.1-flash
Agnes Video V2.0 Text-to-video, image-to-video, keyframes agnes-video-v2.0

Quick Start

1. Install the skill

Per-project (recommended):

Copy the .opencode/skills/agnes-ai/ folder into your project:

your-project/
├── .opencode/
│   └── skills/
│       └── agnes-ai/
│           └── SKILL.md
└── opencode.json

Global (system-wide):

mkdir -p ~/.config/opencode/skills/agnes-ai
cp .opencode/skills/agnes-ai/SKILL.md ~/.config/opencode/skills/agnes-ai/

2. Configure the provider

Copy opencode.example.json to opencode.json in your project root:

Then set your API key:

Direct in config:

Replace "env:AGNES_API_KEY" with your actual key in opencode.json:

"apiKey": "sk-your-key-here"

3. Start using it

Open your project in OpenCode. The agent now has access to all Agnes AI models. Try:

  • "Generate an image of a cyberpunk city at night"
  • "Create a short video of ocean waves crashing on rocks"
  • "Transform this image into a watercolor painting: [image URL]"

Multiple API Keys (Failover)

Agnes AI backend occasionally has issues with specific keys. This skill supports automatic key rotation — if one key fails, it tries the next.

Copy agnes-keys.example.json to agnes-keys.json and add your keys:

{
  "keys": [
    "sk-your-primary-key",
    "sk-your-backup-key-1",
    "sk-your-backup-key-2"
  ]
}

The skill tries each key in order. If the first key fails (auth error, rate limit, server error), it automatically tries the next one. If agnes-keys.json does not exist, it falls back to the single key in opencode.json.

How It Works

  • Agnes-2.0-Flash works as the OpenCode agent model (chat/coding). It is OpenAI-compatible and handles chat, multi-turn conversations, tool calling, streaming, and agentic workflows.

  • Image and video models are used by the agent when you ask it to generate images or videos. The agent knows the correct API calls, parameters, and quirks for each model.

Interactive Options

When you ask to generate images or videos, the agent will interactively ask you to choose:

  • Image size — Landscape (1024x768), Portrait (768x1024), or Square (1024x1024)
  • Video duration — Extra Short (~3s), Short (~5s), Medium Short (~7s), Medium (~10s), Medium Long (~13s), Long (~15s), or Max (~18s)
  • Video type — Text-to-video, image-to-video, multi-image, or keyframe animation

The agent automatically selects the correct image model based on your task:

  • Text-to-image or single image transform → agnes-image-2.1-flash
  • Multi-image composition → agnes-image-2.0-flash

Project Structure

.
├── .opencode/
│   └── skills/
│       └── agnes-ai/
│           └── SKILL.md           # Skill definition (the core file)
├── opencode.example.json          # Provider config template
├── agnes-keys.example.json        # Multi-key failover template
├── README.md                      # English documentation
├── README.zh-CN.md                # Chinese documentation
├── LICENSE                        # MIT License
└── .gitignore

License

MIT

About

Agnes AI 2.0 Skill for OpenCode — text, image & video generation with multi-key failover

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors