openrouter
Generate images and extract colours using OpenRouter's multi-model API.
Description
The openrouter plugin accesses various image generation models through OpenRouter, providing:
- Access to multiple AI models (DALL-E, Stable Diffusion, Flux, etc.)
- Unified API for different providers
- Image generation with colour extraction
Requirements
- OpenRouter API key from openrouter.ai
- Set
OPENROUTER_API_KEYenvironment variable
Usage
export OPENROUTER_API_KEY="your-api-key"
tinct generate -i openrouter --prompt "<description>" [flags]
Flags
| Flag | Default | Description |
|---|---|---|
--prompt | Image description (required) | |
--openrouter.model | flux-pro | Model to use |
--openrouter.negative | Negative prompt (exclude elements) |
Examples
Basic generation
export OPENROUTER_API_KEY="your-api-key"
tinct generate -i openrouter \
--prompt "cyberpunk city at night with neon lights" \
-o all
With specific model
tinct generate -i openrouter \
--prompt "watercolor painting of a mountain lake" \
--openrouter.model "stable-diffusion-xl" \
-o all
With negative prompt
tinct generate -i openrouter \
--prompt "serene japanese garden" \
--openrouter.negative "people, text, watermark" \
-o all
Available models
OpenRouter provides access to various models. Popular options:
| Model | Description |
|---|---|
flux-pro | High-quality image generation |
stable-diffusion-xl | Stable Diffusion XL |
dall-e-3 | OpenAI's DALL-E 3 |
Check OpenRouter models for the current list.
How it works
- Request: Send prompt to OpenRouter API
- Model routing: OpenRouter routes to selected model
- Generation: Image generated by chosen model
- Response: Base64 image returned
- Caching: Image cached locally
- Extraction: K-means colour extraction
- Wallpaper: Image provided to output plugins
Generated image location
Images are cached in:
~/.cache/tinct/openrouter/
Negative prompts
Use negative prompts to exclude unwanted elements:
# Avoid certain styles
--openrouter.negative "cartoon, anime, illustration"
# Avoid artifacts
--openrouter.negative "blurry, low quality, distorted"
# Avoid elements
--openrouter.negative "text, watermark, people"
Model selection tips
| Style | Recommended model |
|---|---|
| Photorealistic | flux-pro, dall-e-3 |
| Artistic | stable-diffusion-xl |
| Abstract | flux-schnell |
API credits
OpenRouter uses a credit system. Different models have different costs. Monitor usage at OpenRouter dashboard.
Troubleshooting
API key issues
- Verify key at openrouter.ai
- Check OPENROUTER_API_KEY is exported
- Ensure sufficient credits
Model not available
- Check model name spelling
- Verify model is available on OpenRouter
- Try a different model
Poor results
- Adjust prompt for the model
- Try different model
- Use negative prompts
See also
- google-genai - Google Gemini generation
- image - Extract from existing images