ai
Drupal AI enables organizations to use artificial intelligence directly within Drupal websites. It provides the core technical foundation for integrating language models, automating tasks, and extending content and marketing workflows with AI.
Whether you are exploring how AI can benefit your organization or looking to implement and extend AI functionality in Drupal, this page will help you find the right path.
For Marketers, Business Owners and Decision Makers
Drupal’s AI framework represents an opportunity to strengthen marketing outcomes whilst maintaining governance or brand integrity. It empowers teams to act with greater agility in a changing digital landscape.
Discover the benefits of Drupal AI
Explore how Drupal AI can deliver measurable benefits and become a valuable asset to your team.
Try the Drupal AI Demo
Try a range of demos for FREE. See how Drupal AI tools can enhance your productivity, while still keeping you in control.
For Developers and Site Builders
The AI module has a focus on foundational tools, so you can use it out of the box or build your own path to bespoke AI integrations. If you want to install or extend Drupal AI, this is the right place.
- Module documentation: describes AI Core, AI Automators, AI Explorer and the ecosystem of related modules.
- Installation guide: explains how to install and connect with popular AI services.
- API and developer resources: links to GitLab repositories and examples.
- Community: contribute, join discussions on Slack in the issue queue.
Submodules
- AI Core:- The AI provider provides access to all the common models and be extendable to any model required. Modules and recipes using this will be able to swap out any model they need.
- AI Explorer:- This is an area in the admin where you can explore text generation capability and ask it (prompt) whatever you like. An ideal place to test your prompts.
- AI Automators:- Use Automators to populate and change any field in Drupal. This quickly becomes the starting point to create complex and meaningful AI applications where prompts can be chained together in as simple or complex a workflow as you need. A huge range of Automators are provided including using AI LLMs, Web scraping , OCR file extraction. This can be extended further with ECA integration.
- AI Search (Experimental):- Search through your content intelligently where the search understands the meaning of your terms with Semantic Search or ask a LLM Chatbot to explore your content, find it or answer questions about it. By integrating embeddings and vector databases into Search API we can reduce hallucinations in your LLMs or provide it access to more of your own data in what is known as “Retrieval Augmented Generation or RAG”. Currently support Milvus and Zilliz And Pinecone.
- AI Assistants API + Chatbot:- A framework for configuring how these chatbots function allowed for advanced forms of AI search. This provides a single place to handle configuration and innovations in how LLMs do search but allows you to swap out the front-end chatbot to whatever you need. We have an example chatbot UI but we plan to support a variable to User interfaces for chat.
- AI CKeditor:- Provides a AI assistant in CKEditor 5 to send a prompt , do spelling corrections, translations and more. All the same features from the OpenAI module, but improved.
- AI content:- Adds assistive tools for different areas of the content editing process. It allows you to adjust the tone of the content, summarise body text, suggest taxonomy terms for nodes, and checks content for Moderation violations.
- AI external moderation - Enables you to use OpenAI moderation tool before calls from any (non OpenAi) LLM provider.
- AI logging:- Enables you to log any AI request and response.
- AI translate:- Provides a simple one-click AI powered translations, ideal for multilingual sites.
- AI validations:- Works with field_validations so you can use AI/LLM prompts to validate text.
Planned Sub-modules
- AI Evaluations
:- A framework for testing and evaluation LLMs and complete AI applications.
AI Providers
Drupal AI connects your site to a wide range of AI platforms, 48 and counting. With built-in integrations for providers like amazee, Anthropic, AWS Bedrock, Azure, Google Gemini, Google Vertex, Hugging Face, and OpenAI, you can start using powerful AI tools without writing custom code.
Each provider module makes it easy to plug specific AI capabilities - like text generation, translation, image creation, or speech processing - directly into Drupal. Whether you’re experimenting with a single service or orchestrating multiple providers, Drupal AI gives you a unified framework to manage them all.
List of most popular AI providers
AI Vector Database (VDB) Providers
In order to use the AI Search module - a key step in providing more accurate answers e.g. for AI Chatbots, AI Assistants, AI Overviews, and many other features - a vector database is needed. Here are some frequently used VDB Providers:
Other modules/recipes that work with the AI module
- AI Agents agents framework that can be used to manipulate your website.
- AI Usage Limits
- AI Agents & Evaluations Recipe provides some of the agents in a Chatbot UI where you can ask them to manipulate the website. Also comes with an evaluations framework so you can rate and export the responses for further optimizations of the prompts.
- ai_image_alt_text provides a button to generate alt text automatically.
- ai_migrate helps using AI while migrating.
- ai_summarize_document provides an AI CKEditor plugin that can summarize PDF documents.
- auto_translation provides automatic translations.
- ai_seo provides SEO analysis directly within the node view.
- ai_image allows for image generation (with DALL-E or stable diffusion or others) in ckeditor and has a version that supports the AI module
- ai_media_image allows for image generation directly into the media library.
- With ECA and Widgets this can be extended further to create complex workflows or helpful AI widgets inside your content.
- ai_tmgmt use the AI module as a translation provider with tmgmt.
- llmstxt provides information to LLM's at inference time.
- aitxt is used to communicate with data-miners.
- ai_webform_guard use ai to protect webform against spam.
- ai_translate_plus for better ai translations.
- ai_related_content for content recommendations or suggested content.
- ai_search_block for an AI powered textual search block (RAG).
Tutorials and screencasts
The latest screencasts from DrupalCon sessions might provide a good introduction to the module. Introductory Video to the AI Module.
We also have a Press Release announcing the module for more information.
We have a detailed blog post on the vision for the module, its features and submodules and our approach to this module.
Requirements
The AI module requires the Key module (where yo'll save your api keys). Some providers or submodules may require different modules.
PHP / Drupal Core requirements should go here.
Examples
Ckeditor assistant
AI powered translation
AI powered validations
AI explorer
Information for developers
We are actively working on this so feel free to suggest improvements.
If you are trying to implement some extension and are stuck, please don't hesitate to ask in the module's issue queue.
Please also ask to add your module to the list of "Other modules" once it's finished, if it is generally useful.
Example LLM call via AI module
// Find the default selected LLM
$sets = \Drupal::service('ai.provider')->getDefaultProviderForOperationType('chat');
$service = \Drupal::service('ai.provider');
$provider = $service->createInstance($sets['provider_id']);
$messages = new ChatInput([
new chatMessage('system', 'You are helpful assistant.'),
new chatMessage('user', $input),
]);
$message = $provider->chat($messages, $sets['model_id'])->getNormalized();
return $message->getText();
Example image generation call via AI module
$config = [
"n" => 1,
"response_format" => "url",
"size" => "1024x1024",
"quality" => "standard",
"style" => "vivid",
];
$tags = ["tag_1", "tag_2"];
try {
$ai_provider->setConfiguration($config);
$input = new TextToImageInput($prompt);
$response = $ai_provider->textToImage($input_prompt, $default_model, $tags);
$url = $this->saveAndGetImageUrl($response);
Some info on what's available in AI with screenshots is here.
Please join the #ai channel in the Drupal Slack: https://www.drupal.org/community/contributor-guide/reference-information...
Logo(s) and icon(s) by Nico Grienauer.