PHP code example of tivins / llm-stack-sdk

1. Go to this page and download the library: Download tivins/llm-stack-sdk 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/ */

    

tivins / llm-stack-sdk example snippets


use Tivins\LlmStackSdk\Stack;

$stack = new Stack();

// List models
$stack->list();
$stack->listJson();

// Start and wait until ready (default)
$stack->start('llm_main');
$stack->status('llm_main'); // e.g. "ready"
$stack->stop('llm_main');

// Start without waiting
$stack->start('llm_main', noWait: true);
while ($stack->status('llm_main') !== 'ready') {
    sleep(2);
}

// Switch models (starting one stops the previous one)
$stack->start('llm_main');
$stack->start('llm_flash'); // stops llm_main, starts llm_flash