laravel-ai-assistant maintained by creativecrafts
Description
A handy package to access and interact with OpenAi endpoint
Author
Last update
2026/03/30 08:52
(dev-dependabot/github_actions/dependabot/fetch-metadata-3.0.0)
License
Downloads
1 154
Tags
Last update
2026/03/30 08:52
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2026/03/16 07:53
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2026/02/14 17:04
License
Require
- spatie/laravel-package-tools ^1.19
- guzzlehttp/guzzle ^7.9
- symfony/http-client ^6.3|^7.2
- php ^8.3|^8.2
- illuminate/contracts ^12|^11|^10.0
Last update
2025/10/21 11:40
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/15 06:12
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/15 05:27
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 19:34
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 17:01
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 16:19
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 15:25
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 11:59
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 11:19
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 10:33
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/14 10:02
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/13 14:02
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/13 14:02
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/10/07 11:06
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/25 13:54
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/12 09:53
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/10 13:32
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/10 13:32
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/10 10:14
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/09 19:40
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/09 14:51
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/09 13:59
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/08 16:34
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/08 16:34
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 14:48
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 14:09
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 14:09
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 13:02
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 12:47
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 11:37
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/05 11:37
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/04 17:14
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- openai-php/client ^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/04 16:15
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- openai-php/client ^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/09/04 09:38
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12|^11|^10.0
- openai-php/client ^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/06/04 09:40
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/04/30 06:08
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/04/29 20:33
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/04/01 10:30
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/04/01 10:30
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/03/03 12:21
License
Require
- php ^8.3|^8.2
- guzzlehttp/guzzle ^7.9
- illuminate/contracts ^12.0|^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.2
Last update
2025/02/18 12:23
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/18 12:23
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/18 09:54
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/17 20:55
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/11 22:21
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/11 14:19
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2025/02/11 11:55
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.10
- spatie/laravel-package-tools ^1.19
- symfony/http-client ^6.3|^7.0
Last update
2024/10/07 10:31
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.8
- spatie/laravel-package-tools ^1.16
- symfony/http-client ^6.3|^7.0
Last update
2024/10/05 18:01
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.8
- spatie/laravel-package-tools ^1.16
- symfony/http-client ^6.3|^7.0
Last update
2024/03/18 08:59
License
Require
- php ^8.2
- guzzlehttp/guzzle ^7.8
- illuminate/contracts ^11.0|^10.0
- openai-php/client ^0.7|^0.8
- spatie/laravel-package-tools ^1.16
- symfony/http-client ^6.3|^7.0
Last update
2023/06/27 15:55
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.7
- illuminate/contracts ^10.12
- openai-php/client ^0.5.1
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2.10
Last update
2023/06/27 15:55
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.7
- illuminate/contracts ^10.12
- openai-php/client ^0.5.1
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2.10
Last update
2023/05/24 21:08
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.7
- illuminate/contracts ^10.12
- openai-php/client ^0.5.1
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2.10
Last update
2023/05/24 20:45
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.7
- illuminate/contracts ^10.12
- openai-php/client ^0.4.2
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2.10
Last update
2023/05/24 20:29
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.7
- illuminate/contracts ^10.12
- openai-php/client ^0.4
- psr/http-client ^1.0.2
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2.10
Last update
2023/05/23 19:54
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4
- psr/http-client ^1.0
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2
Last update
2023/05/15 20:07
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4
- psr/http-client ^1.0
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2
Last update
2023/05/15 09:21
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4
- psr/http-client ^1.0
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2
Last update
2023/05/15 09:14
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4
- spatie/laravel-package-tools ^1.15
- symfony/http-client ^6.2
Last update
2023/05/14 20:57
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4.2
- spatie/laravel-package-tools ^1.14.0
- symfony/http-client ^6.2
Last update
2023/05/11 22:15
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4.2
- spatie/laravel-package-tools ^1.14.0
- symfony/http-client ^6.2
Last update
2023/04/27 11:09
License
Require
- php ^8.1
- guzzlehttp/guzzle ^7.5
- illuminate/contracts ^10.0
- openai-php/client ^0.4.2
- spatie/laravel-package-tools ^1.14.0
- symfony/http-client ^6.2
Laravel AI Assistant
Laravel AI Assistant is a production-ready Laravel package for OpenAI APIs. It uses a Single Source of Truth (SSOT) architecture: Ai::responses() is the unified entry point for text, audio, image, streaming, and tool-calling workflows, with strong DX and predictable behavior.
Highlights
- One primary API:
Ai::responses() - Automatic routing for audio and image operations
- Streaming, tool calls, and structured output
- Files, conversations, webhooks, and observability
- Advanced endpoints: Moderations, Batches, Realtime Sessions, Assistants, Vector Stores
Quick Start
1) Install
composer require creativecrafts/laravel-ai-assistant
php artisan ai:install
2) Configure
OPENAI_API_KEY=your-openai-api-key-here
3) Chat (SSOT)
use CreativeCrafts\LaravelAiAssistant\Facades\Ai;
$response = Ai::responses()
->input()
->message('Explain Laravel queues in simple terms')
->send();
echo $response->text;
4) Streaming
foreach (Ai::responses()->input()->message('Tell me about Laravel')->stream() as $event) {
// $event is a normalized SSE event
// You can also use Ai::stream(...) for a simpler chat stream
}
5) Audio Transcription
$response = Ai::responses()
->input()
->audio([
'file' => storage_path('audio/recording.mp3'),
'action' => 'transcribe',
])
->send();
echo $response->text;
6) Image Generation
$response = Ai::responses()
->input()
->image([
'prompt' => 'A futuristic Laravel logo with neon lights',
])
->send();
$response->saveImages(storage_path('images'));
Core Usage
The SSOT Builder (Ai::responses())
Use the unified builder for text, audio, and image operations:
$response = Ai::responses()
->model('gpt-4o-mini')
->temperature(0.3)
->input()
->message('Write a haiku about Laravel')
->send();
Conversations
$conversation = Ai::conversations()->create();
Ai::responses()
->inConversation($conversation['id'])
->input()
->message('Remember: I like short answers')
->send();
Tool Calling (Chat Sessions)
use CreativeCrafts\LaravelAiAssistant\Support\ToolsBuilder;
$session = Ai::chat('You are a helpful assistant');
$session->tools()
->includeFunctionCallTool('getWeather', 'Fetch weather', [
'properties' => ['city' => ['type' => 'string']],
'required' => ['city'],
]);
$response = $session->send('What is the weather in Paris?');
Audio
// Speech synthesis
$response = Ai::responses()
->input()
->audio([
'text' => 'Welcome to Laravel AI Assistant',
'action' => 'speech',
'voice' => 'alloy',
])
->send();
$response->saveAudio(storage_path('audio/welcome.mp3'));
Images
// Image editing
$response = Ai::responses()
->input()
->image([
'image' => storage_path('images/input.png'),
'mask' => storage_path('images/mask.png'),
'prompt' => 'Add a neon glow',
])
->send();
$response->saveImages(storage_path('images/edited'));
Files
Upload
$fileId = Ai::files()->upload(storage_path('docs/guide.pdf'))['id'] ?? null;
Download Content
$content = Ai::files()->content('file_123');
file_put_contents(storage_path('downloads/file.jsonl'), $content['content']);
Advanced Endpoints (Low-Level Repositories)
These are thin wrappers around OpenAI endpoints for advanced use cases.
// Moderations
$result = Ai::moderations()->create([
'input' => 'Check this content',
]);
// Batches
$batch = Ai::batches()->create([
'input_file_id' => 'file_123',
'endpoint' => '/v1/responses',
'completion_window' => '24h',
]);
// Realtime Sessions
$session = Ai::realtimeSessions()->create([
'model' => 'gpt-4o-realtime-preview',
]);
// Assistants (v2 beta)
$assistant = Ai::assistants()->create([
'model' => 'gpt-4o-mini',
'name' => 'Support Assistant',
]);
// Vector Stores (v2 beta)
$store = Ai::vectorStores()->create([
'name' => 'Support Docs',
]);
Webhooks
Enable in config and set a signing secret. Optional timestamp enforcement is supported.
AI_WEBHOOKS_ENABLED=true
AI_WEBHOOKS_SIGNING_SECRET=your-strong-secret
AI_WEBHOOKS_REQUIRE_TIMESTAMP=true
Testing
Integration tests are available under tests/Integration. They are skipped unless a valid API key is configured.
Migration & Upgrade
- Migration guide:
MIGRATION.md - Upgrade guide:
UPGRADE.md
Support
See CHANGELOG.md for recent changes and examples/ for additional usage patterns.