Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Ai Assistant

Laravel Ai Assistant Laravel Package

creativecrafts/laravel-ai-assistant

A Laravel package for adding an AI-powered assistant to your application. It offers a simple, configurable way to integrate conversational AI features, manage prompts and responses, and connect your app to supported AI providers.

View on GitHub
Deep Wiki
Context7

A handy package to interact with openai chatgpt

Frequently asked questions about Laravel Ai Assistant
How do I install creativecrafts/laravel-ai-assistant in a Laravel app?
Install it with Composer using composer require creativecrafts/laravel-ai-assistant, then publish the package config file with the vendor:publish command. Add your OPENAI_API_KEY to the .env file. No extra infrastructure, daemons, or database migrations are required, so it drops into an existing Laravel app cleanly.
Which PHP and Laravel versions does laravel-ai-assistant support?
The package targets PHP 8.2+ and Laravel 10+. Check the composer.json constraints and the release notes against your own LTS version before committing, especially if you run an older Laravel branch. Also confirm compatibility with your HTTP client middleware for retries, timeouts, proxying, and tracing, since a package that ships its own Guzzle configuration can bypass your observability layer.
Why does Composer refuse to install version ^3.0 of this package?
The current releases carry a -beta suffix, and Composer will not resolve a ^3.0 constraint to a beta build under default stability settings. You can either pin the exact version, for example 3.0.31-beta, or use ^3.0@beta, which widens stability for that dependency. Pinning the exact build is the safer choice for a spike, but neither option is a good long-term production default.
How do I configure the OpenAI API key and other settings?
Publish the package config file and set OPENAI_API_KEY in your .env file. Keep the key out of version control and out of any config cache dumps. If you support multiple providers or models, define them in the published config so you can switch without touching application code.
How do I send a chat prompt and get a response from the assistant?
Build the payload with the package's InputBuilder, for example InputBuilder::message(), and hand it to the facade or the injected service to dispatch the request. The package is a thin service provider plus facade over the OpenAI PHP client, so it owns transport and config rather than business logic. That means you keep your prompts, validation, and response handling in your own application layer.
What is the difference between the messages and input payloads in laravel-ai-assistant?
The package historically used Chat Completions messages, and newer versions add a Responses API adapter that translates messages into Responses API input. InputBuilder::message() currently writes both input and message as a compatibility bridge, which means two payload shapes can coexist in the same object graph. Until that is cleaned up, add contract tests so you catch any case where the adapter and the builder disagree, which would otherwise cause rejected requests or double-counted context.
Is it safe to use this beta package in production?
Only with explicit guardrails. Pin the exact beta version, run your own contract tests rather than trusting the no-breaking-changes claim, and watch for superseded or yanked releases. Beta dependencies create an upgrade treadmill with no stability guarantee, including for security fixes. For long-lived production code, isolate the package behind your own small service class so you can swap it out if the beta cadence becomes a problem.
How does the package handle images and multimodal content blocks?
The Responses API adapter maps image_url string and object content into input_image blocks, which is a lossy surface for edge cases. Data URIs, private URLs that require authentication, file_id variants, and any content type outside the enumerated list may not map cleanly and are a common source of 400 responses. Test every content shape your app actually sends, and handle unmapped types explicitly in your own code.
How can I log or audit the outbound OpenAI payload for cost and PII checks?
Conversion to the Responses API shape happens inside the package and can mutate the payload, for example replacing and removing the messages field. Any logging, cost estimation, PII redaction, or audit trail must therefore inspect the request after conversion, not before. Write a test that captures the actual outbound HTTP body and asserts on it, so your logs never claim one payload while the API receives another.
Can I use laravel-ai-assistant inside queued jobs and long-running requests?
Yes, it works for both synchronous request paths and queued jobs, and queues are usually the better fit for slow model calls. Resolve the client inside the job's handle method rather than serializing it into the job payload, since transport objects and API clients do not survive serialization well. Set explicit timeouts and retries through your own HTTP middleware, and if you need finer control over the raw Responses API surface, calling the underlying OpenAI PHP client directly is a reasonable alternative.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log