Black-and-white illustration of AI integration with Backdrop CMS, featuring interconnected nodes and abstract content blocks.

Over the last few months, I’ve become enamored with connecting my Drupal sites to AI, currently with the AI module and before that with the OpenAI module. I like it a lot. I think it makes life easier for content editors who no longer need to think about creating summaries, adding taxonomy terms, and writing alt text for images.

The problem was that I also work with Backdrop CMS and manage several sites using it. Several months ago, I decided it was time to bring some form of this functionality to Backdrop.

A Journey from Drupal to Backdrop

Back in May—what feels like an eternity given the pace of AI development—I cloned the Drupal OpenAI module and started converting it. I made some initial progress with the core module and some easier submodules. Then life happened, and I put it down for several months.

I picked it up again in November. By that time, development of the Drupal OpenAI module had largely ceased, shifting focus to the new AI module. Nevertheless, I stuck with OpenAI. My goals, for now, are much more limited than the goals of the newer Drupal projects. Ultimately, I want these capabilities on my sites, and if it does the basics, I’m happy.

A special thanks to the original creators of the Drupal OpenAI module, Kevin Quillen and Scot Euser. Your work laid the foundation for bringing AI-powered features to Drupal, and it inspired this Backdrop version. Thank you for your contributions to the Drupal community!

Included Submodules

The OpenAI module for Backdrop CMS includes several submodules, each designed to provide powerful AI functionality:

openai_audio

Adds the capability to interact with the OpenAI audio (speech-to-text) endpoints.

openai_chatgpt

Enables interaction with the Chat endpoint via the ChatGPT API.

openai_ckeditor

Provides a button for CKEditor 5 to send a prompt to OpenAI and receive generated text back.

openai_content

Adds assistive tools for different areas of the content editing process. This includes functionality to adjust the tone of the content, summarize body text, suggest taxonomy terms for nodes, and check content for moderation violations.

openai_dalle

Adds the capability to interact with the OpenAI DALL·E (image generation) endpoint, supporting both the DALL·E 3 and DALL·E 2 models.

openai_devel

Adds GPT content generation capability to Devel Generate. This provides Devel a way to generate realistic content (not lorem ipsum) using GPT and ChatGPT models. Useful for client demos, layout, theming, or QA.

openai_dblog

Demonstrates log analysis using OpenAI to find potential solutions or explanations for error logs. Responses from OpenAI persist for common error messages, allowing for easy review.

openai_prompt

Adds an area in the admin interface to explore OpenAI text generation capabilities and ask it (prompt) for whatever you'd like.

openai_embeddings

Analyzes nodes and generates vectors and text embeddings for your nodes, taxonomy, media, and paragraph entities from OpenAI. Responses from OpenAI are saved and can be used to improve search relevancy without expensive search backends. Content personalization and recommendation are also possible with this approach.

openai_tts

Adds the capability to interact with the OpenAI TTS (text-to-speech) endpoints.

Differences from Drupal

While much of the functionality mirrors the Drupal module, there are a few key differences:

  • No ECA Submodule: Backdrop CMS does not have the ECA module, which is available in Drupal. While Backdrop offers the Rules module, it does not provide the same functionality as ECA. As a result, there is no ECA submodule in the Backdrop version.
  • Embeddings Workflow: Only new content is indexed by default. To address this, I added a tab to queue existing content so it gets added to the vector database during the next cron run.
  • Vector Database Support: The Backdrop version only works with Pinecone, whereas the Drupal module supports both Pinecone and Milvus. My focus is on ensuring the basics work well rather than supporting all providers.
  • DALL·E Integration: Generated images are automatically saved as managed files, making them easier to use in content.

Installation

Backdrop CMS makes it easy to add new functionality. You can install the OpenAI module directly on your site using the Project Installer:

  1. Navigate to Functionality > Install new modules in the admin interface.
  2. Search for "OpenAI" or paste the module URL: https://backdropcms.org/project/openai.
  3. Click Install and enable the module.

The module includes a prepackaged vendor directory with the required OpenAI PHP library, so Composer isn’t necessary. However, if you prefer managing dependencies manually, you can run composer update to ensure the latest library version.

Getting Started with an OpenAI API Key

To use the module, you’ll need an API key from OpenAI. Follow these steps to obtain one:

  1. Visit OpenAI's platform to sign up for an account if you don’t already have one.
  2. After logging in, go to your account settings and navigate to the API keys section.
  3. Click Create new secret key, then copy and paste it into your Backdrop site under Configuration > OpenAI Settings.

That’s it—you’re ready to explore the module’s features!

Goals for the Future

While the module is already functional, I’m planning to expand its capabilities further:

  1. AI-Powered Search: I’m exploring the Search API AI module as a starting point for integrating AI with search.
  2. Alt Text Generation: Automating the generation of alt text for uploaded images is another feature on my roadmap.

Ready to Try It?

You can download the OpenAI module for Backdrop CMS here. For those curious about the original Drupal module, check it out here.

This release marks the beginning of what I hope will be a useful tool for the Backdrop community. I’m excited to hear your feedback and see what creative solutions you build with it!

Let me know if this now covers everything you’d like to highlight!