This Laravel package provides an easy-to-use interface for integrating OpenRouter into your Laravel applications. OpenRouter is a unified interface for Large Language Models (LLMs) that allows you to interact with various AI models through a single API.
- PHP 8.1 or higher
You can install the package via composer:
composer require moe-mizrak/laravel-openrouterYou can publish the config file with:
php artisan vendor:publish --provider="MoeMizrak\LaravelOpenRouter\OpenRouterServiceProvider"This is the contents of the published config file:
return [
'api_endpoint' => env('OPENROUTER_API_ENDPOINT', 'https://openrouter.ai/api/v1/'),
'api_key' => env('OPENROUTER_API_KEY'),
];After publishing the package configuration file, you'll need to add the following environment variables to your .env file:
OPENROUTER_API_ENDPOINT=https://openrouter.ai/api/v1/
OPENROUTER_API_KEY=your_api_key- OPENROUTER_API_ENDPOINT: The endpoint URL for the OpenRouter API (default: https://openrouter.ai/api/v1/).
- OPENROUTER_API_KEY: Your API key for accessing the OpenRouter API. You can obtain this key from the OpenRouter dashboard.
// TODO: Add usage instructions and examples
Laravel OpenRouter is an open-sourced software licensed under the MIT license.