One reasoning effort level for every AI provider.
Each vendor names its reasoning control differently: Anthropic output_config.effort, OpenAI and OpenRouter reasoning_effort / reasoning.effort, Gemini thinkingConfig.thinkingLevel. This module gives consumers one scale and one way to ask, and translates the level for each provider.
Scale
none, minimal, low, medium, high, xhigh, max. Each model accepts a subset.
Consumer API
use Drupal\ai_effort\EffortManager;
// What to offer: the model's levels, up to the site's ceiling, or NULL.
$levels = \Drupal::service(EffortManager::class)->levels('openrouter', 'openai/gpt-5-mini');
// $levels->levels: ['minimal', 'low', 'medium', 'high']; $levels->default: 'medium'.
// What to send: request metadata on the input.
$input->setRequestMetadataValue(EffortManager::METADATA_KEY, 'high');
- No level: the provider's default.
- A level the model doesn't offer, or above the site's ceiling: dropped and logged in the
ai_effortchannel, never sent. - Metadata does nothing when this module isn't installed, so consumers can set it without depending on the module.
- When the request has no output limit, the module sets one for
mediumand above (4096 to 16384 tokens), because reasoning counts against it.
Providers
| Provider | Levels from | Sent as |
|---|---|---|
| OpenRouter | /models reasoning.supported_efforts, cached for a day |
reasoning.effort |
| Gemini (3.x) | Table in the adapter | thinkingConfig (ThinkingConfig object) |
| Cloudflare AI Gateway | Table: Workers AI gpt-oss, Google AI Studio Gemini 3.x | reasoning_effort |
Any provider with its own effort or reasoning_effort select, e.g. Anthropic 1.3, OpenAI |
The provider's select options | That key |
Anthropic Provider 1.2.x calls Anthropic's OpenAI-compatible endpoint, which ignores effort; use 1.3.
Adapters are EffortAdapter plugins. An adapter names the provider IDs it handles and, optionally, a module it needs.
Requirements
- Drupal 11
- AI 1.5 or later
- Optional: OpenRouter Provider, Gemini Provider
Configuration
/admin/config/ai/effort: the highest level requests may use. Needs the "administer ai" permission.
Related issues
- AI #3586787: a provider-agnostic reasoning effort control in AI core. This module would retire once core has it.
- AI #3586788: streamed chat from OpenAI-type providers reports 0 reasoning and cached tokens.
- AI #3586789:
PostStreamingResponseEventhas an empty configuration. - OpenRouter Provider #3627909: the provider's own Reasoning Effort setting is never offered.
- Anthropic Provider #3607963: 1.3.0-beta2 drops tool calls from streamed responses.
How this module is built
Much of this module's code, tests and documentation was drafted with an AI coding assistant (Claude Code). The maintainers review, test and take responsibility for every change, and the tests and code checks run on drupal.org's CI. Contributions follow Drupal's policy on the use of AI when contributing.
Supporting this module
Developed and maintained by Tyler Brown Cifu Shuster of FivePaths, LLC. Development sponsored by FivePaths.
Project information
- Project categories: Artificial Intelligence (AI), Integrations
- Created by tbcs on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
