ไธญๆ ๏ฝ English
Project Source Code:
๐ Nano Banana OpenRouter Text-to-Image Plugin
High-quality AI text-to-image Dify plugin based on OpenRouter API, supporting multiple advanced image generation models
โจ Features
- ๐จ Multi-Model Support: Supports multiple image generation models including Google Gemini, OpenAI DALL-E, and Anthropic Claude
- ๐ Free Options: Provides free Gemini model options suitable for testing and light usage
- ๐ High-Quality Output: Supports premium models for professional-grade image quality
- ๐ Image Transformation: Supports image-to-image transformation functionality
- ๐ Multilingual: Complete bilingual support in Chinese and English
- โก Real-time Feedback: Detailed generation progress and status feedback
- ๐ก๏ธ Error Handling: Comprehensive error handling with user-friendly prompts
๐ Quick Start
1. Get OpenRouter API Key
- Visit OpenRouter
- Create an account and generate an API Key
- Copy your API Key (format: )
2. Install Dependencies
3. Configure Environment Variables
4. Test Plugin
๐ฏ Supported Models
Free Models
- Google Gemini 2.5 Flash: Fast with good quality, suitable for daily use
Premium Models
- OpenAI DALL-E 3: Highest quality image generation
- Anthropic Claude 3.5 Sonnet: Creative and artistic style images
๐ Usage Examples
Offline Plugin Installation
After installation, click authorize on the right and fill in your OpenRouter API key.
Agent Usage
Chatflow Usage
Prompt:
๐ ๏ธ Development Guide
Project Structure
Core Components
- OpenRouterProvider: Manages API authentication and connection validation
- Text2ImageTool: Implements core text-to-image logic
- Error Handling: Comprehensive exception handling and user prompts
๐ง Configuration Guide
API Key Configuration
- Enter your OpenRouter API Key in the Dify plugin configuration
- Ensure the API Key format is correct ()
- Confirm your account has sufficient balance (required for premium models)
Model Selection Recommendations
- Testing Phase: Use the free Gemini model
- Production Environment: Choose premium models based on quality requirements
- Artistic Creation: Recommend Claude 3.5 Sonnet
- General High-Quality: Recommend DALL-E 3
๐ Performance Optimization
- Timeout Settings: 60-second request timeout suitable for image generation tasks
- Error Retry: Intelligent error handling and retry suggestions
- Memory Management: Efficient image data processing
- Format Standardization: Unified PNG output format for compatibility
๐ Troubleshooting
Common Issues
-
Invalid API Key
- Check if the API Key format is correct
- Confirm the API Key hasn't expired
- Verify account status
-
Insufficient Balance
-
Generation Failure
- Check if prompts contain sensitive content
- Try switching models
- Simplify prompt descriptions
-
Network Issues
- Check network connection
- Confirm firewall settings
- Try again later
๐ Changelog
v0.0.1 (2025-08-30)
- โจ Initial release
- ๐ง Complete implementation based on OpenRouter API
- ๐จ Support for multiple image generation models
- ๐งช Complete test framework
- ๐ Detailed documentation and usage guide
๐ค Contributing
Issues and Pull Requests are welcome!
๐ License
MIT License
๐ Related Links
Nano Banana - Making AI image generation simple and powerful! ๐โจ