Drupal is a registered trademark of Dries Buytaert
drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). editoria11y 2.2.22 Minor update available for module editoria11y (2.2.22). ai 1.2.13 Minor update available for module ai (1.2.13). ai 1.3.2 Minor update available for module ai (1.3.2). moderated_content_bulk_publish 2.0.51 Minor update available for module moderated_content_bulk_publish (2.0.51). moderated_content_bulk_publish 2.0.50 Minor update available for module moderated_content_bulk_publish (2.0.50). editoria11y 2.2.21 Minor update available for module editoria11y (2.2.21). eca 3.1.0 Minor update available for module eca (3.1.0). sophron 3.1.1 Minor update available for module sophron (3.1.1). ai 1.3.1 Minor update available for module ai (1.3.1). seven 2.0.0-beta6 New beta version released for theme seven (2.0.0-beta6). seven 1.0.1-beta1 First beta version released for theme seven (1.0.1-beta1). ui_patterns 8.x-1.15 Minor update available for module ui_patterns (8.x-1.15). layout_paragraphs 3.0.0-beta1 First beta version released for module layout_paragraphs (3.0.0-beta1). raven 7.3.8 Minor update available for module raven (7.3.8). bamboo_twig 6.0.7 Minor update available for module bamboo_twig (6.0.7).

AI Budget Control provides a governance layer for AI operations in Drupal. It allows site administrators to manage, monitor and limit AI usage and costs across providers, roles and users — preventing unexpected bills and ensuring fair resource allocation.

Features

  • Automatic usage tracking: Every AI operation (chat, embeddings, text generation, etc.) is automatically logged with input/output token counts and estimated cost.
  • Hard limits: Block AI requests when a configured limit is reached. The user receives a clear message and no API call is made to the provider, saving costs immediately.
  • Soft limits: Trigger warnings and dispatch a Drupal event when usage reaches a configurable threshold (e.g. 80% of quota), allowing you to set up email alerts or Slack notifications before hitting the cap.
  • Flexible scopes: Apply limits globally, per AI provider (OpenAI, Anthropic, etc.), per Drupal role, or per individual user.
  • Multiple metrics: Set limits based on total tokens consumed, monetary budget ($), or number of requests.
  • Rolling time windows: Choose between hourly, daily, or monthly rolling windows for each limit rule.
  • Accurate per-model pricing: Built-in cost estimation for common OpenAI models (GPT-4o-mini, GPT-4o, GPT-4.1, GPT-3.5-turbo, etc.) with separate input/output token rates. Custom pricing can be configured for any model.
  • Flood protection: Built-in IP-based rate limiting for anonymous users on public-facing AI features like chatbots, using Drupal's Flood API.
  • Admin dashboard: Visual overview at /admin/reports/ai-usage showing total monthly cost, usage by provider/model, top consumers, and active limit status with color-coded indicators.
  • CSV export: One-click export of all usage logs for external analysis, accounting, or billing.
  • Limit precedence: When multiple limits apply to a request, the most restrictive hard limit prevails.
  • Event-driven architecture: Subscribes to AI module events (PreGenerateResponseEvent / PostGenerateResponseEvent) — no patches or core modifications required.

Post-Installation

  1. Navigate to Configuration > AI > AI Budget & Limits (/admin/config/ai/budget) to create your first limit rule.
  2. Select a provider (or "All Providers"), choose a scope (Global, Per Role, or Per User), pick a metric (Tokens, Budget, or Requests), and set the maximum value and time window.
  3. Visit Reports > AI Usage Dashboard (/admin/reports/ai-usage) to monitor usage in real time.
  4. The module starts tracking all AI operations immediately after installation — no additional configuration is needed for the tracking to begin.
  5. Optionally, subscribe to the ai_budget_control.soft_limit_reached event in a custom module to implement email alerts or other notifications when soft limits are triggered.

Additional Requirements

  • AI module (drupal/ai) >= 1.0 — This is the core AI framework that AI Budget Control hooks into. At least one AI provider (OpenAI, Anthropic, etc.) must be configured in the AI module for operations to be tracked.
  • Drupal 10.3+ or Drupal 11
  • PHP 8.1+
  • AI Chatbot (included in the AI module) — AI Budget Control automatically protects chatbot endpoints with flood protection for anonymous users.
  • AI Automators (included in the AI module) — Budget limits apply to automated AI operations (alt text generation, SEO analysis, etc.) as well.
  • AI Observability (included in the AI module) — Complements AI Budget Control with detailed logging and OpenTelemetry integration.
  • ECA — Use ECA rules to react to the SoftLimitReachedEvent and trigger email alerts, Slack messages, or other actions when soft limits are reached.

Similar projects

There is currently no contributed Drupal module that provides granular AI budget control and usage limiting. The AI module itself includes basic logging (via AI Observability) but does not offer limit enforcement, per-role/per-user quotas, or cost estimation. AI Budget Control fills this gap by adding a complete governance layer on top of the AI module ecosystem.

Community Documentation

  • The README.md included with the module contains full API documentation, pricing tables, and configuration examples.
  • The module provides a composer.json for easy installation via Composer.
  • All configuration is done through the Drupal admin UI — no code changes required.

Activity

Total releases
1
First release
Apr 2026
Latest release
12 hours ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.1 Stable Apr 8, 2026