Adding an AI Chatbot to Your Laravel App with the OpenAI API A Laravel developer demonstrates how to integrate an AI chatbot into a Laravel application using the OpenAI API and the openai-php/laravel package. The tutorial covers setting up the package, creating a ChatService to handle LLM logic, storing conversation history in the session, and implementing rate limiting. The approach avoids external microservices and relies solely on Laravel and an HTTP API. Every product I've worked on in the last two years has eventually gotten the same request: "Can we add an AI assistant to this?" As a Laravel developer, the good news is that shipping a production-ready chatbot takes an afternoon — no Python microservice, no LangChain, just Laravel and an HTTP API. In this tutorial we'll build a chatbot that: The community-maintained openai-php/laravel https://github.com/openai-php/laravel package is the de-facto standard: composer require openai-php/laravel php artisan openai:install Add your key to .env : OPENAI API KEY=sk-your-key-here 💡 Never commit the key. Use your host's secret manager in production. Keep the LLM logic out of your controller. Create app/Services/ChatService.php : php