adachsoft / ai-model-list-tool
An ai-tool-call tool for listing AI providers, models, and optional pricing metadata.
Requires
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13.0
- rector/rector: ^2.3
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
adachsoft/ai-model-list-tool provides the ai_model_list tool for the adachsoft/ai-tool-call SPI. It exposes registered AI providers and their models, with optional pricing metadata from a model-pricing API.
Features
- List registered providers.
- List models for a provider and optionally filter by model ID.
- Include model capabilities, token limits, and available pricing details.
- Discover provider integrations through
adachsoft/ai-model-list-plugin.
Requirements and installation
Requires PHP 8.3 or later. Install the library and its dependencies with Composer:
composer require adachsoft/ai-model-list-tool
Usage
Register the factory with the ai-tool-call facade builder and call the tool using the ai_model_list name:
use AdachSoft\AiModelListTool\Factory\AiModelListToolFactory;
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
use AdachSoft\AiToolCall\PublicApi\Dto\ToolCallRequestDto;
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
$facade = AiToolCallFacadeBuilder::new()
->withSpiFactories([new AiModelListToolFactory()])
->withToolConfigs([
'ai_model_list' => new ConfigMap([]),
])
->build();
$result = $facade->callTool(new ToolCallRequestDto(
toolName: 'ai_model_list',
parameters: ['operation' => 'list_providers'],
));
Use list_models with a provider_id parameter to retrieve models. The optional model_id_contains parameter filters model IDs case-insensitively. Configure model_pricing_api_url in the tool's ConfigMap to enable pricing data; provider credentials and configuration are documented by their respective provider packages.
See the usage example for a model-listing request and pricing configuration.