Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Capevace/llm-magic/llms.txt
Use this file to discover all available pages before exploring further.
OpenRouter Provider
The OpenRouter provider gives you unified access to models from multiple providers including Google, Mistral, Meta, Microsoft, and others through a single API.Configuration
API Key Setup
Set your OpenRouter API key in your.env file:
config/llm-magic.php:
Available Models
LLM Magic supports the following models through OpenRouter:xAI Models
- x-ai/grok-beta - xAI’s Grok model
Google Gemini Models
- google/gemini-pro-1.5 - Gemini Pro 1.5
- google/gemini-flash-1.5-8b - Gemini Flash 1.5 8B
- google/gemini-flash-1.5 - Gemini Flash 1.5
Mistral Models
- mistralai/mistral-7b-instruct - Mistral 7B Instruct
- mistralai/mistral-large - Mistral Large
- mistralai/mistral-nemo - Mistral Nemo
- mistralai/mistral-tiny - Mistral Tiny
Cohere Models
- cohere/command-r-08-2024 - Cohere Command R
Meta Llama Models
- meta-llama/llama-3.1-8b-instruct - Llama 3.1 8B Instruct
- meta-llama/llama-3.1-70b-instruct - Llama 3.1 70B Instruct
- meta-llama/llama-3.1-405b-instruct - Llama 3.1 405B Instruct
- meta-llama/llama-3.1-405b-instruct:free - Llama 3.1 405B Instruct (Free)
- meta-llama/llama-3.2-1b-instruct - Llama 3.2 1B Instruct
- meta-llama/llama-3.2-3b-instruct - Llama 3.2 3B Instruct
- meta-llama/llama-3.2-11b-vision-instruct - Llama 3.2 11B Vision
- meta-llama/llama-3.2-90b-vision-instruct - Llama 3.2 90B Vision
Microsoft Models
- microsoft/wizardlm-2-8x22b - WizardLM 2 8x22B
Nous Research Models
- nousresearch/hermes-3-llama-3.1-405b - Hermes 3 Llama 3.1 405B
- nousresearch/hermes-3-llama-3.1-405b:free - Hermes 3 Llama 3.1 405B (Free)
Perplexity Models
- perplexity/llama-3.1-sonar-large-128k-chat - Llama 3.1 Sonar 70B
- perplexity/llama-3.1-sonar-large-128k-online - Llama 3.1 Sonar 70B (Online)
Model Constants
Use these constants for type safety:Usage
Using the Constructor
Create an OpenRouter model instance:Using Static Factory Methods
LLM Magic provides convenient static methods:Getting Available Models
Retrieve a list of all available OpenRouter models:API Configuration
OpenRouter uses the OpenAI-compatible API with a custom base URI:Organization Info
The OpenRouter provider includes organization metadata:- ID:
openrouter - Name: OpenRouter
- Website: https://openrouter.ai
- Privacy: Data may be used for model training and abuse prevention
Benefits of OpenRouter
Unified Access
Access models from multiple providers with a single API key:- No need to manage separate API keys for each provider
- Consistent API interface across all models
- Easy model switching and comparison
Cost Optimization
OpenRouter offers competitive pricing and free tier options:- Free models available (look for
:freesuffix) - Pay-as-you-go pricing
- No monthly commitments
Model Discovery
Explore and experiment with models from different providers:- Test different models without setup overhead
- Compare performance across providers
- Find the best model for your use case
Advanced Usage
Using Any Model
OpenRouter supports many more models than those listed above. Use themodel() static method to access any model: