1. Go to this page and download the library: Download sudhaus7/ai-eloki-platform library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sudhaus7 / ai-eloki-platform example snippets
use Symfony\AI\Platform\Bridge\Eloki\Factory;
use Symfony\AI\Platform\Message\Message;
use Symfony\AI\Platform\Message\MessageBag;
$platform = Factory::createPlatform();
$result = $platform->invoke('openai/gpt-oss', new MessageBag(
Message::forSystem('You are a helpful assistant.'),
Message::ofUser('What is Symfony AI?'),
));
echo $result->asText();
$platform = Factory::createPlatform(); // from ELOKI_API_KEY
$platform = Factory::createPlatform(apiKey: 'sk-…'); // explicit, wins over the env var
$catalog = new ModelCatalog(); // client built from ELOKI_API_KEY
$catalog = new ModelCatalog(Factory::createHttpClient(apiKey: 'sk-…'));