OpenRouter Overview
The Meta-Data Tag Generator uses OpenRouter to access multiple AI models through a single API. OpenRouter provides:- Unified API: Access 200+ AI models with one API key
- Flexible Pricing: Pay only for what you use, choose models by cost/performance
- Model Fallbacks: Automatic failover if a model is unavailable
- Rate Limiting: Built-in rate limit management
Getting Started with OpenRouter
Create an Account
Sign up at openrouter.ai
Generate API Key
Navigate to API Keys and create a new key
Add Credits (Optional)
Free tier available, or add credits at Billing for higher rate limits
API Key Format
OpenRouter API keys start withsk-or-v1-:
Recommended AI Models
The system supports all OpenRouter models, but these are optimized for tag generation:Best for Speed and Cost
OpenAI GPT-4o Mini
Model ID:
openai/gpt-4o-miniBest for: General-purpose tagging, English documentsSpeed: Very fast (2-4 seconds)Cost: $0.15 per 1M input tokensStrengths:- Excellent balance of speed and quality
- Low cost for high-volume processing
- Reliable and well-supported
Google Gemini Flash 1.5
Model ID:
google/gemini-flash-1.5Best for: Multilingual documents, Indian languagesSpeed: Very fast (2-3 seconds)Cost: $0.075 per 1M input tokensStrengths:- Excellent with Hindi, Tamil, Telugu, and other Indian languages
- Fastest processing speed
- Lowest cost option
- Great for scanned/OCR documents
Best for Quality
Anthropic Claude 3 Haiku
Model ID:
anthropic/claude-3-haikuBest for: Complex documents, legal textsSpeed: Fast (3-5 seconds)Cost: $0.25 per 1M input tokensStrengths:- Highest quality tag generation
- Excellent understanding of context
- Great for technical/legal documents
- Superior at avoiding generic tags
Anthropic Claude 3.5 Sonnet
Model ID:
anthropic/claude-3.5-sonnetBest for: Premium quality, complex analysisSpeed: Medium (5-8 seconds)Cost: $3.00 per 1M input tokensStrengths:- Best-in-class quality
- Deep contextual understanding
- Ideal for critical documents
- Most sophisticated tag selection
Model Configuration
Specify the model in your processing configuration:Model Selection Guide
Choose the right model based on your needs:English Documents (General Purpose)
English Documents (General Purpose)
Recommended:
openai/gpt-4o-miniBest balance of speed, cost, and quality for English documents:- Business reports
- Training manuals
- Policy documents
- General correspondence
Indian Language Documents
Indian Language Documents
Recommended:
google/gemini-flash-1.5Excellent support for Hindi, Tamil, Telugu, Bengali, and other Indian languages:- Government documents in regional languages
- Multilingual reports
- OCR-extracted text from scanned documents
Legal/Technical Documents
Legal/Technical Documents
Recommended:
anthropic/claude-3-haikuSuperior understanding of complex terminology and context:- Legal contracts and agreements
- Technical specifications
- Research papers
- Regulatory documents
High-Volume Processing
High-Volume Processing
Recommended:
google/gemini-flash-1.5Lowest cost for processing thousands of documents:- Batch processing large archives
- Daily automated processing
- Cost-sensitive deployments
Premium Quality Required
Premium Quality Required
Unsupported Models
Some models are not compatible with tag generation:Rate Limits and Pricing
Free Tier
OpenRouter provides a free tier with rate limits:- Free credits: Small amount for testing
- Rate limits: 10-20 requests per minute (model-dependent)
- Best for: Development, testing, small-scale use
If you hit rate limits frequently, the system automatically implements exponential backoff. Consider adding credits for production use.
Paid Tier
Add credits for higher limits and better performance:Higher Rate Limits
100+ requests per minute depending on model
Pay-as-you-go
Only pay for tokens used, no subscription
Priority Access
Faster processing during peak times
Cost Calculation
Estimate costs based on your usage:Cost Estimator
API Configuration
The system uses these OpenRouter API settings:Backend Configuration
Request Format
The system sends requests in OpenAI-compatible format:OpenRouter Request
Error Handling
Invalid API Key
Invalid API Key
Error:
"Invalid API key"Cause: API key is incorrect or not from OpenRouterSolution:- Verify API key starts with
sk-or-v1- - Generate new key at OpenRouter Keys
- Check for typos or extra spaces
Rate Limited
Rate Limited
Error:
"RATE_LIMITED: OpenRouter free tier limit hit"Cause: Too many requests too quicklySolution:- System automatically implements backoff
- Add credits at OpenRouter Billing
- Reduce batch size or add delays between requests
Model Not Found
Model Not Found
Error:
"Model not found: incorrect-model-name"Cause: Model ID is incorrect or model is unavailableSolution:- Check model ID at OpenRouter Models
- Ensure model is currently available
- Use exact model ID (case-sensitive)
Request Timeout
Request Timeout
Error:
"Request timed out"Cause: Model is slow or API is congestedSolution:- Reduce
num_pagesto decrease content size - Try a faster model like
gemini-flash-1.5 - System will retry automatically (up to 3 times)
Model Compatibility Warning
Model Compatibility Warning
Warning:
"Model 'deepseek-r1' is likely incompatible for tagging tasks"Cause: Using a reasoning or vision modelSolution:- Switch to a chat/completion model
- Use recommended models:
gpt-4o-mini,gemini-flash-1.5,claude-3-haiku - Reasoning models return empty/incompatible responses
Best Practices
Start with GPT-4o Mini
Begin with
openai/gpt-4o-mini for testing and general use. Upgrade to Claude for better quality or Gemini for multilingual.Optimize Page Count
More pages = better context but higher cost. Start with 3 pages, adjust based on document complexity.
Monitor API Usage
Track token usage and costs in OpenRouter Dashboard
Handle Rate Limits
The system auto-retries with backoff. For high-volume, add credits or implement request queuing.
Model Comparison
| Model | Speed | Cost (per 1M tokens) | Quality | Best For |
|---|---|---|---|---|
| gpt-4o-mini | ⚡⚡⚡ Very Fast | $0.15 | ⭐⭐⭐⭐ Excellent | General purpose, English |
| gemini-flash-1.5 | ⚡⚡⚡ Very Fast | $0.075 | ⭐⭐⭐⭐ Excellent | Multilingual, high-volume |
| claude-3-haiku | ⚡⚡ Fast | $0.25 | ⭐⭐⭐⭐⭐ Superior | Legal, technical docs |
| claude-3.5-sonnet | ⚡ Medium | $3.00 | ⭐⭐⭐⭐⭐ Best | Premium quality, complex |