Drupal is a registered trademark of Dries Buytaert
Release: Dynamic Entity Reference 3.2.3 Minor update available for module dynamic_entity_reference (3.2.3). Release: Charts 5.2.3 Minor update available for module charts (5.2.3). Release: amazee.ai Private AI Provider 1.3.5 Minor update available for module ai_provider_amazeeio (1.3.5). Release: Search and Replace Scanner 2.0.0-beta5 New beta version released for module scanner (2.0.0-beta5). Release: Database Info Schema 1.3.1 Minor update available for module database_info_schema (1.3.1). Release: Easy LQP 2.0.4 Minor update available for module easy_lqp (2.0.4). Usage Milestone: Media entity Twitter Module media_entity_twitter crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs. Module Revived: Message 8.x-1.9 Module message updated after 17 months of inactivity (8.x-1.9).

This module provides a single connection to Cloudflare's AI Gateway, allowing your Drupal site to access various AI models from different providers like OpenAI, Anthropic, and Google. It leverages the gateway's caching, logging, and cost analytics, and centralizes billing and API key management through Cloudflare instead of storing them in Drupal.

One Drupal AI provider that reaches every model a Cloudflare AI Gateway fronts (OpenAI, Anthropic, Google, Workers AI and more), with the gateway's caching, logging and cost analytics.

The AI module is how Drupal connects to AI services. This provider points it at a single Cloudflare AI Gateway, so every AI feature in your site (the Explorer, Automators, Chatbot, AI Search and more) can use any model the gateway offers, all through one connection.

With unified billing on the gateway, you do not need a separate API key for each vendor: Cloudflare bills your account directly and every model is available. If you prefer, you can bring your own provider keys, held in the gateway rather than in Drupal. Either way, no provider key is stored in your Drupal site.

Features

  • One provider for every model the gateway fronts, instead of installing a separate provider module for each vendor.
  • Chat (including streamed responses) and embeddings, available to every part of the AI module.
  • The gateway's caching, request logging and cost analytics, applied across all upstream models.
  • Per-request gateway controls: bypass the cache, and attach metadata — with the operation type and any tags — so requests are filterable in the Cloudflare dashboard.
  • A model picker that filters the gateway's live model catalogue by provider and shows each model's price per million tokens, so you choose exactly which models to expose.
  • Cloudflare Dynamic Routing: name a route as dynamic/<route> to use its multi-provider fallback and retries as a model.
  • Credentials (account ID and token) live in settings.php, never in configuration or the database.

Use it when you want one place to manage models, spend and observability across several AI vendors, or when you want Cloudflare's caching and analytics in front of your AI calls.

Post-Installation

After enabling the module:

  1. In the Cloudflare dashboard, create an AI Gateway and an API token for it. Note your account ID and the gateway slug.
  2. Add a credential set at Configuration > Web services > Cloudflare credentials, giving it a machine name. Put its account ID and token in settings.php, keyed by that machine name:
    $settings['cloudflare']['credentials']['my_gateway'] = [
      'account_id' => 'your-account-id',
      'token' => 'your-token',
    ];
  3. Add a gateway at Configuration > Web services > Cloudflare AI Gateways, setting its slug and selecting the credential set.
  4. Go to Configuration > AI > Providers > Cloudflare AI Gateway, select the gateway, and choose the chat and embeddings models to expose. Filter by provider to find models in the gateway's live catalogue, where each model's price per million tokens is shown.

The models you select become available to every AI feature that uses this provider.

Additional Requirements

This module requires the AI module, the Cloudflare AI module and the Cloudflare SDK module. Installing with Composer pulls in all of them:

composer require drupal/ai_provider_cloudflare_gateway

While the suite is in alpha, require it as drupal/ai_provider_cloudflare_gateway:^1.0@alpha (or set your project's minimum-stability to alpha) so the pre-stable releases resolve. You also need a Cloudflare account with an AI Gateway configured.

Any module in the AI ecosystem benefits from this provider, since they route their requests through it. Examples include AI Chatbot, AI Search and AI Automators, all submodules of the AI module.

Similar projects

Single-vendor providers such as OpenAI Provider and Anthropic Provider connect the AI module to one vendor each. This provider instead fronts many vendors through a single Cloudflare AI Gateway, and adds the gateway's caching, cost analytics and fallbacks across all of them. Use a single-vendor provider if you only need one vendor and no gateway; use this one to consolidate several vendors, billing and observability behind one connection.

Supporting this Module

Issue reports, patches and feedback are welcome in the project's issue queue.

Community Documentation

Documentation for the Drupal AI module is available at project.pages.drupalcode.org/ai.

Activity

Tracked releases
7
Tracked since
Jun 2026
Latest release
3 weeks ago
Releases (12 mo)
7 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0-alpha7 Pre-release Jul 11, 2026
1.0.0-alpha6 Pre-release Jul 11, 2026
1.0.0-alpha5 Pre-release Jul 10, 2026
1.0.0-alpha4 Pre-release Jul 8, 2026
1.0.0-alpha3 Pre-release Jul 7, 2026
1.0.0-alpha2 Pre-release Jun 21, 2026
1.0.0-alpha1 Pre-release Jun 21, 2026