Skip to main content
Version: 0.1.22

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_KEY environment variable

Usage

export OPENROUTER_API_KEY="your-api-key"
tinct generate -i openrouter --prompt "<description>" [flags]

Flags

FlagDefaultDescription
--promptImage description (required)
--openrouter.modelflux-proModel to use
--openrouter.negativeNegative 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:

ModelDescription
flux-proHigh-quality image generation
stable-diffusion-xlStable Diffusion XL
dall-e-3OpenAI's DALL-E 3

Check OpenRouter models for the current list.

How it works

  1. Request: Send prompt to OpenRouter API
  2. Model routing: OpenRouter routes to selected model
  3. Generation: Image generated by chosen model
  4. Response: Base64 image returned
  5. Caching: Image cached locally
  6. Extraction: K-means colour extraction
  7. 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

StyleRecommended model
Photorealisticflux-pro, dall-e-3
Artisticstable-diffusion-xl
Abstractflux-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