Installation
Overview
OpenRouter provides access to multiple AI models from different providers (OpenAI, Anthropic, Google, Meta, and more) through a single unified API. This package makes it easy to use any OpenRouter-supported model with Effect.Setup
Create an OpenRouter client by providing your API key:Language Model
Use any OpenRouter-supported model:Available Models
OpenRouter supports models from multiple providers:Streaming Responses
Stream responses for real-time text generation:Tool Calling
Use tools with OpenRouter models that support function calling:Configuration
Customize the OpenRouter client:Error Handling
Handle OpenRouter-specific errors:Model Pricing and Selection
OpenRouter provides access to models at different price points. Visit OpenRouter’s model page to compare models, pricing, and capabilities.API Modules
- OpenRouterClient: HTTP client for OpenRouter API
- OpenRouterConfig: Configuration options
- OpenRouterError: Error type augmentation
- OpenRouterLanguageModel: Language model implementation
Benefits of OpenRouter
- Unified API: Access multiple AI providers through a single interface
- Cost Optimization: Choose the most cost-effective model for your use case
- Fallback Support: Automatically fall back to alternative models if one is unavailable
- No Rate Limits: OpenRouter handles rate limiting across providers
- Pay As You Go: Only pay for what you use, no monthly subscriptions
