adachsoft / ai-model-list-provider-openrouter
ai-model-list-provider-openrouter
Package info
gitlab.com/a.adach/ai-model-list-provider-openrouter
pkg:composer/adachsoft/ai-model-list-provider-openrouter
Requires
- php: ^8.3
- adachsoft/ai-model-list: ^0.4
- adachsoft/ai-model-list-plugin: ^0.4
- adachsoft/collection: ^3.0
- guzzlehttp/guzzle: ^7.10
Requires (Dev)
- adachsoft/php-code-style: ^0.5.0
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.3
- rector/rector: ^2.6
- symplify/phpstan-rules: ^14.9
- vlucas/phpdotenv: ^5.7
This package is not auto-updated.
Last update: 2026-08-27 19:57:26 UTC
README
adachsoft/ai-model-list-provider-openrouter provides an OpenRouter implementation of the adachsoft/ai-model-list provider SPI.
Requirements
- PHP 8.3 or newer
adachsoft/ai-model-listadachsoft/ai-model-list-plugin- An OpenRouter API key
Installation
composer require adachsoft/ai-model-list-provider-openrouter
Configuration
Configure the API key with the package configuration key or its environment variable:
ADACHSOFT_AI_MODEL_LIST_PROVIDER_OPENROUTER_API_KEY
The provider is created through the factory supplied to the plugin:
use AdachSoft\AIModelList\Spi\AiModelProvider\Model\ProviderId;
use AdachSoft\AIModelList\Spi\Config\ConfigurationProviderInterface;
use AdachSoft\AiModelListProviderOpenRouter\Factory\OpenRouterAiModelProviderFactory;
$provider = OpenRouterAiModelProviderFactory::make(
$configurationProvider,
);
$models = $provider->listModels(new ProviderId('openrouter'));
The factory configures the OpenRouter API base URL and the required authentication header. Model capabilities are mapped from the OpenRouter architecture metadata.
Development
Install dependencies and run the default unit test suite:
composer install
vendor/bin/phpunit
Run static analysis and code-quality tools:
vendor/bin/phpstan analyse
vendor/bin/rector process --dry-run
vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php-cs-fixer.php
The production test performs a real API request and is excluded from the default suite. Provide OPENROUTER_API_KEY and run it explicitly:
vendor/bin/phpunit --group production