A powerful Chrome extension that generates AI-powered prompts for ComfyUI using LM Studio. Create detailed, high-quality prompts with just a click, or guide the AI to generate exactly what you need.
- AI-Powered Prompt Generation: Uses LM Studio's local LLM models to generate creative and detailed prompts
- Random or Guided Generation: Choose between completely random prompts or provide your own guidance
- Multiple Styles: Select from various styles including Realistic, Artistic, Anime, Fantasy, Sci-Fi, Portrait, and Landscape
- Auto-Detection: Automatically finds and fills positive and negative prompt fields in ComfyUI
- Persistent Settings: All configurations are saved and persist across browser restarts
- Easy Configuration: Simple UI to configure your LM Studio instance and select models
- LM Studio: Download and install LM Studio
- A Local LLM Model: Download a model in LM Studio (recommended: Mistral, Llama 2, or similar)
- ComfyUI: Have ComfyUI running (web interface)
Clone or download this repository:
git clone https://github.com/nahcmon/Prompt-Generator-for-ComfyUI-Web-Interface.git
cd Prompt-Generator-for-ComfyUI-Web-Interface- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in the top right corner)
- Click "Load unpacked"
- Select the folder containing the extension files
- The extension should now appear in your extensions list
Click the puzzle piece icon in Chrome's toolbar and pin the "ComfyUI Prompt Generator" extension for easy access.
- Open LM Studio
- Load a model (e.g., Mistral, Llama 2, etc.)
- Go to the "Local Server" tab
- Click "Start Server"
- Note the server URL (usually
http://localhost:1234/v1)
- Click the extension icon in Chrome
- Enter your LM Studio URL (default:
http://localhost:1234/v1) - Click "Refresh Models" to load available models
- Select your preferred model from the dropdown
- Click "Save Configuration"
Your settings will be automatically saved and remembered for future use!
- Open ComfyUI in your browser
- Click the extension icon
- Select generation type:
- Random Prompt: Generates a completely random prompt based on the selected style
- Guided Prompt: Uses your input to guide the AI in generating a specific prompt
- Choose a style (Realistic, Artistic, Anime, etc.)
- Click "Generate & Insert Prompt"
- The extension will automatically detect and fill the prompt fields in ComfyUI!
For more control over the generated prompts:
- Select "Guided Prompt" from the Generation Type dropdown
- Enter your description in the "Your Guidance" text area
- Example: "a cyberpunk cat wearing neon sunglasses in a rainy city"
- Select your preferred style
- Click "Generate & Insert Prompt"
The AI will use your guidance to create a detailed, optimized prompt.
The extension generates both:
- Positive Prompt: Detailed description of what you want in the image
- Negative Prompt: Elements to avoid (low quality, artifacts, etc.)
Both prompts are automatically inserted into the appropriate fields in ComfyUI.
The extension intelligently searches for prompt fields using multiple strategies:
- Looks for textareas and inputs with labels containing "positive" or "negative"
- Checks placeholder text, names, IDs, and ARIA labels
- Detects ComfyUI-specific widget structures
- Falls back to position-based detection for complex interfaces
All your settings are saved using Chrome's sync storage:
- LM Studio URL
- Selected model
- Preferred prompt type
- Preferred style
These settings persist across:
- Browser restarts
- Extension reloads
- Different devices (if Chrome sync is enabled)
Choose from various optimized style presets:
- Realistic: Photorealistic images, portraits, landscapes
- Artistic: Abstract, impressionist, and artistic compositions
- Anime: Anime and manga-style illustrations
- Fantasy: Magical creatures, enchanted realms, mythical scenes
- Sci-Fi: Futuristic, cyberpunk, space-themed images
- Portrait: Character studies, headshots, fashion photography
- Landscape: Natural scenes, vistas, environments
- Verify LM Studio server is running
- Check the URL is correct (should end with
/v1) - Ensure no firewall is blocking the connection
- Try
http://127.0.0.1:1234/v1instead oflocalhost
- Make sure you've downloaded models in LM Studio
- Verify the model is loaded in LM Studio
- Try clicking "Refresh Models" again
- Check the browser console for error messages (F12 → Console)
- Ensure you're on a page with ComfyUI loaded
- Try manually clicking on the prompt field first
- Check the browser console for any errors
- The extension works best with standard ComfyUI interfaces
If you see missing icon warnings:
- The extension includes placeholder icons
- For custom icons, see
icons/ICONS_README.txt - You can convert the included
icon.svgto PNG formats - Alternatively, comment out the "icons" sections in
manifest.jsonfor development
.
├── manifest.json # Extension configuration
├── popup.html # Extension popup UI
├── popup.js # Popup logic and UI interactions
├── styles.css # Popup styling
├── background.js # Background service worker (LM Studio API)
├── content.js # Content script (ComfyUI interaction)
├── icons/ # Extension icons
│ ├── icon.svg # Source SVG icon
│ ├── icon16.png # 16x16 icon
│ ├── icon48.png # 48x48 icon
│ └── icon128.png # 128x128 icon
└── README.md # This file
After making changes:
- Go to
chrome://extensions/ - Click the refresh icon on the extension card
- Reload any pages where you're testing
The extension uses the OpenAI-compatible API format that LM Studio provides:
- Endpoint:
{lmStudioUrl}/chat/completions - Method: POST
- Format: Standard OpenAI chat completion format
- All data stays local - prompts are generated using your local LM Studio instance
- No data is sent to external servers
- Settings are stored locally in Chrome's storage
- The extension only has access to pages you explicitly use it on
Contributions are welcome! Please feel free to submit issues or pull requests.
MIT License - feel free to use and modify as needed.
Created for the ComfyUI community to enhance the prompt generation workflow.
If you encounter any issues or have suggestions:
- Open an issue on GitHub
- Check the browser console for error messages
- Ensure you're using the latest version of the extension
Enjoy creating amazing prompts with AI assistance!