ai_provider_openrouter
54 sites
No security coverage
Adds OpenRouter to Drupal AI: 300 + models with chat/completions/embeddings/text-to-image, dynamic model discovery, key-based setup, optional curated model lists for lean UIs.
Features
- One-click gateway to 367 LLMs – instantly tap every model available on OpenRouter (GPT models, Claude models, Reasoning models, Embedding models, Gemini, Grok, etc.).
- Always up-to-date model list – the provider queries OpenRouter's /models and /embeddings/models endpoints on demand, so new models appear in Drupal as soon as OpenRouter lists them.
- Curated model selection – administrators may whitelist a smaller subset of models to keep drop-downs manageable for editors and automated workflows. Also select models according to price.
- Full support for Chat, Completions, Embeddings, and Text-to-Image operations – generate images from text prompts using Gemini, GPT-5, and other multimodal models.
- 21 dedicated embedding models – with automatic vector size detection (384-3072 dimensions) for seamless integration with vector databases.
- Batch embeddings processing – process multiple texts in a single API call for improved performance.
- Advanced multimodal support – chat with images, PDFs, and videos. Models can "watch" video content and analyze visual information.
- Reasoning model controls – fine-tune o1/o3/GPT-5 reasoning models with effort parameters (minimal to extra-high).
- Streaming responses – real-time output with token usage, reasoning tokens, and finish reason tracking.
- Function Calling/Tools – full support for tool calls and agentic workflows.
- Site builders can use OpenRouter models anywhere the AI module exposes providers: text formats, CKEditor AI, content moderation, custom automations, and more.
Post-Installation
- Install the module (and its dependencies) via Composer or the Extend page.
- Add your OpenRouter API key
- Navigate to Configuration » System » Keys (provided by the Key module).
- Create a new key of type “Authentication” and paste your OpenRouter key.
- Enable OpenRouter provider
- Go to Configuration » AI » Provider Settings.
- Select “OpenRouter”, choose the key you just created, and (optionally) pick which models to expose.
- If you leave the model list blank, every available model (300 +) will be offered.
- Use it anywhere the AI module appears – in text formats, CKEditor AI buttons, custom plugins, or your own code via \Drupal::service('ai_provider_openrouter.client').
Additional Requirements
- AI module (core provider framework)
- Key module ≥ 1.18 – secure storage for your API token
- openai-php/client ^0.10.1 – installed automatically when you run
composer require drupal/ai_provider_openrouter
Community Documentation
Documentation Link: Coming soon.