Drupal is a registered trademark of Dries Buytaert
drupal 11.4.2 Update released for Drupal core (11.4.2)! drupal 11.4.1 Update released for Drupal core (11.4.1)! drupal 11.4.0 Update released for Drupal core (11.4.0)! drupal 10.6.12 Update released for Drupal core (10.6.12)! drupal 11.3.13 Update released for Drupal core (11.3.13)! drupal 10.6.11 Update released for Drupal core (10.6.11)! drupal 11.3.12 Update released for Drupal core (11.3.12)! drupal 11.2.14 Update released for Drupal core (11.2.14)! drupal 10.5.12 Update released for Drupal core (10.5.12)! cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)!

ai_writer

No security coverage
View on drupal.org

AI Writer adds an OpenAI-powered writing assistant directly to your content forms. When creating or editing an article or any other content type, authors can type a plain-language instruction — like "Write a 300-word news article about our upcoming spring festival" — and the module generates a draft and drops it right into the body editor, ready to review and refine. It turns a blank page into a starting point, without leaving Drupal or copying and pasting from another AI tool.

Features

The basic functionality: an AI Writer panel appears on node add/edit forms with a prompt box and a Generate draft button. Behind the scenes the module calls the OpenAI Chat Completions API server-side, sanitizes the response, and inserts the resulting HTML into the body field's CKEditor 5 editor (falling back to a plain textarea when no WYSIWYG is present).

Unique features this module adds:

  • A single admin config page to set your OpenAI API key, model, system prompt, temperature, and max tokens — no code required.
  • Environment-variable support for the API key (OPENAI_API_KEY), which takes precedence over the stored config value, so secrets can stay out of your database and exported configuration.
  • Server-side API calls: the key is never exposed to the browser.
  • Output passed through Drupal's XSS filter before it reaches the editor.
  • Permission-gated (Use AI Writer) and CSRF-protected requests.
  • Works on every content type automatically — no per-type configuration.

When and why to use it: any site where editors regularly draft articles, news posts, or landing-page copy and would benefit from a fast first draft. Typical use cases include newsrooms, university and marketing sites, and multi-author blogs where reducing "blank page" friction speeds up publishing.

Post-Installation

After enabling the module:

  1. Go to Administration → Configuration → Content authoring → AI Writer (/admin/config/content/ai-writer) and provide your OpenAI API key (or set the OPENAI_API_KEY environment variable instead — it wins over the config value). Optionally adjust the model, system prompt, temperature, and max tokens.
  2. Grant the Use AI Writer permission to the roles that should have the assistant (e.g. Author, Editor) at /admin/people/permissions.
  3. Create or edit any content item. You'll see the AI Writer panel above the fields — enter an instruction, click Generate draft, and the draft is inserted into the body editor.

There is no new content type to look for and no text-format changes are required. The module targets the body field's CKEditor 5 instance automatically; if a form has no WYSIWYG, the text is appended to the raw textarea instead. Clear caches after enabling (drush cr) so the form additions and library attach correctly.

Additional Requirements

  • Drupal core ^10 || ^11 with the Node module (a core module, and a declared dependency).
  • An OpenAI API key with access to a chat model (default gpt-4o-mini) — see platform.openai.com.
  • Outbound HTTPS access from your server to api.openai.com.

No additional contributed modules or third-party PHP libraries are required — the module uses Drupal's built-in Guzzle HTTP client.

  • Any CKEditor 5 configuration (core) — the generated HTML lands in the body editor, so an editor set up for the tags the model returns (headings, lists, links) gives the best result.
  • Key or environment-based secret management (e.g. Pantheon Secrets, or the Key module pattern) to keep the API key out of exported configuration.

Similar projects

The AI (Artificial Intelligence) ecosystem provides a broad, provider-agnostic framework with many sub-modules and integrations. AI Writer is intentionally narrower: a small, self-contained module focused on one job — generating body content from a prompt on node forms — with minimal configuration and no dependency on a larger AI framework. Choose AI Writer when you want a lightweight, drop-in assistant; choose the AI framework when you need multiple providers, agents, or deeper platform integration.

Supporting this Module

Add your Patreon, Open Collective, GitHub Sponsors, or contact links here.

Community Documentation

Add links to walkthrough videos, a demo site (via DrupalPod), or extended docs here. See the module's README.md for full configuration, security notes, and testing instructions.

Activity

Total releases
2
First release
Jul 2026
Latest release
23 hours ago
Release cadence
0 days
Stability
100% stable

Releases

Version Type Release date
1.0.1 Stable Jul 12, 2026
1.0.0 Stable Jul 12, 2026