adachsoft/ai-model-list-provider-openrouter

ai-model-list-provider-openrouter

Maintainers

Package info

gitlab.com/a.adach/ai-model-list-provider-openrouter

Issues

pkg:composer/adachsoft/ai-model-list-provider-openrouter

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-08-27 15:31 UTC

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-list
  • adachsoft/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