1. Go to this page and download the library: Download padosoft/laravel-flow-ai 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/ */
padosoft / laravel-flow-ai example snippets
use Padosoft\LaravelFlowAI\Contracts\LlmClient;
use Padosoft\LaravelFlowAI\Llm\LlmRequest;
$response = app(LlmClient::class)->complete(new LlmRequest(
prompt: 'Summarize this run in one sentence.',
model: 'claude-sonnet-5',
));
$response->content; // raw completion text
$response->promptTokens; // usage, always present
$response->completionTokens;
$response->totalTokens();
$this->app->bind(LlmClient::class, fn () => new LaravelAiDriver(provider: 'anthropic'));