Uses Anthropic LLM API to generate an image description.
Configurable env vars of the LLM model and prompt begin with reasonable and tested defaults, and allow you to modify the requests to your needs should you wish to further refine the prompt.
Warning
Do not use this workflow on any confidential content, as the image is uploaded to Anthropic for processing.
- Alfred Powerpack
- Node.js (works with NVM or system installation)
-
Download and install the workflow
-
Open Alfred and type:
desc-setup YOUR_ANTHROPIC_API_KEY
This will store your API key in the correct location (
~/.config/anthropic/api_key
) -
The workflow will automatically detect your Node.js installation (NVM or system)
Basic usage:
- Copy or screenshot an image
- Place your cursor in a textbox or input
- Open Alfred (Command+Space)
- Type trigger word "desc"
- Hit enter
The workflow will:
- Generate a description
- Copy it to your clipboard
- Type it at your cursor location
- Show progress notifications while processing
Advanced usage:
desc focus on the background elements
desc describe any text visible
desc emphasize the facial expressions
desc analyze the architectural details
desc respond in pig latin
Configure these in Alfred Preferences:
-
custom_prompt
(optional):- Add your own instructions to the base prompt
- Will be combined with system prompt
-
model_name
(optional):- Default: claude-3-opus-20240229
- Can be changed to other Claude models
Monitor the logs in real-time:
tail -f ~/alfred-debug.log # Shell script logs
tail -f ~/alfred-node-debug.log # Node script logs
The workflow consists of three main components:
-
Alfred Workflow Configuration
- Drag and drop interface in Alfred
- Configures trigger words and script paths
- Sets environment variables
-
Shell Script
- Handles Node.js detection (NVM/system)
- Sets up workflow directory paths
- Passes arguments to Node script
-
Node Script
- Manages environment variables
- Handles image clipboard operations
- Makes API requests to Anthropic
- Manages system notifications
- Handles typing and clipboard operations
- Provides error handling and logging
Common issues and solutions:
-
"No image found in clipboard"
- Ensure you've copied an image before running
- Try copying the image again
-
"Could not find API key"
- Verify key exists at
~/.config/anthropic/api_key
- Check file permissions
- Verify key exists at
-
"Failed to generate alt text"
- Check internet connection
- Verify API key validity
- Check node-debug.log for details
-
Long processing times
- Normal for image processing
- Progress notifications will appear
- Usually completes within 30-60 seconds
- Watch both log files while testing
- Shell script logs show Node detection and setup
- Node logs show detailed operation status and errors
- All API responses and errors are logged with timestamps
- Test with various image types and focus parameters