Image Generation Plugin
The Image Generation Plugin enables AI image creation using Anthropic and Together services, with automatic caption generation.
Installation
-
Install the package:
Terminal window npm i github:elizaos-plugins/plugin-image-generationTerminal window pnpm add github:elizaos-plugins/plugin-image-generationTerminal window yarn add github:elizaos-plugins/plugin-image-generation -
Configure environment:
Terminal window # Choose your providerANTHROPIC_API_KEY=your-anthropic-keyTOGETHER_API_KEY=your-together-key
Usage
import { createImageGenerationPlugin } from "@eliza/plugin-image-generation";
const imagePlugin = createImageGenerationPlugin({ provider: "anthropic", apiKey: process.env.ANTHROPIC_API_KEY, defaultSize: "1024x1024"});
const agent = new AgentBuilder() .withPlugin(imagePlugin) .build();
Features
Action | Description | Example |
---|---|---|
GENERATE_IMAGE | Create image from text | Generate an image of a mountain sunset |
Configuration
interface ImageGenerationConfig { provider: "anthropic" | "together"; apiKey: string; defaultSize?: string; autoCaption?: boolean;}
Best Practices
- โ๏ธ Provide clear, detailed image descriptions
- โ๏ธ Handle generation errors gracefully
- โ๏ธ Implement appropriate content filtering
- โ๏ธ Cache generated images when possible
Secure your API keys and never expose them in your code.